Skip to content

Encapsulate PTE contents from non-arch code

Ryan Roberts damon linux-mm lkml 5 versions – Applied

Status from this message: [merged mm-stable] mm-ptep_get-conversion.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest posting 2/23 patches 5 repliesApplied 3/3
  2. v3 posting 1/24 patches 8 repliesApplied 4/4
  3. v25 patches 18 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v1 posting 2/25 patches12 repliesSuperseded
v1 posting 1/25 patches5 repliesSuperseded

Patches in v3 posting 2/2 All 3 applied

#Subject and filesSizeRepliesApplied
1/3mm: ptdump should use ptep_get_lockless()mm/ptdump.c+1 -10 repliesApplied
2/3mm: Move ptep_get() and pmdp_get() helpersinclude/linux/pgtable.h+14 -140 repliesApplied
3/3mm: ptep_get() conversiondrivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c drivers/misc/sgi-gru/grufault.c drivers/vfio/vfio_iommu_type1.c +44 more+301 -2281 replyApplied

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by.

PatchSeongJae Park
1/3
2/3
3/3R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/3] Encapsulate PTE contents from non-arch code

Hi All,

(Including wider audience this time since changes touch a fair few subsystems)

This is the second half of v3 of a series to improve the encapsulation of pte entries by disallowing non-arch code from directly dereferencing pte_t pointers. Based on earlier feedback, I split the series in 2; the first part, fixes for existing bugs, was already posted at [3] and merged into mm-stable. This second part contains the conversion from direct dereferences to instead use ptep_get()/ptep_get_lockless().

See the v1 cover letter at [1] for rationale for this work.

Based on feedback at v2, I've removed the new ptep_deref() helper I originally added, and am now using the existing ptep_get() and ptep_get_lockless() helpers. Testing on Ampere Altra (arm64) showed no difference in performance when using ptep_deref() (*pte) vs ptep_get() (READ_ONCE(*pte)).

Patches are based on mm-unstable (49e038b1919e) and a branch is available at [4] (Let me know if this is the wrong branch to target - I'm still not familiar with the details of the mm- dev process!). Note that Hugh Dickins's "mm: allow pte_offset_map[_lock]() to fail" (now in mm-unstable) patch set caused a number of conflicts which I've resolved. But due to that, you won't be able to apply these patches on top of Linus's tree. I have an alternate branch on top of v6.4-rc6 at [5].

Changes since v2 [2]:
- Removed ptep_deref() helper
- Converted ptep_deref() callsites to use ptep_get[_lockless]()

Changes since v1 [1]:
- Fixed sh build bug reported by 0-day CI

[1] https://lore.kernel.org/linux-mm/[email protected]/
[2] https://lore.kernel.org/linux-mm/[email protected]/
[3] https://lore.kernel.org/all/[email protected]/
[4] https://gitlab.arm.com/linux-arm/linux-rr/-/tree/features/granule_perf/ptep_get-mm-unstable-lkml_v3
[5] https://gitlab.arm.com/linux-arm/linux-rr/-/tree/features/granule_perf/ptep_get-v6.4-rc6-lkml_v3

Thanks,
Ryan

Ryan Roberts (3):
mm: ptdump should use ptep_get_lockless()
mm: Move ptep_get() and pmdp_get() helpers
mm: ptep_get() conversion

 .../drm/i915/gem/selftests/i915_gem_mman.c    |   8 +-
 drivers/misc/sgi-gru/grufault.c               |   2 +-
 drivers/vfio/vfio_iommu_type1.c               |   7 +-
 drivers/xen/privcmd.c                         |   2 +-
 fs/proc/task_mmu.c                            |  33 +++---
 fs/userfaultfd.c                              |   6 +-
 include/linux/hugetlb.h                       |   4 +
 include/linux/mm_inline.h                     |   2 +-
 include/linux/pgtable.h                       |  34 +++---
 kernel/events/uprobes.c                       |   2 +-
 mm/damon/ops-common.c                         |   2 +-
 mm/damon/paddr.c                              |   2 +-
 mm/damon/vaddr.c                              |  10 +-
 mm/filemap.c                                  |   2 +-
 mm/gup.c                                      |  21 ++--
 mm/highmem.c                                  |  12 ++-
 mm/hmm.c                                      |   2 +-
 mm/huge_memory.c                              |   4 +-
 mm/hugetlb.c                                  |   2 +-
 mm/hugetlb_vmemmap.c                          |   6 +-
 mm/kasan/init.c                               |   9 +-
 mm/kasan/shadow.c                             |  10 +-
 mm/khugepaged.c                               |  22 ++--
 mm/ksm.c                                      |  22 ++--
 mm/madvise.c                                  |   6 +-
 mm/mapping_dirty_helpers.c                    |   4 +-
 mm/memcontrol.c                               |   4 +-
 mm/memory-failure.c                           |  26 ++---
 mm/memory.c                                   | 100 ++++++++++--------
 mm/mempolicy.c                                |   6 +-
 mm/migrate.c                                  |  14 +--
 mm/migrate_device.c                           |  15 +--
 mm/mincore.c                                  |   2 +-
 mm/mlock.c                                    |   6 +-
 mm/mprotect.c                                 |   8 +-
 mm/mremap.c                                   |   2 +-
 mm/page_table_check.c                         |   4 +-
 mm/page_vma_mapped.c                          |  27 +++--
 mm/pgtable-generic.c                          |   2 +-
 mm/ptdump.c                                   |   2 +-
 mm/rmap.c                                     |  34 +++---
 mm/sparse-vmemmap.c                           |   8 +-
 mm/swap_state.c                               |   8 +-
 mm/swapfile.c                                 |  20 ++--
 mm/userfaultfd.c                              |   4 +-
 mm/vmalloc.c                                  |   6 +-
 mm/vmscan.c                                   |  14 +--
 virt/kvm/kvm_main.c                           |  11 +-
 48 files changed, 316 insertions(+), 243 deletions(-)

--
2.25.1