[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/9] mm: introduce hw_pte_t for PTE table storage
- To: Alexander Gordeev <agordeev@xxxxxxxxxxxxx>
- From: Muhammad Usama Anjum <usama.anjum@xxxxxxx>
- Date: Fri, 7 Aug 2026 16:24:00 +0100
- Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 4.158.2.129) smtp.rcpttodomain=linux.ibm.com smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
- Arc-message-signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=214jEOHDvbqO65kJp7R9WvTe7aHGn+ywbFPey8CpPng=; b=y+TPSW3BkJ1wUWEQ2sdPKNn62KbZXzdE/RRRrao+EOsUTJgTZtUkfUNwGiKVCpF39Swbmbd5wxX4F7TgHkMR/eHuxNXfS60q5y3z2KCSD9V/rFsOQDDkPkOxMtAaMC1vEvORGD77NqqZuZ2t6zVYfxHh0tSrPjjxPy9iwHrAy4mekd47nKe08vlEsLMc2/53MckeG+WHt9Rd9/5SqaDvyL1zYObh9cIOBQysoAOscfpwXLhOEJffH1pZiNbV5UxBhASGtAXqrZpIylWQ3A2qq07ZT5YNmb3jKWs8dOpSPNEgnZPRyVJAFWTYhgQlasMIEbdxCVJtRCfD4iGbYwH77Q==
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=214jEOHDvbqO65kJp7R9WvTe7aHGn+ywbFPey8CpPng=; b=Iq5uLCPRY95NgPG05ec3/v2umI3pqGev6OJlMs7JnoSZa/9RU2leY3JSX/bYvrQkD0I7P1+cm78rMIHmjbqvjBW7B9mXVoMfVYbF+opAu4V+XE2BHctMeSKfr2XeJY44FM3zl1dqPfSUlfEMG+B6CiPQfIIlotdibkE9UBosH1EJPtygjT0yjeDg+eI5L/m71FQd9x8g57J2U6XhfKwPEIWMwIrh1riSh2LF+rAZ7E22DOaKucwUf1CTatrBeX0rJ5Q5DU7hX6WqB6NmLRg7PAqNEZZ6AHGC1dUBwtSis4KZ/YYk69flyBa7kLy0fsZiiWBcyjtBZR0lPz6uPGvmLA==
- Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=YgYEf8/SAqc2pFNvqaD4dDMa/gsJUU+5MZOxScmIqgUj/Tx7t4IlrtLsb91lNcg69MR7dVZoeSppBCkkBgQGOqwkJ6OWWJ+MTzZdA5kBb1VsrAvpI2lcKR4S8ceD0HjUcj+ESfu4Zd+1mIbJMlJ0ibLEGcuwKGy8JlCK2FsT3toHWjiGadnfZeBoOXcXciv/bmssMN5WrVhJFvGs2j8vQzPbqaxRjQSaxJiLt+8aMVo0WuXLmER0/KfgBnTJb7H6E9NhxpSG9VS6y01FqG904amkoWg43Gzd4regFez2fl/jNZpv5RUfsY46/OvfjqvHaibmSbVVst2yCnM5oUxUZg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nyb2Zb/LWU68b4QGwWAhlcQocb72STHW3uhfNyJ/g64lELJLAmSW96qAz/OMx/oWcaZqLK49ey50C0zOyinM7uz2f7t/rswIfJA3on937Xr6rhZb33gq8yhF4bo6zdBOVTLTTmBkHDZqbrhB1LfT98VZ4UuY+vRsvJGn47rpYM2oVFn7z917NcM2U9kmEetzF9c++WTMl6VCBZgLdoLH5eaGhWUVZSpGlwrGUhQRbJUXUyod4ZZbXfyj0kyvcfN7N4KwVdsxEpfT0a5ugq9b0gRmqdJdpiXUKBiRnGKrU20+fpbtbBQlvm3ws17MFXcdqwsLv/8+HoZLqlMT5UlyGA==
- Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=arm.com header.i="@arm.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"; dkim=pass header.s=selector1 header.d=arm.com header.i="@arm.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
- Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
- Cc: usama.anjum@xxxxxxx, Jani Nikula <jani.nikula@xxxxxxxxxxxxxxx>, Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>, Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>, Tvrtko Ursulin <tursulin@xxxxxxxxxxx>, David Airlie <airlied@xxxxxxxxx>, Simona Vetter <simona@xxxxxxxx>, Dimitri Sivanich <dimitri.sivanich@xxxxxxx>, Arnd Bergmann <arnd@xxxxxxxx>, Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>, "James E.J. Bottomley" <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx>, Helge Deller <deller@xxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Muchun Song <muchun.song@xxxxxxxxx>, Oscar Salvador <osalvador@xxxxxxx>, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, "Liam R. Howlett" <liam@xxxxxxxxxxxxx>, Lorenzo Stoakes <ljs@xxxxxxxxxx>, Will Deacon <will@xxxxxxxxxx>, "Aneesh Kumar K.V" <aneesh.kumar@xxxxxxxxxx>, Nick Piggin <npiggin@xxxxxxxxx>, Peter Zijlstra <peterz@xxxxxxxxxxxxx>, Andrey Ryabinin <ryabinin.a.a@xxxxxxxxx>, David Hildenbrand <david@xxxxxxxxxx>, Pasha Tatashin <pasha.tatashin@xxxxxxxxxx>, Chris Li <chrisl@xxxxxxxxxx>, Kairui Song <kasong@xxxxxxxxxxx>, Uladzislau Rezki <urezki@xxxxxxxxx>, Steven Rostedt <rostedt@xxxxxxxxxxx>, Masami Hiramatsu <mhiramat@xxxxxxxxxx>, Alexei Starovoitov <ast@xxxxxxxxxx>, Daniel Borkmann <daniel@xxxxxxxxxxxxx>, Andrii Nakryiko <andrii@xxxxxxxxxx>, Eduard Zingerman <eddyz87@xxxxxxxxx>, Kumar Kartikeya Dwivedi <memxor@xxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>, Namhyung Kim <namhyung@xxxxxxxxxx>, SJ Park <sj@xxxxxxxxxx>, "Matthew Wilcox (Oracle)" <willy@xxxxxxxxxxxxx>, Jan Kara <jack@xxxxxxx>, Jason Gunthorpe <jgg@xxxxxxxx>, Leon Romanovsky <leon@xxxxxxxxxx>, Miaohe Lin <linmiaohe@xxxxxxxxxx>, Dennis Zhou <dennis@xxxxxxxxxx>, Tejun Heo <tj@xxxxxxxxxx>, Christoph Lameter <cl@xxxxxxxxxx>, Mike Rapoport <rppt@xxxxxxxxxx>, Johannes Weiner <hannes@xxxxxxxxxxx>, ziy@xxxxxxxxxx, pfalcato@xxxxxxx, ryan.roberts@xxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, intel-gfx@xxxxxxxxxxxxxxxxxxxxx, dri-devel@xxxxxxxxxxxxxxxxxxxxx, linux-parisc@xxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, linux-mm@xxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx, linux-arch@xxxxxxxxxxxxxxx, kasan-dev@xxxxxxxxxxxxxxxx, linux-trace-kernel@xxxxxxxxxxxxxxx, bpf@xxxxxxxxxxxxxxx, linux-perf-users@xxxxxxxxxxxxxxx, damon@xxxxxxxxxxxxxxx
- Delivery-date: Fri, 07 Aug 2026 15:24:58 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Nodisclaimer: true
On 07/08/2026 8:09 am, Alexander Gordeev wrote:
> On Thu, Aug 06, 2026 at 09:38:39AM +0100, Muhammad Usama Anjum wrote:
>> pte_t is used both for logical PTE values and for entries stored in a PTE
>> table, so pte_t * does not distinguish a pointer to a copied value from a
>> pointer to table storage.
>>
>> Introduce hw_pte_t as the generic name for a PTE table element. Define it
>> as a macro alias of pte_t by default. When an architecture selects
>> ARCH_HAS_HW_PTE_T, define it as a structure containing a pte_t instead.
>> This preserves the representation while allowing converted architectures
>> to enforce the distinction at compile time.
>>
>> Keep the C type definitions behind an __ASSEMBLY__ check because
>> architecture assembly sources can include this header indirectly. Include
>> asm/page.h so consumers such as linux/vmalloc.h retain the page definitions
>> they previously obtained from that header.
>>
>> Signed-off-by: Muhammad Usama Anjum <usama.anjum@xxxxxxx>
>> ---
>> Changes since RFC v1:
>> - Add the ARCH_HAS_HW_PTE_T opt-in and generic wrapper definition.
>> - Exclude the C type definitions from assembly sources.
>> - Update the description for the new opt-in model.
>> ---
>> MAINTAINERS | 1 +
>> include/linux/pgtable_types.h | 17 +++++++++++++++++
>> mm/Kconfig | 3 +++
>> 3 files changed, 21 insertions(+)
>> create mode 100644 include/linux/pgtable_types.h
>>
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index e9c8567308a75..7169bea968cf5 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -16982,6 +16982,7 @@ F: include/linux/mmu_notifier.h
>> F: include/linux/pagewalk.h
>> F: include/linux/pgalloc.h
>> F: include/linux/pgtable.h
>> +F: include/linux/pgtable_types.h
>> F: include/linux/ptdump.h
>> F: include/linux/vmpressure.h
>> F: include/linux/vmstat.h
>> diff --git a/include/linux/pgtable_types.h b/include/linux/pgtable_types.h
>> new file mode 100644
>> index 0000000000000..70c3edd00a01b
>> --- /dev/null
>> +++ b/include/linux/pgtable_types.h
>> @@ -0,0 +1,17 @@
>> +/* SPDX-License-Identifier: GPL-2.0 */
>> +#ifndef _LINUX_PGTABLE_TYPES_H
>> +#define _LINUX_PGTABLE_TYPES_H
>> +
>> +#include <asm/page.h>
>> +
>> +#ifndef __ASSEMBLY__
>> +
>> +#ifdef CONFIG_ARCH_HAS_HW_PTE_T
>> +typedef struct { pte_t __pte; } hw_pte_t;
>
> On s390 it fails to compile once we do typedef hw_pte_t *pgtable_t
> in asm/page.h. m68k, powerpc and sparc may also have such problem.
>
> The below declaration helps to resolve it using forward declaration
> and without meddling with headers, though I do not like it much:
>
> typedef struct __hw_pte_t { pte_t __pte; } hw_pte_t;
Thank you for testing it out on s390.
As __hw_pte_t isn't being used yet in this series, would s390 enablement
patches add __hw_pte_t to this definition?
This could have been avoided if each architecture defined its own hw_pte_t.
But for now we are keeping the generic definition of hw_pte_t.
>
>> +#else
>> +#define hw_pte_t pte_t
>> +#endif
>> +
>> +#endif /* !__ASSEMBLY__ */
>> +
>> +#endif /* _LINUX_PGTABLE_TYPES_H */
>> diff --git a/mm/Kconfig b/mm/Kconfig
>> index 331daf7fcfab5..31ba9ebf4aafd 100644
>> --- a/mm/Kconfig
>> +++ b/mm/Kconfig
>> @@ -1316,6 +1316,9 @@ comment "GUP_TEST needs to have DEBUG_FS enabled"
>> config GUP_GET_PXX_LOW_HIGH
>> bool
>>
>> +config ARCH_HAS_HW_PTE_T
>> + bool
>> +
>> config DMAPOOL_TEST
>> tristate "Enable a module to run time tests on dma_pool"
>> depends on HAS_DMA
>> --
>> 2.47.3
>>
--
Thanks,
Usama
|