public inbox for linuxppc-dev@ozlabs.org
 help / color / mirror / Atom feed
* Re: [PATCH] arch/x86: memory_hotplug, do not bump up max_pfn for device private pages
       [not found] ` <692e1297e3b6_261c110064@dwillia2-mobl4.notmuch>
@ 2025-12-01 23:01   ` Gregory Price
  0 siblings, 0 replies; only message in thread
From: Gregory Price @ 2025-12-01 23:01 UTC (permalink / raw)
  To: balbirs
  Cc: linux-kernel, dan.j.williams, x86, Christian König,
	Ingo Molnar, Kees Cook, Bjorn Helgaas, Linus Torvalds,
	Peter Zijlstra, Andy Lutomirski, Alex Deucher, Bert Karwatzki,
	Madhavan Srinivasan, Nicholas Piggin, linux-mm, linuxppc-dev

On Mon, Dec 01, 2025 at 02:11:35PM -0800, dan.j.williams@intel.com wrote:
> [ add Gregory and linux-mm ]
> 
> [ full context for new Cc: ]
> Balbir Singh wrote:
> > Commit 7ffb791423c7 ("x86/kaslr: Reduce KASLR entropy on most x86 systems")
> > exposed a bug with nokaslr and zone device
> > interaction, as seen on a system with an AMD iGPU and dGPU (see [1]).
> > The root cause of the issue is that, the gpu driver registers a zone
                                         ^^^^^^^^^^^^^^ which one, iGPU
					 or dGPU? or they managed by the
					 same driver?

					 (sorry, stickler for vagueness)

> > Fix this by not bumping up max_pfn on x86 systems, when pgmap is passed
> > into add_pages(). The presence of pgmap is used to determine if device
> > private memory is being added via add_pages().
> >

Concur with Dan's take below here, please check for DEVICE_PRIVATE so as
not to affect DEVICE_COHERENT.  Or if there's a reason to affect
DEVICE_COHERENT, please explain here.

> > arch/powerpc is also impacted by this bug, this patch does not fix
> > the issue for powerpc.
> > 
> > I've left powerpc out of this regression change due to the time required
> > to setup and test via qemu. I wanted to address the regression quickly
> >

At least +Cc ppc folks to take a look?
+Cc: linux-ppc-dev

> diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
> index 0e4270e20fad..4cc8175f9ffd 100644
> --- a/arch/x86/mm/init_64.c
> +++ b/arch/x86/mm/init_64.c
> @@ -989,7 +989,7 @@ int add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages,
>  	 * addressable memory can force device drivers to use bounce buffers
>  	 * and impact their performance negatively:
>  	 */
> -	if (!params->pgmap)
> +	if (!params->pgmap || params->pgmap->type != MEMORY_DEVICE_PRIVATE)
>  		/* update max_pfn, max_low_pfn and high_memory */
>  		update_end_of_memory_vars(start_pfn << PAGE_SHIFT, nr_pages << PAGE_SHIFT);
>  

This looks better to me.

~Gregory


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-12-01 23:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20250401000752.249348-1-balbirs@nvidia.com>
     [not found] ` <692e1297e3b6_261c110064@dwillia2-mobl4.notmuch>
2025-12-01 23:01   ` [PATCH] arch/x86: memory_hotplug, do not bump up max_pfn for device private pages Gregory Price

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox