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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4DFCCC47422 for ; Thu, 25 Jan 2024 17:11:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PzhG26gMABdJKCXNU1CIBLYDo2bei6Emv0Kr0szU8vI=; b=pylcBtDTy7qqTg kKcZSy0wPUGp8xawlAtSGS9p2I25/J+4YWGMKU0tl2+pVd5G9nGgbfnLjCx69EO+wtb5BxsCEc3Rn kUxr8dIc4+G981l87ZK2ipApg8t7cQHbHUK60dYSrsddB/h/dN4173LW0s3x05KeoT7ijBb6rXFPo 66R2HM/UGd83yoaRnVsDOqQWcczpn76wQwO+c79u6QZTvK1rIfH/XOEjAmJjPyNfRiRwSPfwsQSeZ lzhJVaSA5zEDtMbkPUmrKK2xii1m0IFlbv0bYVJVNU/9DQ8MN9FR7Sx1oeGizQd1ZhMvYSRgMTC3s 0eia4zSD8gJvw6vGzAIw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT3GP-000000015au-1mcK; Thu, 25 Jan 2024 17:11:41 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rT3GG-000000015VF-2CdB for linux-arm-kernel@lists.infradead.org; Thu, 25 Jan 2024 17:11:34 +0000 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 46FFF1FB; Thu, 25 Jan 2024 09:12:14 -0800 (PST) Received: from [10.1.39.126] (XHFQ2J9959.cambridge.arm.com [10.1.39.126]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0F7F43F73F; Thu, 25 Jan 2024 09:11:28 -0800 (PST) Message-ID: <8a219957-ee9b-45b2-affc-b27104866238@arm.com> Date: Thu, 25 Jan 2024 17:11:27 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1] arm64/mm: Make set_ptes() robust when OAs cross 48-bit boundary To: Catalin Marinas Cc: Will Deacon , Andrew Morton , David Hildenbrand , "Matthew Wilcox (Oracle)" , linux-arm-kernel@lists.infradead.org References: <20240123161718.3921974-1-ryan.roberts@arm.com> Content-Language: en-GB From: Ryan Roberts In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240125_091132_697176_99E7B3FD X-CRM114-Status: GOOD ( 14.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 25/01/2024 17:07, Catalin Marinas wrote: > On Tue, Jan 23, 2024 at 04:17:18PM +0000, Ryan Roberts wrote: >> diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h >> index 79ce70fbb751..734b39401a05 100644 >> --- a/arch/arm64/include/asm/pgtable.h >> +++ b/arch/arm64/include/asm/pgtable.h >> @@ -92,6 +92,14 @@ static inline pteval_t __phys_to_pte_val(phys_addr_t phys) >> #define pfn_pte(pfn,prot) \ >> __pte(__phys_to_pte_val((phys_addr_t)(pfn) << PAGE_SHIFT) | pgprot_val(prot)) >> >> +/* >> + * Select all bits except the pfn >> + */ >> +static inline pgprot_t pte_pgprot(pte_t pte) >> +{ >> + return __pgprot(pte_val(pte) & ~PTE_ADDR_MASK); >> +} >> + >> #define pte_none(pte) (!pte_val(pte)) >> #define pte_clear(mm,addr,ptep) set_pte(ptep, __pte(0)) >> #define pte_page(pte) (pfn_to_page(pte_pfn(pte))) >> @@ -341,6 +349,12 @@ static inline void __sync_cache_and_tags(pte_t pte, unsigned int nr_pages) >> mte_sync_tags(pte, nr_pages); >> } >> >> +#define pte_next_pfn pte_next_pfn >> +static inline pte_t pte_next_pfn(pte_t pte) >> +{ >> + return pfn_pte(pte_pfn(pte) + 1, pte_pgprot(pte)); >> +} > > While I see why you wanted to optimise this, I'd rather keep the > pte_pgprot() change separate and at a later time. This will conflict > (fail to build) with Ard's patch removing PTE_ADDR_MASK: OK fair enough. I'll respin it without the pte_pgprot() change. Thanks for the review. > > https://lore.kernel.org/all/20240123145258.1462979-89-ardb+git@google.com/ > > This masking out is no longer straightforward with support for LPA2 > (especially the 52-bit physical addresses with 4K pages): bits 8 and 9 > of the PTE either contain bits 50, 51 of the PA or the shareability > attribute if FEAT_LPA2 is not present. In the latter case, we need them > preserved. > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel