From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9C64B330D2F for ; Fri, 10 Apr 2026 04:29:14 +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=1775795356; cv=none; b=g61yKg6Ols1Jrk8no8wBabZ88NrwzhHxvfe0kOeiL6czyi1SchqEkiuqdGsmNforgqA6I+nAoHbhIQ3c7HO5oe757sr+OmryFiBtLsY23hddBEdwcH06UlzFZLhjgGSxmFzoczJnXeQP4McsA9gKk6ezURAJ6OxpXfW5Z/SAg/4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775795356; c=relaxed/simple; bh=BSdQ3Ls3b2H01n0rpr+1N/SbRJC1dCvd44chWo22Nbc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=CGCSW9bOk+WDYNhXZkHrQFMv9otX6HqBk4919/vw5qXdOI/DnhR9nPlw38nQbTWM0ksdIdIwigRrG64z34nfwL/LZhsuYvcq2YYt+0+ByqEFlUUVD826UqjO/Dwu5wpYJEY+yLA+UTROlY9cVKyWf4cfagPTfK5m+HlZmU6zGNY= 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; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=bjxI+aQ8; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="bjxI+aQ8" 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 4B4522008; Thu, 9 Apr 2026 21:29:08 -0700 (PDT) Received: from [10.163.181.174] (unknown [10.163.181.174]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 37E5A3FAF5; Thu, 9 Apr 2026 21:29:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1775795354; bh=BSdQ3Ls3b2H01n0rpr+1N/SbRJC1dCvd44chWo22Nbc=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=bjxI+aQ8zFM9SyTQFzyGuKMzJg2y75xsC8VOiuWuEm99z0f5vvZn0tIA7wR7+h4Iy CzNTVCPduKNC02eWJmFtnGR1w9MZ9FUvS9hdN6XbJhkRIfwFDfcxyUx3QXbrABvHxb FKKbokiyNtbnCQKEVUV+bW6T2cZvHRUFw5fAnldY= Message-ID: <8ae905bd-fb1c-408d-bf50-77667a51e3a1@arm.com> Date: Fri, 10 Apr 2026 09:59:06 +0530 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: [RFC V1 02/16] mm: Add read-write accessors for vm_page_prot To: Mike Rapoport Cc: linux-arm-kernel@lists.infradead.org, Catalin Marinas , Will Deacon , Ryan Roberts , Mark Rutland , Lorenzo Stoakes , Andrew Morton , David Hildenbrand , Linu Cherian , linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <20260224051153.3150613-1-anshuman.khandual@arm.com> <20260224051153.3150613-3-anshuman.khandual@arm.com> Content-Language: en-US From: Anshuman Khandual In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 09/04/26 4:07 PM, Mike Rapoport wrote: > Hi Anshuman, > > On Tue, Feb 24, 2026 at 10:41:39AM +0530, Anshuman Khandual wrote: >> Currently vma->vm_page_prot is safely read from and written to, without any >> locks with READ_ONCE() and WRITE_ONCE(). But with introduction of D128 page >> tables on arm64 platform, vm_page_prot grows to 128 bits which can't safely >> be handled with READ_ONCE() and WRITE_ONCE(). >> >> Add read and write accessors for vm_page_prot like pgprot_read/write_once() >> which any platform can override when required, although still defaulting as >> READ_ONCE() and WRITE_ONCE(), thus preserving the functionality for others. >> >> Cc: Andrew Morton >> Cc: David Hildenbrand >> Cc: Lorenzo Stoakes >> Cc: Mike Rapoport >> Cc: linux-mm@kvack.org >> Cc: linux-kernel@vger.kernel.org >> Signed-off-by: Anshuman Khandual >> --- >> include/linux/pgtable.h | 14 ++++++++++++++ >> mm/huge_memory.c | 4 ++-- >> mm/memory.c | 2 +- >> mm/migrate.c | 2 +- >> mm/mmap.c | 2 +- >> 5 files changed, 19 insertions(+), 5 deletions(-) >> >> diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h >> index da17139a1279..8858b8b03a02 100644 >> --- a/include/linux/pgtable.h >> +++ b/include/linux/pgtable.h >> @@ -495,6 +495,20 @@ static inline pgd_t pgdp_get(pgd_t *pgdp) >> } >> #endif >> >> +#ifndef pgprot_read_once >> +static inline pgprot_t pgprot_read_once(pgprot_t *prot) > > I don't think we need _once in the helper name. Presence of the helper > already implies that pointer should not be just dereferenced from one side > and that using the helper will do The Right Thing from the other side. Makes sense - will drop __once from the helper name.