From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D79FC38A2D for ; Mon, 24 Oct 2022 07:42:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DBEB38E0002; Mon, 24 Oct 2022 03:42:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D49C28E0001; Mon, 24 Oct 2022 03:42:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BE7C88E0002; Mon, 24 Oct 2022 03:42:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id ACEAF8E0001 for ; Mon, 24 Oct 2022 03:42:45 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 737C8A0754 for ; Mon, 24 Oct 2022 07:42:45 +0000 (UTC) X-FDA: 80055051090.26.F789364 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf23.hostedemail.com (Postfix) with ESMTP id 70A18140009 for ; Mon, 24 Oct 2022 07:42:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=+551nFdjjNaKRc+YIKdcJO5CC2i49qM0eCgIvtnclt4=; b=vXs4iumQwL9vOvLZ8n4ahUE/gE EKbIJp2yUJD/zPchHVRDlqTebA5NXnpDa1G0EM+HrHCG0dhbuqar3EzxY2+YPVGGuef1PXLziHFch cNtEC0yEti2lp0rUXo6vC2efmfzwj8asQQ/hhAJEoCwJqzS2BkZESzPjfjXLJTkeczcneWiTjXCxz u7MeQ6hrQafOrNFpmPkpqhNdZe73lUsDDfU6z5BM6ysSnmKkTgumNJ4+Gpm7h21PzGgUTchfTwkMh gvm5IyBRMes9RGXRFhgpIg5nNiPSllTZsNNjuoeJuDrCi21f3kTtxYBZ/IuoXs71aFjTL7nD6dYfk s5Ppn7hQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1oms6Z-00FG4i-Si; Mon, 24 Oct 2022 07:42:39 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 81579300445; Mon, 24 Oct 2022 09:42:33 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 6219D2C2328BB; Mon, 24 Oct 2022 09:42:33 +0200 (CEST) Date: Mon, 24 Oct 2022 09:42:33 +0200 From: Peter Zijlstra To: Hugh Dickins Cc: Will Deacon , x86@kernel.org, willy@infradead.org, torvalds@linux-foundation.org, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, aarcange@redhat.com, kirill.shutemov@linux.intel.com, jroedel@suse.de, ubizjak@gmail.com Subject: Re: [PATCH 07/13] mm/gup: Fix the lockless PMD access Message-ID: References: <20221022111403.531902164@infradead.org> <20221022114424.906110403@infradead.org> <796cff9b-8eb8-8c53-9127-318d30618952@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <796cff9b-8eb8-8c53-9127-318d30618952@google.com> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666597364; a=rsa-sha256; cv=none; b=vVk1Vn+maKsuMPcfytcpEEOT6YsBkiKF8kEF2O33JbRyC9zVChyGf4qeZ5yXa57SCIhbFl 40LSXzaVr8QUqboIRXyNaiKQ5hdZUgYa9FuBejxbYH2kQHlVvGNg7nhiB05TcXQleXR/Wd 8x+iV85wSkYcvk4o/NA+YKAha0csjTE= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=vXs4iumQ; spf=none (imf23.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=peterz@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666597364; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=+551nFdjjNaKRc+YIKdcJO5CC2i49qM0eCgIvtnclt4=; b=ClaszlCPRDY+xHEHggpubvm3jkEUKvKa7CeNzDElHRuwCmyNMPniMSnoTX0N46eZyQ0xr0 t5tILRz3M+YVHcadl+/Q2PXXuQeL/tVk9fcPdNaVZ8LMzgIvO2g/t9ZaJKCy9AFWpUXmch iW+ECck2ZM8PLPpdCWqSX5dMpTpOzWI= X-Stat-Signature: iffy4wzmxiehaq6h6ojfzo8p8zo59r9i X-Rspamd-Queue-Id: 70A18140009 Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=vXs4iumQ; spf=none (imf23.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=peterz@infradead.org; dmarc=none X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1666597362-742059 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sat, Oct 22, 2022 at 05:42:18PM -0700, Hugh Dickins wrote: > On Sat, 22 Oct 2022, Peter Zijlstra wrote: > > > On architectures where the PTE/PMD is larger than the native word size > > (i386-PAE for example), READ_ONCE() can do the wrong thing. Use > > pmdp_get_lockless() just like we use ptep_get_lockless(). > > I thought that was something Will Deacon put a lot of effort > into handling around 5.8 and 5.9: see "strong prevailing wind" in > include/asm-generic/rwonce.h, formerly in include/linux/compiler.h. > > Was it too optimistic? Did the wind drop? > > I'm interested in the answer, but I've certainly no objection > to making this all more obviously robust - thanks. READ_ONCE() can't do what the hardware can't do. There is absolutely no way i386 can do an atomic 64bit load without resorting to cmpxchg8b. Also see the comment that goes with compiletime_assert_rwonce_type(). It explicitly allows 64bit because there's just too much stuff that does that (and there's actually 32bit hardware that *can* do it). But it's still very wrong.