Chunyan Zhang
277a1ae387
mm: softdirty: add pgtable_supports_soft_dirty()
Patch series "mm: Add soft-dirty and uffd-wp support for RISC-V", v15.
This patchset adds support for Svrsw60t59b [1] extension which is ratified
now, also add soft dirty and userfaultfd write protect tracking for
RISC-V.
The patches 1 and 2 add macros to allow architectures to define their own
checks if the soft-dirty / uffd_wp PTE bits are available, in other words
for RISC-V, the Svrsw60t59b extension is supported on which device the
kernel is running. Also patch1-2 are removing "ifdef
CONFIG_MEM_SOFT_DIRTY" "ifdef CONFIG_HAVE_ARCH_USERFAULTFD_WP" and "ifdef
CONFIG_PTE_MARKER_UFFD_WP" in favor of checks which if not overridden by
the architecture, no change in behavior is expected.
This patchset has been tested with kselftest mm suite in which soft-dirty,
madv_populate, test_unmerge_uffd_wp, and uffd-unit-tests run and pass, and
no regressions are observed in any of the other tests.
This patch (of 6):
Some platforms can customize the PTE PMD entry soft-dirty bit making it
unavailable even if the architecture provides the resource.
Add an API which architectures can define their specific implementations
to detect if soft-dirty bit is available on which device the kernel is
running.
This patch is removing "ifdef CONFIG_MEM_SOFT_DIRTY" in favor of
pgtable_supports_soft_dirty() checks that defaults to
IS_ENABLED(CONFIG_MEM_SOFT_DIRTY), if not overridden by the architecture,
no change in behavior is expected.
We make sure to never set VM_SOFTDIRTY if !pgtable_supports_soft_dirty(),
so we will never run into VM_SOFTDIRTY checks.
[lorenzo.stoakes@oracle.com: fix VMA selftests]
Link: https://lkml.kernel.org/r/dac6ddfe-773a-43d5-8f69-021b9ca4d24b@lucifer.local
Link: https://lkml.kernel.org/r/20251113072806.795029-1-zhangchunyan@iscas.ac.cn
Link: https://lkml.kernel.org/r/20251113072806.795029-2-zhangchunyan@iscas.ac.cn
Link: https://github.com/riscv-non-isa/riscv-iommu/pull/543 [1]
Signed-off-by: Chunyan Zhang <zhangchunyan@iscas.ac.cn>
Acked-by: David Hildenbrand <david@redhat.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexandre Ghiti <alex@ghiti.fr>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Axel Rasmussen <axelrasmussen@google.com>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Conor Dooley <conor@kernel.org>
Cc: Deepak Gupta <debug@rivosinc.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Rob Herring <robh@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Yuanchu Xie <yuanchu@google.com>
Cc: Alexandre Ghiti <alexghiti@rivosinc.com>
Cc: Andrew Jones <ajones@ventanamicro.com>
Cc: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2025-11-24 15:08:54 -08:00
..
2025-11-24 15:08:51 -08:00
2025-11-16 17:28:01 -08:00
2025-09-21 14:22:09 -07:00
2025-11-16 17:27:54 -08:00
2025-10-03 12:48:18 -07:00
2025-08-19 16:35:57 -07:00
2025-03-16 22:06:27 -07:00
2025-07-24 19:12:36 -07:00
2025-03-16 22:06:24 -07:00
2025-09-21 14:22:06 -07:00
2025-05-22 14:55:36 -07:00
2025-09-28 11:51:29 -07:00
2025-05-12 23:50:38 -07:00
2025-11-24 15:08:54 -08:00
2025-11-20 13:43:57 -08:00
2025-07-01 13:25:36 -06:00
2025-09-28 11:51:31 -07:00
2025-11-24 15:08:54 -08:00
2025-03-04 17:02:25 +00:00
2025-11-16 17:27:56 -08:00
2025-09-21 14:22:15 -07:00
2025-11-24 15:08:52 -08:00
2025-11-24 15:08:54 -08:00
2025-03-17 00:05:35 -07:00
2025-09-21 14:22:11 -07:00
2025-09-21 14:22:11 -07:00
2025-11-20 13:43:57 -08:00
2025-11-20 13:43:57 -08:00
2025-11-20 13:43:57 -08:00
2025-11-16 17:28:25 -08:00
2025-03-16 22:06:29 -07:00
2025-11-24 15:08:52 -08:00
2025-09-21 14:22:21 -07:00
2025-03-16 22:06:20 -07:00
2025-11-24 15:08:54 -08:00
2025-03-16 22:06:23 -07:00
2025-11-16 17:28:29 -08:00
2025-03-17 00:05:32 -07:00
2025-11-24 15:08:54 -08:00
2025-09-01 17:11:37 -07:00
2025-11-24 15:08:52 -08:00
2025-07-09 22:41:56 -07:00
2025-07-09 22:42:22 -07:00
2025-11-24 15:08:51 -08:00
2025-11-20 13:43:57 -08:00
2025-11-16 17:27:58 -08:00
2025-10-07 13:48:55 -07:00
2025-09-21 14:22:26 -07:00
2025-03-21 22:03:11 -07:00
2025-11-24 15:08:54 -08:00
2025-11-24 14:25:17 -08:00
2025-11-20 13:43:57 -08:00
2025-11-24 15:08:52 -08:00
2025-11-16 17:27:52 -08:00
2025-11-24 15:08:52 -08:00
2025-11-24 15:08:52 -08:00
2025-08-02 12:06:13 -07:00
2025-11-24 15:08:47 -08:00
2025-11-24 15:08:53 -08:00
2025-11-24 15:08:54 -08:00
2025-11-24 15:08:52 -08:00
2025-11-20 13:43:58 -08:00
2025-11-16 17:28:02 -08:00
2025-11-24 15:07:34 -08:00
2025-11-24 15:08:54 -08:00
2025-11-16 17:28:25 -08:00
2025-05-12 23:50:31 -07:00
2025-09-13 16:55:07 -07:00
2025-11-24 15:08:52 -08:00
2025-11-24 15:08:54 -08:00
2025-11-20 13:43:58 -08:00
2025-09-13 16:54:46 -07:00
2025-08-20 16:31:23 +03:00
2025-08-20 16:31:23 +03:00
2025-05-12 23:50:38 -07:00
2025-11-20 13:43:59 -08:00
2025-11-20 13:43:59 -08:00
2025-03-17 00:05:35 -07:00
2025-07-13 16:38:16 -07:00
2025-11-24 15:08:48 -08:00
2025-09-21 14:22:23 -07:00
2025-07-13 16:38:29 -07:00
2025-11-16 17:28:01 -08:00
2025-11-24 15:08:51 -08:00
2025-11-24 15:08:52 -08:00
2025-11-24 15:08:54 -08:00
2025-11-24 15:08:52 -08:00
2025-09-21 14:22:04 -07:00
2025-07-13 16:38:23 -07:00
2025-11-16 17:27:54 -08:00
2025-09-08 23:45:10 -07:00
2025-11-24 15:08:48 -08:00
2025-11-16 17:28:25 -08:00
2025-11-16 17:27:52 -08:00
2025-09-21 14:22:28 -07:00
2025-11-24 15:08:54 -08:00
2025-11-16 17:28:11 -08:00
2025-11-24 15:08:54 -08:00
2025-09-21 14:22:29 -07:00
2025-03-17 00:05:40 -07:00
2025-11-16 17:27:52 -08:00
2025-10-02 18:18:33 -07:00
2025-11-16 17:28:15 -08:00
2025-11-16 17:27:56 -08:00
2025-09-13 16:55:07 -07:00
2025-03-17 22:06:58 -07:00
2025-11-24 15:08:50 -08:00
2025-09-21 14:22:25 -07:00
2025-09-21 14:22:32 -07:00
2025-11-16 17:28:20 -08:00
2025-11-24 15:08:52 -08:00
2025-11-09 21:19:43 -08:00
2025-11-24 15:08:54 -08:00
2025-11-16 17:28:12 -08:00
2025-11-24 15:08:54 -08:00
2025-10-02 18:18:33 -07:00
2025-11-24 15:08:54 -08:00
2025-11-20 13:43:58 -08:00
2025-11-24 15:08:54 -08:00
2025-07-24 19:12:32 -07:00
2025-11-24 15:08:54 -08:00
2025-11-20 13:43:59 -08:00
2025-11-24 15:08:54 -08:00
2025-09-21 14:21:59 -07:00
2025-09-21 14:21:59 -07:00
2025-11-16 17:27:57 -08:00