Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp409334rdb; Tue, 23 Jan 2024 03:38:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IFFY7fWkar/hkFQOjJOu4LcqSmxqdc3iB8cXnej6i8w6orYWlDVwfMDd6A+UqdJTxmgR2Op X-Received: by 2002:a92:dacd:0:b0:361:a7b7:b87c with SMTP id o13-20020a92dacd000000b00361a7b7b87cmr6494151ilq.16.1706009928156; Tue, 23 Jan 2024 03:38:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706009928; cv=pass; d=google.com; s=arc-20160816; b=cm0f1Foii3wXpmJE/bQsGqSiuSlI37MjYIwzyTNs6uSqcJ8njxv0K2tAMWYXq+Hrjk eUi70/IeWOEE1gaKIojABF7wbdCB7NaLuCQrT3BoXOUPxUY0XmaGByni1dzsZizsF6RD SrLxJSExA3aXa1bCoiOoRBtnEdGJUMHrIOeimjfFCHcFNNilzo7viGWxx8zLD5NIm8PI IzHuNSaMtE0YDTicaSvZJ6Ziqi6NTOV6+ixwoirC0D/lv0iQOXc1oEl0EMzaYMmbiSxB XfRSltSnSHYVugm4xfnVMnHRp/oqEP2r7hkuseY0GvHW04kEKp4246Ogd+lXOm5AEYpa o35g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=nwxxzvSXiO2p/vLV9ElIAbrn8vHUM1rCUGz5o6MHR9o=; fh=n5o6Qev5BdSE3Xg9jZnoUp5b+hp1Tz7If3lEQM0yuU4=; b=LpFcc4A0XOGV0Ffnm2NjmPHWDuHnMlmYPy3280iIaZ18xNqsJ7RgC51EEcUHM/4b1T 8VnSiIDOZPwJrotKiilt/Mq6Z8ckShkifq1Ve1zHDvZ2JMMnLTxNQTv7+maa7q1Aj4VL aMq1BZGHkbB0lp2HxTSaolpQd1XzbLpKDXyoYtX129CUijWzlxCL0gSn0Ce8QFI7C9ML oqvacWOKdcDcVKBw+8Eb1IrAJPrNoCLkzDMKW1mAJx2DBkPvBvvqyL1vJhpB8JKeJUZE klEjYJg5A2elgdxoiSozu79ZQOG0CZd30/AuxwI45OXsmnwqeJfMSenXmXge4E6xD4gm jsvg== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-35206-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35206-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id c29-20020a631c5d000000b005d2eea210fesi1125138pgm.887.2024.01.23.03.38.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 03:38:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35206-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-35206-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35206-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id BA64528966B for ; Tue, 23 Jan 2024 11:38:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 239225D8EA; Tue, 23 Jan 2024 11:38:40 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A02EB5D73B; Tue, 23 Jan 2024 11:38:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706009919; cv=none; b=BuyzzhN/WL9qpoMW+5OEkeKqBCjfSkDqikeiD5kW30SL1Q/g9v1fSrxPz/zFJBT7E2bQ9qZ/Pw+5h1j3S7T1qPQaQ2w/rOYk7Hrw35ipLAftxost+ESf2GCKhaIJdChxyMChSuY9BIpYi2Dr2ZJkPR/YjIby6oJzebaU0WjffVo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706009919; c=relaxed/simple; bh=u85z0+EkXSihYcPlh67W1ZAfDWr2Xo68u058sMn4H5s=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=GztOfFG35oBsbNjEgWWeyawonJzw/46wXg8xRI4OStYN4xJUl2RB5UwBICmdJjca7hVq/33aV/Qmr2x2lEhZreRo0JWbpkQ0r1GvpMZbfa7qi9rq4Cq/jhhgQYVwkEIuDDtWwlr5l+1Fmy6siySbxNIB8pvF4aEu9XlN66Qk50E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 345D81FB; Tue, 23 Jan 2024 03:39:22 -0800 (PST) Received: from [10.57.77.165] (unknown [10.57.77.165]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1A33F3F762; Tue, 23 Jan 2024 03:38:31 -0800 (PST) Message-ID: Date: Tue, 23 Jan 2024 11:38:30 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 01/11] arm/pgtable: define PFN_PTE_SHIFT on arm and arm64 Content-Language: en-GB To: David Hildenbrand , Christophe Leroy , "linux-kernel@vger.kernel.org" Cc: "linux-mm@kvack.org" , Andrew Morton , Matthew Wilcox , Russell King , Catalin Marinas , Will Deacon , Dinh Nguyen , Michael Ellerman , Nicholas Piggin , "Aneesh Kumar K.V" , "Naveen N. Rao" , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexander Gordeev , Gerald Schaefer , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Sven Schnelle , "David S. Miller" , "linux-arm-kernel@lists.infradead.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-riscv@lists.infradead.org" , "linux-s390@vger.kernel.org" , "sparclinux@vger.kernel.org" References: <20240122194200.381241-1-david@redhat.com> <20240122194200.381241-2-david@redhat.com> <46080ac1-7789-499b-b7f3-0231d7bd6de7@redhat.com> <6703b648-10ab-4fea-b7f1-75421319465b@arm.com> <3a970289-a72f-418e-b43c-89f67f0d5283@redhat.com> From: Ryan Roberts In-Reply-To: <3a970289-a72f-418e-b43c-89f67f0d5283@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 23/01/2024 11:31, David Hildenbrand wrote: >>> >>>> If high bits are used for >>>> something else, then we might produce a garbage PTE on overflow, but that >>>> shouldn't really matter I concluded for folio_pte_batch() purposes, we'd not >>>> detect "belongs to this folio batch" either way. >>> >>> Exactly. >>> >>>> >>>> Maybe it's likely cleaner to also have a custom pte_next_pfn() on ppc, I just >>>> hope that we don't lose any other arbitrary PTE bits by doing the pte_pgprot(). >>> >>> I don't see the need for ppc to implement pte_next_pfn(). >> >> Agreed. > > So likely we should then do on top for powerpc (whitespace damage): > > diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm/pgtable.c > index a04ae4449a025..549a440ed7f65 100644 > --- a/arch/powerpc/mm/pgtable.c > +++ b/arch/powerpc/mm/pgtable.c > @@ -220,10 +220,7 @@ void set_ptes(struct mm_struct *mm, unsigned long addr, > pte_t *ptep, >                         break; >                 ptep++; >                 addr += PAGE_SIZE; > -               /* > -                * increment the pfn. > -                */ > -               pte = pfn_pte(pte_pfn(pte) + 1, pte_pgprot((pte))); > +               pte = pte_next_pfn(pte); >         } >  } Looks like commit 47b8def9358c ("powerpc/mm: Avoid calling arch_enter/leave_lazy_mmu() in set_ptes") changed from doing the simple increment to this more complex approach, but the log doesn't say why. >   > >