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: <6841026c50e57_249110022@dwillia2-xfh.jf.intel.com.notmuch>
Date: Wed, 4 Jun 2025 19:35:24 -0700
From: Dan Williams <dan.j.williams@...el.com>
To: Alistair Popple <apopple@...dia.com>, <linux-mm@...ck.org>
CC: Alistair Popple <apopple@...dia.com>, <gerald.schaefer@...ux.ibm.com>,
	<dan.j.williams@...el.com>, <jgg@...pe.ca>, <willy@...radead.org>,
	<david@...hat.com>, <linux-kernel@...r.kernel.org>, <nvdimm@...ts.linux.dev>,
	<linux-fsdevel@...r.kernel.org>, <linux-ext4@...r.kernel.org>,
	<linux-xfs@...r.kernel.org>, <jhubbard@...dia.com>, <hch@....de>,
	<zhang.lyra@...il.com>, <debug@...osinc.com>, <bjorn@...nel.org>,
	<balbirs@...dia.com>, <lorenzo.stoakes@...cle.com>,
	<linux-arm-kernel@...ts.infradead.org>, <loongarch@...ts.linux.dev>,
	<linuxppc-dev@...ts.ozlabs.org>, <linux-riscv@...ts.infradead.org>,
	<linux-cxl@...r.kernel.org>, <dri-devel@...ts.freedesktop.org>,
	<John@...ves.net>
Subject: Re: [PATCH 07/12] mm: Remove redundant pXd_devmap calls

Alistair Popple wrote:
> DAX was the only thing that created pmd_devmap and pud_devmap entries
> however it no longer does as DAX pages are now refcounted normally and
> pXd_trans_huge() returns true for those. Therefore checking both pXd_devmap
> and pXd_trans_huge() is redundant and the former can be removed without
> changing behaviour as it will always be false.
> 
> Signed-off-by: Alistair Popple <apopple@...dia.com>
[..]
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index 8d9d706..31b4110 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -1398,10 +1398,7 @@ static int insert_pfn_pmd(struct vm_area_struct *vma, unsigned long addr,
>  	}
>  
>  	entry = pmd_mkhuge(pfn_t_pmd(pfn, prot));
> -	if (pfn_t_devmap(pfn))
> -		entry = pmd_mkdevmap(entry);
> -	else
> -		entry = pmd_mkspecial(entry);
> +	entry = pmd_mkspecial(entry);
>  	if (write) {
>  		entry = pmd_mkyoung(pmd_mkdirty(entry));
>  		entry = maybe_pmd_mkwrite(entry, vma);
> @@ -1535,10 +1530,7 @@ static void insert_pfn_pud(struct vm_area_struct *vma, unsigned long addr,
>  	}
>  
>  	entry = pud_mkhuge(pfn_t_pud(pfn, prot));
> -	if (pfn_t_devmap(pfn))
> -		entry = pud_mkdevmap(entry);
> -	else
> -		entry = pud_mkspecial(entry);
> +	entry = pud_mkspecial(entry);

Wait, why are my gup tests passing?

If all dax pages are special, then vm_normal_page() should never find
them and gup should fail.

...oh, but vm_normal_page_p[mu]d() is not used in the gup path, and
'special' is not set in the pte path.

Yuck, that feels subtle.

I think for any p[mu]d where p[mu]d_page() is ok to use should never set
'special', right?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ