Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp919959rdb; Tue, 23 Jan 2024 21:46:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IFAvVZF1+1qz0BoRUDq33SrTPxnBlNsVHdNJCpwzKwRsuSPpWotlGHVN71Td6yG94ucS9TE X-Received: by 2002:a17:903:1d1:b0:1d7:856e:b4 with SMTP id e17-20020a17090301d100b001d7856e00b4mr387420plh.52.1706075204046; Tue, 23 Jan 2024 21:46:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706075204; cv=pass; d=google.com; s=arc-20160816; b=LpTb97hzCvXUtQEBGNtUK9N7+E+vGEeK/EHT9vB3Lw1ztohYSGokieEPFIuMTDgD3h VrUUy7FsJC6esnqHSL/JK8KktkLfrKX+L4qcDF5iciEAMqHqQwGlrbY/BACbT5IrEHg6 jECpN5N42meR3rnzeDl3qN1RzvccISPEFmH1QU1fwunqmDJbz/50PF3Qqbmc1wC51S5L UpVyJOE9XyCZ2Y3yym7rxb632oUIY0tZ+A0DPecGq+1EVRXuqQJMW8ikO7H5RAvM4V0u mNtkCU2kwF6nNHPxYa/BtDxZ6Fhj0bRFDHM/LyAaV55o6U4oQlyY5YWWkt7C9oVY+jDp E8BQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:references:in-reply-to:subject:cc:to:from :dkim-signature; bh=4ltIJ3M8D37j7XET67H6xkh40PuANTJUydygPc5UBI4=; fh=U+ycbtBvuBTuZQCP3ZTgM0sBFZqJyuvWas6xx0KFAts=; b=VHINwDT+YzHjClAKKa7p5PaxnryooplIimCZcMIOzXXDd7pg5RiefZ975DDHjsRhyS P8wZ+SiPPf6YP6ysRFJxoaXwsCO8MnZzlQW+w8U4m2/k30bdD9DU8b+6wTnlcwuvpaAb /OHKEiuMRYOPlcVozjMkt/I3U/3vgdvUD5SDYs+fRS01LmfBCTlunTg40CWmEkmkzYsj lE5QQVDF74TeZoWDQsSJRSKIb3VAkr3bhikdQ6fB7w5reT6Rro60qeI1h0N8lUlydwwC 8zd16DNTs6/V6j0JQG7FHkBkKVVKwuSzFKtsFCvkR8qFWES+FYKk9EbTD01/Bvs7tgCf 9kzA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SgqZYUET; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-36482-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36482-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id s23-20020a170902b19700b001d750d8945dsi4828955plr.179.2024.01.23.21.46.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 21:46:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-36482-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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SgqZYUET; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-36482-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36482-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 AC0E228A160 for ; Wed, 24 Jan 2024 05:46:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1DB02E55E; Wed, 24 Jan 2024 05:46:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SgqZYUET" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4253AE541; Wed, 24 Jan 2024 05:46:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706075196; cv=none; b=nVb1TsBRXtOrClXGGgQ7sxRuxP5Icy/c24//KJFRt7kvjmvlYb4h0cZnogWW22wwxUp9IN5r6QSl9+sn6qBS6iHDerpNXpHXaiestEsCWAPk3ftYs5ulfqRf7JWeqciqqehjjpPJXxXr50GMZDTJ60sHjp6zwkqxztRpBv228g4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706075196; c=relaxed/simple; bh=LhesHwoZXRdX5jfbi0laKsTDlPHkqd2QNDhd5PA0n64=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=iJJISIS9oqk5MjaHfBm/s39voVfmMo35oSGarl05+nF6wwa00TUekmsaCp9+7p635HNdhg7vd/A+p7ZJ8DkYlVxjL4Qp40Gf4TQdYdaRIs5DXW1cNDRmS8yix/Bo3hrwz4bs1eKU3DbH+Gk1QVKE8WLQ4yLOfljTZ51FG5Uju6s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SgqZYUET; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75644C433F1; Wed, 24 Jan 2024 05:46:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706075195; bh=LhesHwoZXRdX5jfbi0laKsTDlPHkqd2QNDhd5PA0n64=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=SgqZYUETYp0U/lExF64JKpfQ4QQzjrtotn/ONStmemo8UuEWx22RNGcCPysz/GGdH wF4/0iVnvQm3wM0s4Ag4Pkguroe5zo7K7nKVaDa3YhK1ow6WyrrQ0jGg/jh0nlfdU+ f9jiSYnPlhA+oQTs1xwIrXNokUtNwZ94UcVY9oqXd8lQQbttaFJlpF0H4Hptl0pH0W L6Si/Ez2ZPcSiKG/jTqZNA1RfHBeGdDrwVDOodIiOjh9BxNSAwCbUb8UnpBbsGqMmX Fry6owvnHK5HB/4QPvBt/16sEl5jOidoL18vHxJm0dea3fi94NjlvWmuxijOXq/zBL NkyRrt3sGxNQg== X-Mailer: emacs 29.1 (via feedmail 11-beta-1 I) From: Aneesh Kumar K.V To: David Hildenbrand , Christophe Leroy , Ryan Roberts , "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 , "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" Subject: Re: [PATCH v1 01/11] arm/pgtable: define PFN_PTE_SHIFT on arm and arm64 In-Reply-To: <3a970289-a72f-418e-b43c-89f67f0d5283@redhat.com> 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> Date: Wed, 24 Jan 2024 11:16:23 +0530 Message-ID: <87zfwvp9lc.fsf@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain David Hildenbrand writes: >>> >>>> 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); > } > } Agreed. -aneesh