Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp543775rdb; Tue, 23 Jan 2024 07:22:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IE58fyskXttk3EttvVP6g8F9+fqFgbO94pFBlU67kixlF7ETxiOwvpFYzcwnqp2W5wUypDy X-Received: by 2002:ac2:4c37:0:b0:510:5e7:e5f4 with SMTP id u23-20020ac24c37000000b0051005e7e5f4mr422325lfq.140.1706023350375; Tue, 23 Jan 2024 07:22:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706023350; cv=pass; d=google.com; s=arc-20160816; b=UTApSXg+GDsf4jbekFeIAoXuYMuP/YwMgPo+dHxb7J6QiXtyL5wO7i8iaMCWywDwvJ WbblkkkZa6BhU5dQyjiWaYfvIrgh+2O9QzMQMaG/VohOutiayjnTzv8uzFQd0KVVCOw2 ADbt9bm1ukShwqbHJFq4NzD7gSIPUlqDkIIOIYVHPQfJnNi4z3HG3dvh6dOBP1Ek4Jtd ayufcZC6TJWP2MOdinUQTql5RhlCMGR5a4LNDBmFf/h+t3c9zHpJjUMZFqjm3JLNirS+ RU5neGTiFvwXmfhVM3rj71HE5ose1oP/rHyZbgb7NA8YIxzl4dRJBGijukG6qPoY99r1 8+7A== 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=U4rODFtGTmyWl99tccAq27uh/JRrwvUMNk83FjTeLnE=; fh=95MgjyxwobFW25mm/VAPHuycHmTgPmhTtD+cZwiXBYs=; b=h7ZMsJsd1EAAaJzpPNaTDSiPoZhtQ4Vr0kB7Wf35rUWdvUjUrLWH9FcBnRQE4x9CvP 4fUajesyRNHQoppmlv6qqr7Luz38Bfc4GiDcdMNRb+e7rEQXbn0xVgkwgxKHhAz4rdt3 ZnAhet0MeIr7SllAXUd93V4SmBr5CRC+pqn/Hav2PrG4hrfTL3uB1EQDbLwGP8sFBfgm aJ+tdSzPWSRm6i4kRP9DRER4CDSa22bTM1OuK3wGwkaNWPAtxCaPn1OY5LxJxQ3qJbIz 3vmO+pjeVX2JV0E4kDeAoRtZiB+cVXeV6kARCncENb9TT0ZLFn73qloR5PmLCobGVveF UQcA== 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-35530-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35530-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id o2-20020a170906288200b00a3033e31f9asi2312707ejd.226.2024.01.23.07.22.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 07:22:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35530-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; 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-35530-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35530-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 225681F27261 for ; Tue, 23 Jan 2024 15:22:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A1B935FEFD; Tue, 23 Jan 2024 15:22:10 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0BB6B5FDD2; Tue, 23 Jan 2024 15:22:06 +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=1706023330; cv=none; b=fIVtExs6aj0vOPDHzfBpfN/l8rZT/+8jCr9FQC2hfMHva2CUvyqtdnyBAtSkrzFF5SNF74K1C9zNsJH2d7DOWyF+1Zrx3OEB7X0De/v7sDHBCeE+bme3dygj7K5j/xqcFODJn8utuCat6dCKsBJUOQmPVShPCgc7LzkD/uxsJ+Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706023330; c=relaxed/simple; bh=B8rajI02soiPeZIE95pKcfT09vwUGJ8c8WQVfwcI9hw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=UuS7RelIXT7lcAZ0guOrdG4Icq+klLn6pGw58cZdpmzF6Y6TANLCCpSn7PmWskGM8aFV5VIuwOZrPDwjJRqU07OG7OGrCn5ISsDi6T3YC33VgQfG/2gztu9GC7wAMx7sWuwEsYq8VOi0SdmInGTkYVt1O5tj9z2+Cq9kUEODvxM= 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 985121FB; Tue, 23 Jan 2024 07:22:51 -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 1AB543F5A1; Tue, 23 Jan 2024 07:22:01 -0800 (PST) Message-ID: <90a9b1e5-9203-4baf-a69a-69b4f9ad73d5@arm.com> Date: Tue, 23 Jan 2024 15:22:00 +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: Matthew Wilcox Cc: David Hildenbrand , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Russell King , Catalin Marinas , Will Deacon , Dinh Nguyen , Michael Ellerman , Nicholas Piggin , Christophe Leroy , "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> From: Ryan Roberts In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 23/01/2024 15:01, Matthew Wilcox wrote: > On Tue, Jan 23, 2024 at 10:34:21AM +0000, Ryan Roberts wrote: >>> +#define PFN_PTE_SHIFT PAGE_SHIFT >> >> I think this is buggy. And so is the arm64 implementation of set_ptes(). It >> works fine for 48-bit output address, but for 52-bit OAs, the high bits are not >> kept contigously, so if you happen to be setting a mapping for which the >> physical memory block straddles bit 48, this won't work. > > I'd like to see the folio allocation that can straddle bit 48 ... > > agreed, it's not workable _in general_, but specifically for a memory > allocation from a power-of-two allocator, you'd have to do a 49-bit > allocation (half a petabyte) to care. Hmm good point. So its a hypothetical bug, not an actual bug. Personally I'm still inclined to "fix" it. Although its going to cost a few more instructions. Shout if you disagree.