lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
 <SN6PR02MB4157F8C860B0164C4115622CD462A@SN6PR02MB4157.namprd02.prod.outlook.com>
Date: Mon, 2 Jun 2025 04:44:06 +0000
From: Michael Kelley <mhklinux@...look.com>
To: Alistair Popple <apopple@...dia.com>, "linux-mm@...ck.org"
	<linux-mm@...ck.org>
CC: "gerald.schaefer@...ux.ibm.com" <gerald.schaefer@...ux.ibm.com>,
	"dan.j.williams@...el.com" <dan.j.williams@...el.com>, "jgg@...pe.ca"
	<jgg@...pe.ca>, "willy@...radead.org" <willy@...radead.org>,
	"david@...hat.com" <david@...hat.com>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "nvdimm@...ts.linux.dev"
	<nvdimm@...ts.linux.dev>, "linux-fsdevel@...r.kernel.org"
	<linux-fsdevel@...r.kernel.org>, "linux-ext4@...r.kernel.org"
	<linux-ext4@...r.kernel.org>, "linux-xfs@...r.kernel.org"
	<linux-xfs@...r.kernel.org>, "jhubbard@...dia.com" <jhubbard@...dia.com>,
	"hch@....de" <hch@....de>, "zhang.lyra@...il.com" <zhang.lyra@...il.com>,
	"debug@...osinc.com" <debug@...osinc.com>, "bjorn@...nel.org"
	<bjorn@...nel.org>, "balbirs@...dia.com" <balbirs@...dia.com>,
	"lorenzo.stoakes@...cle.com" <lorenzo.stoakes@...cle.com>,
	"linux-arm-kernel@...ts.infradead.org"
	<linux-arm-kernel@...ts.infradead.org>, "loongarch@...ts.linux.dev"
	<loongarch@...ts.linux.dev>, "linuxppc-dev@...ts.ozlabs.org"
	<linuxppc-dev@...ts.ozlabs.org>, "linux-riscv@...ts.infradead.org"
	<linux-riscv@...ts.infradead.org>, "linux-cxl@...r.kernel.org"
	<linux-cxl@...r.kernel.org>, "dri-devel@...ts.freedesktop.org"
	<dri-devel@...ts.freedesktop.org>, "John@...ves.net" <John@...ves.net>
Subject: RE: [PATCH 11/12] mm: Remove callers of pfn_t functionality

From: Alistair Popple <apopple@...dia.com> Sent: Wednesday, May 28, 2025 11:32 PM
> 
> All PFN_* pfn_t flags have been removed. Therefore there is no longer
> a need for the pfn_t type and all uses can be replaced with normal
> pfns.
> 
> Signed-off-by: Alistair Popple <apopple@...dia.com>
> Reviewed-by: Christoph Hellwig <hch@....de>
> ---
>  arch/x86/mm/pat/memtype.c                |  6 +-
>  drivers/dax/device.c                     | 23 +++----
>  drivers/dax/hmem/hmem.c                  |  1 +-
>  drivers/dax/kmem.c                       |  1 +-
>  drivers/dax/pmem.c                       |  1 +-
>  drivers/dax/super.c                      |  3 +-
>  drivers/gpu/drm/exynos/exynos_drm_gem.c  |  1 +-
>  drivers/gpu/drm/gma500/fbdev.c           |  3 +-
>  drivers/gpu/drm/i915/gem/i915_gem_mman.c |  1 +-
>  drivers/gpu/drm/msm/msm_gem.c            |  1 +-
>  drivers/gpu/drm/omapdrm/omap_gem.c       |  6 +--
>  drivers/gpu/drm/v3d/v3d_bo.c             |  1 +-
>  drivers/hwtracing/intel_th/msu.c         |  3 +-
>  drivers/md/dm-linear.c                   |  2 +-
>  drivers/md/dm-log-writes.c               |  2 +-
>  drivers/md/dm-stripe.c                   |  2 +-
>  drivers/md/dm-target.c                   |  2 +-
>  drivers/md/dm-writecache.c               | 11 +--
>  drivers/md/dm.c                          |  2 +-
>  drivers/nvdimm/pmem.c                    |  8 +--
>  drivers/nvdimm/pmem.h                    |  4 +-
>  drivers/s390/block/dcssblk.c             |  9 +--
>  drivers/vfio/pci/vfio_pci_core.c         |  5 +-
>  fs/cramfs/inode.c                        |  5 +-
>  fs/dax.c                                 | 50 +++++++--------
>  fs/ext4/file.c                           |  2 +-
>  fs/fuse/dax.c                            |  3 +-
>  fs/fuse/virtio_fs.c                      |  5 +-
>  fs/xfs/xfs_file.c                        |  2 +-
>  include/linux/dax.h                      |  9 +--
>  include/linux/device-mapper.h            |  2 +-
>  include/linux/huge_mm.h                  |  6 +-
>  include/linux/mm.h                       |  4 +-
>  include/linux/pfn.h                      |  9 +---
>  include/linux/pfn_t.h                    | 85 +-------------------------
>  include/linux/pgtable.h                  |  4 +-
>  include/trace/events/fs_dax.h            | 12 +---
>  mm/debug_vm_pgtable.c                    |  1 +-
>  mm/huge_memory.c                         | 27 +++-----
>  mm/memory.c                              | 31 ++++-----
>  mm/memremap.c                            |  1 +-
>  mm/migrate.c                             |  1 +-
>  tools/testing/nvdimm/pmem-dax.c          |  6 +-
>  tools/testing/nvdimm/test/iomap.c        |  7 +--
>  tools/testing/nvdimm/test/nfit_test.h    |  1 +-
>  45 files changed, 121 insertions(+), 250 deletions(-)
>  delete mode 100644 include/linux/pfn_t.h
> 

[snip]

> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index c5345ee..12d9665 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -3644,9 +3644,9 @@ vm_fault_t vmf_insert_pfn(struct vm_area_struct *vma, unsigned long addr,
>  vm_fault_t vmf_insert_pfn_prot(struct vm_area_struct *vma, unsigned long addr,
>  			unsigned long pfn, pgprot_t pgprot);
>  vm_fault_t vmf_insert_mixed(struct vm_area_struct *vma, unsigned long addr,
> -			pfn_t pfn);
> +			unsigned long pfn);
>  vm_fault_t vmf_insert_mixed_mkwrite(struct vm_area_struct *vma,
> -		unsigned long addr, pfn_t pfn);
> +		unsigned long addr, unsigned long pfn);
>  int vm_iomap_memory(struct vm_area_struct *vma, phys_addr_t start, unsigned long len);
> 
>  static inline vm_fault_t vmf_insert_page(struct vm_area_struct *vma,

[snip]

> diff --git a/mm/memory.c b/mm/memory.c
> index 6b03771..4eaf444 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -2635,7 +2634,7 @@ EXPORT_SYMBOL(vmf_insert_mixed);
>   *  the same entry was actually inserted.
>   */
>  vm_fault_t vmf_insert_mixed_mkwrite(struct vm_area_struct *vma,
> -		unsigned long addr, pfn_t pfn)
> +		unsigned long addr, unsigned long pfn)
>  {
>  	return __vm_insert_mixed(vma, addr, pfn, true);
>  }

vmf_insert_mixed_mkwrite() is not used anywhere in the
kernel. The commit message for cd1e0dac3a3e suggests it was
originally used by DAX code, so presumably it could just go away.

On the flip side, I have a patch set in flight (see Patch 3 of [1])
that uses it to do mkwrite on a special PTE, and my usage
requires passing PFN_SPECIAL in order to pass the tests in
vm_mixed_ok(). But this may be dubious usage, and should not
be a blocker to your elimination of pfn_t. I'll either add
vmf_insert_special_mkwrite() or figure out an equivalent. Anyone
with suggestions in that direction would be appreciated as I'm
not an mm expert.

Michael

[1] https://lore.kernel.org/linux-hyperv/20250523161522.409504-1-mhklinux@outlook.com/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ