damon.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] Encapsulate PTE contents from non-arch code
@ 2023-05-18 11:07 Ryan Roberts
  2023-05-18 11:07 ` [PATCH v2 1/5] mm: vmalloc must set pte via arch code Ryan Roberts
                   ` (4 more replies)
  0 siblings, 5 replies; 24+ messages in thread
From: Ryan Roberts @ 2023-05-18 11:07 UTC (permalink / raw)
  To: Andrew Morton, SeongJae Park, Christoph Hellwig
  Cc: Ryan Roberts, Matthew Wilcox (Oracle),
	Kirill A. Shutemov, Lorenzo Stoakes, Uladzislau Rezki, Zi Yan,
	linux-kernel, linux-mm, damon

Hi All,

This is v2 of a series to improve the encapsulation of pte entries by
disallowing non-arch code from directly dereferencing pte_t pointers. Instead
code must use a new helper, `pte_t ptep_deref(pte_t *ptep)`.

See the v1 cover letter at [1] for rationale and explanation of approach.

As with v1, the series is split up as follows:

patchs 1-2: Fix bugs where code was _setting_ ptes directly, rather than using
            set_pte_at() and friends.
patch 3:    Fix highmem unmapping issue I spotted while doing the work.
patch 4:    Introduce the new ptep_deref() helper with default implementation.
patch 5:    Convert all direct dereferences to use ptep_deref().

Patches are based on v6.4-rc2 and a branch is available at [2].

Changes since v1:
   - patch 5: Fixed sh build bug reported by 0-day CI
   - patch 1: Refactored pfn to use local variable
   - patch 1-2: Minor rewording of commit message: 'verify' -> 'check'
   - patch 1-3: applied Ack/Reviewed-by tags; thanks for those!

[1] https://lore.kernel.org/linux-mm/20230511132113.80196-1-ryan.roberts@arm.com/
[2] https://gitlab.arm.com/linux-arm/linux-rr/-/tree/features/granule_perf/ptep_deref-lkml_v2

Thanks,
Ryan

Ryan Roberts (5):
  mm: vmalloc must set pte via arch code
  mm: damon must atomically clear young on ptes and pmds
  mm: Fix failure to unmap pte on highmem systems
  mm: Add new ptep_deref() helper to fully encapsulate pte_t
  mm: ptep_deref() 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                       |  13 ++-
 kernel/events/uprobes.c                       |   2 +-
 mm/damon/ops-common.c                         |  18 ++-
 mm/damon/ops-common.h                         |   4 +-
 mm/damon/paddr.c                              |   6 +-
 mm/damon/vaddr.c                              |  14 ++-
 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                               |  24 ++--
 mm/ksm.c                                      |  22 ++--
 mm/madvise.c                                  |   6 +-
 mm/mapping_dirty_helpers.c                    |   4 +-
 mm/memcontrol.c                               |   4 +-
 mm/memory-failure.c                           |   6 +-
 mm/memory.c                                   | 105 +++++++++---------
 mm/mempolicy.c                                |   6 +-
 mm/migrate.c                                  |  14 ++-
 mm/migrate_device.c                           |  14 ++-
 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                          |  26 +++--
 mm/pgtable-generic.c                          |   2 +-
 mm/rmap.c                                     |  32 +++---
 mm/sparse-vmemmap.c                           |   8 +-
 mm/swap_state.c                               |   4 +-
 mm/swapfile.c                                 |  16 +--
 mm/userfaultfd.c                              |   4 +-
 mm/vmalloc.c                                  |  16 ++-
 mm/vmscan.c                                   |  14 ++-
 virt/kvm/kvm_main.c                           |   9 +-
 48 files changed, 310 insertions(+), 237 deletions(-)

--
2.25.1


^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2023-05-26  2:03 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-18 11:07 [PATCH v2 0/5] Encapsulate PTE contents from non-arch code Ryan Roberts
2023-05-18 11:07 ` [PATCH v2 1/5] mm: vmalloc must set pte via arch code Ryan Roberts
2023-05-19 12:09   ` Uladzislau Rezki
2023-05-24 18:47   ` Mike Rapoport
2023-05-18 11:07 ` [PATCH v2 2/5] mm: damon must atomically clear young on ptes and pmds Ryan Roberts
2023-05-18 17:13   ` SeongJae Park
2023-05-19  8:53     ` Ryan Roberts
2023-05-18 23:19   ` Yu Zhao
2023-05-19  9:02     ` Ryan Roberts
2023-05-19 19:54       ` SeongJae Park
2023-05-22  8:53         ` Ryan Roberts
2023-05-24 18:49   ` Mike Rapoport
2023-05-18 11:07 ` [PATCH v2 3/5] mm: Fix failure to unmap pte on highmem systems Ryan Roberts
2023-05-24 18:59   ` Mike Rapoport
2023-05-18 11:07 ` [PATCH v2 4/5] mm: Add new ptep_deref() helper to fully encapsulate pte_t Ryan Roberts
2023-05-18 19:28   ` Yu Zhao
2023-05-19  9:12     ` Ryan Roberts
2023-05-25  9:08       ` Ryan Roberts
2023-05-26  2:02       ` Yu Zhao
2023-05-24 19:06   ` Mike Rapoport
2023-05-24 19:11     ` Ryan Roberts
2023-05-18 11:07 ` [PATCH v2 5/5] mm: ptep_deref() conversion Ryan Roberts
2023-05-18 12:08   ` Jason Gunthorpe
2023-05-18 17:22   ` SeongJae Park

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).