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 E5EEEECAAA1 for ; Thu, 27 Oct 2022 19:35:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7897F6B0071; Thu, 27 Oct 2022 15:35:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 739346B0073; Thu, 27 Oct 2022 15:35:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 629676B0074; Thu, 27 Oct 2022 15:35:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 56F306B0071 for ; Thu, 27 Oct 2022 15:35:29 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 395FC16022B for ; Thu, 27 Oct 2022 19:35:29 +0000 (UTC) X-FDA: 80067733578.13.AF38EEA Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf06.hostedemail.com (Postfix) with ESMTP id F0C89180045 for ; Thu, 27 Oct 2022 19:35:26 +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=9oJTJnyopwqJiGG3+HjHBUrRsMJkOVWsIsyY4HzDMIQ=; b=B/SFOQ/HTgB4tzepuLj9syllXK nzbunSooLRSQV84MEW8hz+xJC6vSrMssCwsUvuKzUdgGatr2WM+vWDCjAfhQ5U5d0uAju0znz5wpO RY+LRYkwgptnRaX0eI0GhAsg72vayQoU3gD4QMr19tsYSyM/T8/lzCIKdXQ+65XMl40ysmdpCZ3y2 NPGkdkTDmD9/hM5M9F6nNhP66uRJcUMhafu7+0Rhd8hf3e1ngIwDxNun8Bu1rLEWzOBmyICZAP1y9 MzSd4mukxVaK5Z9wS/kbhY5L4tHU9iSHv8foYbjhMDlbxxgl3kXLeshicGHUZEeBiCRnSACzyIRRg psA1syrg==; 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 1oo8f0-000XMl-MG; Thu, 27 Oct 2022 19:35:26 +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 05B2530017F; Thu, 27 Oct 2022 21:35:20 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id DB64F2C65BF63; Thu, 27 Oct 2022 21:35:20 +0200 (CEST) Date: Thu, 27 Oct 2022 21:35:20 +0200 From: Peter Zijlstra To: Linus Torvalds Cc: Jann Horn , John Hubbard , x86@kernel.org, willy@infradead.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 01/13] mm: Update ptep_get_lockless()s comment Message-ID: References: <20221022114424.515572025@infradead.org> <2c800ed1-d17a-def4-39e1-09281ee78d05@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666899327; a=rsa-sha256; cv=none; b=AL3YIlQDQcul4iJvWR0EGBqzcrt91Pu5rVjW6QV7XMgTSv7JPQXzdv977bn+trRyqG3D+0 zyLF14kebRXZAT+aTO/34arFJsTxQ1HRRxXFBRJ7Bs59LzpkhtScoO3D758Z7NyZqIJpED MFnEI2Sc+A3o1SiBQt89sE+mpNlD3EE= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="B/SFOQ/H"; spf=none (imf06.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=1666899327; 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=9oJTJnyopwqJiGG3+HjHBUrRsMJkOVWsIsyY4HzDMIQ=; b=naWv2C02CbGHDe0bfEiHJzg7vPjQLF2/o2bZFKJZeMa4FwEt9RXKpRWElkNntgdzX7fdjG YqKThdpxVDpNpNX+6VrDC2gpqzroRlctb3BrQo+gbdpEH7lgYbXbmv/xV85+rBJStOddyT RVCWM49/YlQY4CgeH3yAz4ndmKK0JBY= Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="B/SFOQ/H"; spf=none (imf06.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-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: F0C89180045 X-Stat-Signature: eugs4xciky5yhdwg8iyinahtubmgh15h X-Rspam-User: X-HE-Tag: 1666899326-59857 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: Just two quick remarks; it's far to late to really think :-) On Thu, Oct 27, 2022 at 11:13:55AM -0700, Linus Torvalds wrote: > But "fullmm" is probably even stronger than "mmap write-lock" in that > it should also mean "no other CPU can be actively using this" - either > for hardware page table walking, or for GUP. IIRC fullmm is really: this is the last user and we're taking the whole mm down -- IOW exit(). > For example, MADV_DONTNEED does this all with just the mmap lock held > for reading, so we *unless* we have that 'force_flush', we can > > (a) have another CPU continue to use the old stale TLB entry for quite a while > > (b) yet another CPU (that didn't have a TLB entry, or wanted to write > to a read-only one ) could take a page fault, and install a *new* PTE > entry in the same slot, all at the same time. > > Now, that's clearly *very* confusing. But being confusing may not mean > "wrong" - we're still delaying the free of the old entry, so there's > no use-after-free. Do we worry about CPU errata where things go side-ways if multiple CPUs have inconsistent TLB state?