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 CBC80C4829B for ; Mon, 12 Feb 2024 15:34:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 491D96B0085; Mon, 12 Feb 2024 10:34:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 442236B0087; Mon, 12 Feb 2024 10:34:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 309CC6B0088; Mon, 12 Feb 2024 10:34:53 -0500 (EST) 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 231E26B0085 for ; Mon, 12 Feb 2024 10:34:53 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id A9D431C1380 for ; Mon, 12 Feb 2024 15:34:52 +0000 (UTC) X-FDA: 81783549624.05.146CEC0 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf18.hostedemail.com (Postfix) with ESMTP id F350E1C0014 for ; Mon, 12 Feb 2024 15:34:50 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf18.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1707752091; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8s440b6N0idMMW77HQWg0oUEsrARMT9iTgTEsB1fv8M=; b=J0KehsqTydIeYzIuzKBiNLUdT09A3OqESu24DcjlaskFSnGT2R5EkJZPymG/TPmAFmJfnO D2G+JG6S7CT1OkXms8hOEhZztr9vNXwXEkIdvQZXoQ+pgLCzVupE6Kon2vF0m5y2HYbdFI bQwdFEeQod5OTBWzmWbGOp5fl3Q5GSA= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf18.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1707752091; a=rsa-sha256; cv=none; b=en4sz5cXHzMQr95JZK07YjdIRB0h0jIXR+5bKRa9c3Y8pCckhtI2Q6PQjOv71TXoddd+3u JnPo8XUhiDn+/Mg0lfFyfSMdbEzt1VH1Mrjn2GT77bBs5gq8ux9U6JPoV0D33rg9tA8Lpz mhlQF1ys7G/zAsT5aNmLJZhGuFhQ7q0= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 600FDDA7; Mon, 12 Feb 2024 07:35:31 -0800 (PST) Received: from [10.57.78.115] (unknown [10.57.78.115]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9D37C3F766; Mon, 12 Feb 2024 07:34:45 -0800 (PST) Message-ID: Date: Mon, 12 Feb 2024 15:34:43 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 19/25] arm64/mm: Wire up PTE_CONT for user mappings Content-Language: en-GB To: David Hildenbrand , Mark Rutland Cc: Catalin Marinas , Will Deacon , Ard Biesheuvel , Marc Zyngier , James Morse , Andrey Ryabinin , Andrew Morton , Matthew Wilcox , Kefeng Wang , John Hubbard , Zi Yan , Barry Song <21cnbao@gmail.com>, Alistair Popple , Yang Shi , Nicholas Piggin , Christophe Leroy , "Aneesh Kumar K.V" , "Naveen N. Rao" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, x86@kernel.org, linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20240202080756.1453939-1-ryan.roberts@arm.com> <20240202080756.1453939-20-ryan.roberts@arm.com> <502a3ea7-fd86-4314-8292-c7999eda92eb@arm.com> <427ba87a-7dd0-4f3e-861f-fe6946b7cd97@redhat.com> From: Ryan Roberts In-Reply-To: <427ba87a-7dd0-4f3e-861f-fe6946b7cd97@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: F350E1C0014 X-Stat-Signature: zw51mgpmtayc1a4d1psr6rw86bpfdxwi X-Rspam-User: X-HE-Tag: 1707752090-842761 X-HE-Meta: U2FsdGVkX1/QpfIY3+uMBrm/cBQsU6uwkrjg5QZbff2sJpO8zDcXqxeLi4SUuJhxjKFfGj/DKy/t9owb7VA9D3eAGtUNtk9Oruhs4c9rQclBtl+rORPlLe+EEMMlnepPbBjy8jYlo1J8asBmaatUU90sZcQS+WNkwWEeyyCFfjXTGFRDqp9HjqkewubzdwPmwH6S6zuJMNFyIE3DXJXs0Rr4mXRYJfzZHv4B+jVLxhMS+ZcEizeeuxy7mHA3yIIeXuJW0WkGv4B2IPlxq6xX/FrWK3EQbWrYkK6OXVyEX+7xqyG6mzia/UMHnFsyex7XEXg2XWc6AJSEcCSda9f/zLph4ENahyVff5qK0eAjee0b+cxpXcEmDKiRvud+4RVNq22d2yQlIYGfYLexbE+Kq1CJm9FmuXlP5nhtCF7NE+OKPa8fXaLDQyNmuybmCb9PIIf5vR/epZvyqRbXARgiPurqNZUtS2dvQNdGxnKOg4x0faSEFsuq3+2PO5Jo1lguOc1TbtSZ0kW2Plzd+9oEoA1iEWiyNIhq+0mC3DfffYOPc3UONF+wK0yX5ja2zALlIa0kBIaYYmXIFQkTkQY65uqX49a3xTcFHXOktIkyuceBkhHbpO920nZqHPVzPZKjDNzQlgVW2gJc/hzEXowXL27Nf7jB8BOacfuq1UJxLEKO/T4yg2+ARLEC8Lcl14MBVWABNjdMxNIWdQlgsYOiMD4RA6JqSxVOt46mPPwFwnLTjcaPEiuLaVxW6C/sjerOUgP2zoWHXivWiV4fxZyhr7Swmy2wO1GcQ3Y9ZszDoNikHfX0+WMRj6GZAT/Pltu+OzNAFSDLxb5DI36OCmFgnN2mfCjFlorlSXoG2CzRmU79vL+ntsZGjsOECZoY1eGxrxv3u7Q+HeEMeZHFycyFC3UfXeEgR1RSUXKN1q0i4qvssmKauxblvvtNsEtCXJZ44sZbIG1/D1ICXaLc0Ej +BQ== 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: List-Subscribe: List-Unsubscribe: On 12/02/2024 15:26, David Hildenbrand wrote: > On 12.02.24 15:45, Ryan Roberts wrote: >> On 12/02/2024 13:54, David Hildenbrand wrote: >>>>> If so, I wonder if we could instead do that comparison modulo the access/dirty >>>>> bits, >>>> >>>> I think that would work - but will need to think a bit more on it. >>>> >>>>> and leave ptep_get_lockless() only reading a single entry? >>>> >>>> I think we will need to do something a bit less fragile. ptep_get() does >>>> collect >>>> the access/dirty bits so its confusing if ptep_get_lockless() doesn't IMHO. So >>>> we will likely want to rename the function and make its documentation explicit >>>> that it does not return those bits. >>>> >>>> ptep_get_lockless_noyoungdirty()? yuk... Any ideas? >>>> >>>> Of course if I could convince you the current implementation is safe, I >>>> might be >>>> able to sidestep this optimization until a later date? >>> >>> As discussed (and pointed out abive), there might be quite some callsites where >>> we don't really care about uptodate accessed/dirty bits -- where ptep_get() is >>> used nowadays. >>> >>> One way to approach that I had in mind was having an explicit interface: >>> >>> ptep_get() >>> ptep_get_uptodate() >>> ptep_get_lockless() >>> ptep_get_lockless_uptodate() >> >> Yes, I like the direction of this. I guess we anticipate that call sites >> requiring the "_uptodate" variant will be the minority so it makes sense to use >> the current names for the "_not_uptodate" variants? But to do a slow migration, >> it might be better/safer to have the weaker variant use the new name - that >> would allow us to downgrade one at a time? > > Yes, I was primarily struggling with names. Likely it makes sense to either have > two completely new function names, or use the new name only for the "faster but > less precise" variant. > >> >>> >>> Especially the last one might not be needed. >> I've done a scan through the code and agree with Mark's original conclusions. >> Additionally, huge_pte_alloc() (which isn't used for arm64) doesn't rely on >> access/dirty info. So I think I could migrate everything to the weaker variant >> fairly easily. >> >>> >>> Futher, "uptodate" might not be the best choice because of PageUptodate() and >>> friends. But it's better than "youngdirty"/"noyoungdirty" IMHO. >> >> Certainly agree with "noyoungdirty" being a horrible name. How about "_sync" / >> "_nosync"? > > I could live with > > ptep_get_sync() > ptep_get_nosync() > > with proper documentation :) but could you live with: ptep_get() ptep_get_nosync() ptep_get_lockless_nosync() ? So leave the "slower, more precise" version with the existing name. > > I don't think we use "_sync" / "_nosync" in the context of pte operations yet. > > Well, there seems to be "__arm_v7s_pte_sync" in iommu code, bit at least in core > code nothing jumped at me. >