LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [BUG] sched/cache: "Make LLC id continuous" causes NULL cpumask
From: Shrikanth Hegde @ 2026-05-28 10:26 UTC (permalink / raw)
  To: Chen, Yu C
  Cc: srikar, venkat88, maddy, riteshh, chleroy, tim.c.chen, peterz,
	linux-kernel, linuxppc-dev, linux-sched, kprateek.nayak
In-Reply-To: <db443a1e-e6fc-491c-a38a-1cafc8e674cd@intel.com>

Hi Chenyu.

> Yes this direction look good to me. Regarding the arch_llc_mask(),
> how about the following per Srikar's description
> 
> const struct cpumask *arch_llc_mask(int cpu)
> {
>      /* Power9, CACHE domain is the LLC*/    if (shared_caches)
>          return cpu_l2_cache_mask(cpu);
> 
>      /* P7, P8, P10, P11, SMT domain is the LLC*/    return 
> cpu_smt_mask(cpu);
> }
> 
> thanks,
> Chenyu
> 

Yes. this is what i was thinking too. I have the patch, let me send it 
across shortly. It is fixing the boot panic for me in SPLPAR. Hopefully
it should work for others too.

I will send it as reply to main thread so one doesn't miss it out.


^ permalink raw reply

* Re: [PATCH v3 1/5] KVM: PPC: Book3S HV: Validate arch_compat against host compatibility mode
From: Ritesh Harjani @ 2026-05-28  3:13 UTC (permalink / raw)
  To: Amit Machhiwal, linuxppc-dev, Madhavan Srinivasan
  Cc: Vaibhav Jain, Amit Machhiwal, Anushree Mathur, Paolo Bonzini,
	Nicholas Piggin, Michael Ellerman, Christophe Leroy (CS GROUP),
	Jonathan Corbet, Shuah Khan, kvm, linux-kernel, linux-doc, lkp
In-Reply-To: <20260522152744.55251-2-amachhiw@linux.ibm.com>

Amit Machhiwal <amachhiw@linux.ibm.com> writes:

> On IBM POWER systems, newer processor generations can operate in
> compatibility modes corresponding to earlier generations. This becomes
> relevant for nested virtualization, where nested KVM guests may need to
> run with a specific processor compatibility level.
>
> Currently, when running a nested KVM guest (L2) inside a Power11 pSeries
> logical partition (L1) booted in Power10 compatibility mode, the guest
> fails to boot while setting 'arch_compat'. This happens because the CPU
> class is derived from the hardware PVR (via mfspr()), which reflects the
> physical processor generation (Power11), rather than the effective
> compatibility mode (Power10).
>
> As a result, userspace may request a Power11 arch_compat for the L2
> guest. However, the L1 partition, running in Power10 compatibility, has
> only negotiated support up to Power10 with the Power Hypervisor (L0).
> When H_SET_STATE is invoked with a Power11 Logical PVR, the hypervisor

s/H_SET_STATE/H_GUEST_SET_STATE 

> rejects the request, leading to a late guest boot failure:
>
>   KVM-NESTEDv2: couldn't set guest wide elements
>   [..KVM reg dump..]
>

I think irrespective of the other UAPI changes, we should still get this
fixed - so that we don't see a late KVM guest boot failure msgs.

So, in this review, I would like to mainly look at fixing this issue
first and would request if we can defer the UAPI changes as a separate
patch series please.


> This situation should be detected earlier. Rejecting unsupported
> 'arch_compat' values in 'kvmppc_set_arch_compat()' avoids issuing an
> invalid H_SET_STATE hcall and provides a clearer failure mode.

s/H_SET_STATE/H_GUEST_SET_STATE

>
> Add a check to reject Power11 'arch_compat' requests when the host is
> running in Power10 compatibility mode, returning -EINVAL early instead
> of deferring the failure to the hypervisor.
>
> Suggested-by: Vaibhav Jain <vaibhav@linux.ibm.com>
> Tested-by: Anushree Mathur <anushree.mathur@linux.ibm.com>
> Signed-off-by: Amit Machhiwal <amachhiw@linux.ibm.com>
> ---
>  arch/powerpc/kvm/book3s_hv.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
> index 61dbeea317f3..249d1f2e4e2c 100644
> --- a/arch/powerpc/kvm/book3s_hv.c
> +++ b/arch/powerpc/kvm/book3s_hv.c
> @@ -446,7 +446,19 @@ static int kvmppc_set_arch_compat(struct kvm_vcpu *vcpu, u32 arch_compat)
>  			guest_pcr_bit = PCR_ARCH_300;
>  			break;
>  		case PVR_ARCH_31:
> +			guest_pcr_bit = PCR_ARCH_31;
> +			break;
>  		case PVR_ARCH_31_P11:
> +			/*
> +			 * Need to check this for ISA 3.1, as Power10 and
> +			 * Power11 share the same PCR. For any subsequent ISA
> +			 * versions, this will be taken care of by the guest vs
> +			 * host PCR comparison below.
> +			 */
> +			if ((PVR_ARCH_31 & cur_cpu_spec->pvr_mask) ==
> +				cur_cpu_spec->pvr_value) {
> +				return -EINVAL;
> +			}

Instead of the complicated check can we simply do this?
			if (!cpu_has_feature(CPU_FTR_P11_PVR))
				return -EINVAL;

which means that if the Qemu is trying to set the arch_compat with P11
PVR (arch_compat) and if the host cpu FTR doesn't support P11 PVR, then
simply return -EINVAL

-ritesh



^ permalink raw reply

* Re: [PATCH 19/23] platform/surface: gpe: use platform_device_set_fwnode()
From: Ilpo Järvinen @ 2026-05-28 11:21 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Lee Jones, Mark Brown, Thierry Reding, Sebastian Hesselbarth,
	Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Srinivas Kandagatla, Greg Kroah-Hartman, Vinod Koul,
	Rafael J. Wysocki, Danilo Krummrich, Rob Herring, Saravana Kannan,
	Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy (CS GROUP), Andi Shyti, Andy Shevchenko,
	Joerg Roedel, Will Deacon, Robin Murphy, Doug Berger,
	Florian Fainelli, Broadcom internal kernel review list,
	Ulf Hansson, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Matthew Brost, Thomas Hellström, Rodrigo Vivi,
	David Airlie, Simona Vetter, Peter Chen, Paul Cercueil, Bin Liu,
	Philipp Zabel, Maximilian Luz, Hans de Goede, Krzysztof Kozlowski,
	Benjamin Herrenschmidt, brgl, LKML, Netdev, linux-arm-msm,
	linux-sound, driver-core, devicetree, linuxppc-dev, linux-i2c,
	iommu, linux-pm, imx, linux-arm-kernel, intel-xe, dri-devel,
	linux-usb, linux-mips, platform-driver-x86
In-Reply-To: <20260521-pdev-fwnode-ref-v1-19-88c324a1b8d2@oss.qualcomm.com>

[-- Attachment #1: Type: text/plain, Size: 1050 bytes --]

On Thu, 21 May 2026, Bartosz Golaszewski wrote:

> Ahead of reworking the reference counting logic for platform devices,
> encapsulate the assignment of the firmware node for dynamically allocated
> platform devices with the provided helper.
> 
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
> ---
>  drivers/platform/surface/surface_gpe.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/surface/surface_gpe.c b/drivers/platform/surface/surface_gpe.c
> index b359413903b13c4f8e8b284ef7ae6f6db3f47d72..40896a8544b0a4da4261ea881b1eaed62d93b32b 100644
> --- a/drivers/platform/surface/surface_gpe.c
> +++ b/drivers/platform/surface/surface_gpe.c
> @@ -317,7 +317,7 @@ static int __init surface_gpe_init(void)
>  		goto err_alloc;
>  	}
>  
> -	pdev->dev.fwnode = fwnode;
> +	platform_device_set_fwnode(pdev, fwnode);
>  
>  	status = platform_device_add(pdev);
>  	if (status)
> 
> 

Acked-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

-- 
 i.

^ permalink raw reply

* Re: [BUG] sched/cache: "Make LLC id continuous" causes NULL cpumask dereference in build_sched_domains on POWER9
From: Shrikanth Hegde @ 2026-05-28 11:27 UTC (permalink / raw)
  To: Venkat Rao Bagalkote, K Prateek Nayak, Chen, Yu C,
	Srikar Dronamraju, Ritesh Harjani
  Cc: Madhavan Srinivasan, Christophe Leroy (CS GROUP), LKML,
	linuxppc-dev, Peter Zijlstra, tim.c.chen
In-Reply-To: <51154de7-3700-4cb4-82f2-1b3a8fa427f7@linux.ibm.com>



On 5/25/26 7:37 PM, Venkat Rao Bagalkote wrote:
> Greetings!!!
> 
> I am seeing an early boot kernel panic due to NULL pointer dereference 
> on a POWER9 (pSeries) system when testing linux-next (next-20260522).
> 

Hi Venkat, Ritesh,
Could you please try the below diff and see if it helps.
This helps to fix boot problem for SPLPAR for me.

Hi Chenyu,
Let me know if I have to send the patch. Or
if you want to add more comments or change it feel free to pick it up and send it.
Either way is fine. Let me know.

Hi Prateek, Srikar,
I hope the below diff makes sense. Please check.

nit: llc_mask is still under CONFIG_SCHED_MC, for ppc it is set to true
always for SMP systems, and for others it is LLC domain. So not a concern i guess.
---

 From 10e9413cef063446d67dc02c2b44e1ea582e5d53 Mon Sep 17 00:00:00 2001
From: Shrikanth Hegde <sshegde@linux.ibm.com>
Date: Thu, 28 May 2026 06:16:44 -0400
Subject: [PATCH] topology: Provide arch_llc_mask for cache aware scheduling

Venkat Reported a boot kernel panic next-20260522. Git bisect pointed to
b5ea300a17e3 ("sched/cache: Make LLC id continuous")

Stacktrace points to llc_mask being null.

NIP [c000000000e58504] _find_first_bit+0x44/0x130
LR [c000000000e58500] _find_first_bit+0x40/0x130
Call Trace:
build_sched_domains+0xad8/0xe50
sched_init_smp+0xa8/0x164
kernel_init_freeable+0x250/0x370
ret_from_kernel_user_thread+0x14/0x1c

On powerpc, cpu_coregroup_mask is available only when the underlying
hardware support coregroup. In shared LPAR, QEMU guest or power9 etc
coregroup isn;t supported. In such cases llc_mask was being referrenced
when it was null leading to panic.

on powerpc, LLC is at SMT core level. So assumption that coregroup(MC)
domain point to LLC is wrong. Provide a way for archs to say where its
LLC is if it not at MC domain.

Fixes: b5ea300a17e3 ("sched/cache: Make LLC id continuous")
Reported-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Closes: https://lore.kernel.org/all/51154de7-3700-4cb4-82f2-1b3a8fa427f7@linux.ibm.com/
Suggested-by: Chen, Yu C <yu.c.chen@intel.com>
Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com>
---
  arch/powerpc/include/asm/topology.h |  3 +++
  arch/powerpc/kernel/smp.c           | 10 ++++++++++
  kernel/sched/topology.c             |  9 +++++++++
  3 files changed, 22 insertions(+)

diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h
index 66ed5fe1b718..bd1db3b1dbb0 100644
--- a/arch/powerpc/include/asm/topology.h
+++ b/arch/powerpc/include/asm/topology.h
@@ -131,6 +131,9 @@ static inline int cpu_to_coregroup_id(int cpu)
  #ifdef CONFIG_SMP
  #include <asm/cputable.h>
  
+const struct cpumask *arch_llc_mask(int cpu);
+#define arch_llc_mask	arch_llc_mask
+
  struct cpumask *cpu_coregroup_mask(int cpu);
  const struct cpumask *cpu_die_mask(int cpu);
  int cpu_die_id(int cpu);
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 3467f86fd78f..cc8e87d6cae9 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -1101,6 +1101,16 @@ const struct cpumask *cpu_die_mask(int cpu)
  }
  EXPORT_SYMBOL_GPL(cpu_die_mask);
  
+const struct cpumask *arch_llc_mask(int cpu)
+{
+	/* Power9, CACHE domain is the LLC*/
+	if (shared_caches)
+		return cpu_l2_cache_mask(cpu);
+
+	/* For others, SMT domain is the LLC*/
+	return cpu_smt_mask(cpu);
+}
+
  int cpu_die_id(int cpu)
  {
  	if (has_coregroup_support())
diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
index df2ceb54c970..01af3d8f9eb9 100644
--- a/kernel/sched/topology.c
+++ b/kernel/sched/topology.c
@@ -2063,7 +2063,16 @@ const struct cpumask *tl_mc_mask(struct sched_domain_topology_level *tl, int cpu
  	return cpu_coregroup_mask(cpu);
  }
  
+/*
+ * Majority of architectures have LLC at MC domain level with exception
+ * such as powerpc. Provide a way for arch to specify where its LLC is
+ * if it falls in exception category
+ */
+# ifndef arch_llc_mask
  #define llc_mask(cpu) cpu_coregroup_mask(cpu)
+# else
+#define llc_mask(cpu) arch_llc_mask(cpu)
+# endif
  
  #else
  #define llc_mask(cpu) cpumask_of(cpu)
-- 
2.47.3



^ permalink raw reply related

* Re: [BUG] sched/cache: "Make LLC id continuous" causes NULL cpumask dereference in build_sched_domains on POWER9
From: Chen, Yu C @ 2026-05-28 13:21 UTC (permalink / raw)
  To: Shrikanth Hegde
  Cc: Madhavan Srinivasan, Christophe Leroy (CS GROUP), LKML,
	linuxppc-dev, tim.c.chen, Srikar Dronamraju, Peter Zijlstra,
	K Prateek Nayak, Venkat Rao Bagalkote, Ritesh Harjani
In-Reply-To: <74a61427-b5d8-41ad-bc5b-508ee246d510@linux.ibm.com>

Hi Shrikanth,

On 5/28/2026 7:27 PM, Shrikanth Hegde wrote:
> 
> 
>  From 10e9413cef063446d67dc02c2b44e1ea582e5d53 Mon Sep 17 00:00:00 2001
> From: Shrikanth Hegde <sshegde@linux.ibm.com>
> Date: Thu, 28 May 2026 06:16:44 -0400
> Subject: [PATCH] topology: Provide arch_llc_mask for cache aware scheduling
> 
> Venkat Reported a boot kernel panic next-20260522. Git bisect pointed to
> b5ea300a17e3 ("sched/cache: Make LLC id continuous")
> 
> Stacktrace points to llc_mask being null.
> 
> NIP [c000000000e58504] _find_first_bit+0x44/0x130
> LR [c000000000e58500] _find_first_bit+0x40/0x130
> Call Trace:
> build_sched_domains+0xad8/0xe50
> sched_init_smp+0xa8/0x164
> kernel_init_freeable+0x250/0x370
> ret_from_kernel_user_thread+0x14/0x1c
> 
> On powerpc, cpu_coregroup_mask is available only when the underlying
> hardware support coregroup. In shared LPAR, QEMU guest or power9 etc
> coregroup isn;t supported. In such cases llc_mask was being referrenced
> when it was null leading to panic.
> 
> on powerpc, LLC is at SMT core level. So assumption that coregroup(MC)
> domain point to LLC is wrong. Provide a way for archs to say where its
> LLC is if it not at MC domain.
> 
> Fixes: b5ea300a17e3 ("sched/cache: Make LLC id continuous")
> Reported-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
> Closes: https://lore.kernel.org/ 
> all/51154de7-3700-4cb4-82f2-1b3a8fa427f7@linux.ibm.com/
> Suggested-by: Chen, Yu C <yu.c.chen@intel.com>
> Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com>

It looks good to me. Let's see if this resolves the issue for Venkat
and Ritesh. Feel free to send the formal version :)

Reviewed-by: Chen Yu <yu.c.chen@intel.com>


thanks,
Chenyu


^ permalink raw reply

* Re: [BUG] sched/cache: "Make LLC id continuous" causes NULL cpumask
From: Srikar Dronamraju @ 2026-05-28 15:54 UTC (permalink / raw)
  To: Chen, Yu C
  Cc: Shrikanth Hegde, venkat88, maddy, riteshh, chleroy, tim.c.chen,
	peterz, linux-kernel, linuxppc-dev, linux-sched, kprateek.nayak
In-Reply-To: <db443a1e-e6fc-491c-a38a-1cafc8e674cd@intel.com>

* Chen, Yu C <yu.c.chen@intel.com> [2026-05-28 17:12:41]:

> On 5/28/2026 12:58 PM, Shrikanth Hegde wrote:
> > 
> > 
> > On 5/27/26 11:37 PM, Shrikanth Hegde wrote:
> 
> [ ... ]
> 
> > > diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/
> > > include/ asm/topology.h
> > > index 66ed5fe1b718..bd1db3b1dbb0 100644
> > > --- a/arch/powerpc/include/asm/topology.h
> > > +++ b/arch/powerpc/include/asm/topology.h
> > > @@ -131,6 +131,9 @@ static inline int cpu_to_coregroup_id(int cpu)
> > >   #ifdef CONFIG_SMP
> > >   #include <asm/cputable.h>
> > > 
> > > +const struct cpumask *arch_llc_mask(int cpu);
> > > +#define arch_llc_mask  arch_llc_mask
> > > +
> > >   struct cpumask *cpu_coregroup_mask(int cpu);
> > >   const struct cpumask *cpu_die_mask(int cpu);
> > >   int cpu_die_id(int cpu);
> > > diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
> > > index 3467f86fd78f..26c15c786c55 100644
> > > --- a/arch/powerpc/kernel/smp.c
> > > +++ b/arch/powerpc/kernel/smp.c
> > > @@ -1101,6 +1101,13 @@ const struct cpumask *cpu_die_mask(int cpu)
> > >   }
> > >   EXPORT_SYMBOL_GPL(cpu_die_mask);
> > > 
> > > +const struct cpumask *arch_llc_mask(int cpu)
> > > +{
> > > +       if (has_coregroup_support())
> > > +               return cpu_coregroup_mask(cpu);
> > > +       return cpu_smallcore_mask(cpu);
> > 
> > 
> > This function body needs change, since LLC is not at MC.
> > and I didn't account for power9.
> > 
> > Rest of the structure is what i would prefer the direction to go.
> > This will help future architectures too to account for their specific
> > needs.
> > 
> > What do you think?
> > 
> 
> Yes this direction look good to me. Regarding the arch_llc_mask(),
> how about the following per Srikar's description
> 
> const struct cpumask *arch_llc_mask(int cpu)
> {
> 	/* Power9, CACHE domain is the LLC*/	if (shared_caches)
> 		return cpu_l2_cache_mask(cpu);
> 
> 	/* P7, P8, P10, P11, SMT domain is the LLC*/	return cpu_smt_mask(cpu);

       On P7, P8, P10, P11, cpu_l2_cache_mask should be same as cpu_smt_mask
       so I dont see a point of checking if(shared caches)

	We can as well return 
#define arch_llc_mask cpu_l2_cache_mask


-- 
Thanks and Regards
Srikar Dronamraju


^ permalink raw reply

* Re: [BUG] sched/cache: "Make LLC id continuous" causes NULL cpumask dereference in build_sched_domains on POWER9
From: Ritesh Harjani @ 2026-05-28 15:06 UTC (permalink / raw)
  To: Shrikanth Hegde, Venkat Rao Bagalkote, K Prateek Nayak,
	Chen, Yu C, Srikar Dronamraju, Ritesh Harjani
  Cc: Madhavan Srinivasan, Christophe Leroy (CS GROUP), LKML,
	linuxppc-dev, Peter Zijlstra, tim.c.chen
In-Reply-To: <74a61427-b5d8-41ad-bc5b-508ee246d510@linux.ibm.com>

Shrikanth Hegde <sshegde@linux.ibm.com> writes:

> On 5/25/26 7:37 PM, Venkat Rao Bagalkote wrote:
>> Greetings!!!
>> 
>> I am seeing an early boot kernel panic due to NULL pointer dereference 
>> on a POWER9 (pSeries) system when testing linux-next (next-20260522).
>> 
>
> Hi Venkat, Ritesh,
> Could you please try the below diff and see if it helps.
> This helps to fix boot problem for SPLPAR for me.
>
> Hi Chenyu,
> Let me know if I have to send the patch. Or
> if you want to add more comments or change it feel free to pick it up and send it.
> Either way is fine. Let me know.
>
> Hi Prateek, Srikar,
> I hope the below diff makes sense. Please check.
>
> nit: llc_mask is still under CONFIG_SCHED_MC, for ppc it is set to true
> always for SMP systems, and for others it is LLC domain. So not a concern i guess.
> ---
>
>  From 10e9413cef063446d67dc02c2b44e1ea582e5d53 Mon Sep 17 00:00:00 2001
> From: Shrikanth Hegde <sshegde@linux.ibm.com>
> Date: Thu, 28 May 2026 06:16:44 -0400
> Subject: [PATCH] topology: Provide arch_llc_mask for cache aware scheduling
>
> Venkat Reported a boot kernel panic next-20260522. Git bisect pointed to
> b5ea300a17e3 ("sched/cache: Make LLC id continuous")
>
> Stacktrace points to llc_mask being null.
>
> NIP [c000000000e58504] _find_first_bit+0x44/0x130
> LR [c000000000e58500] _find_first_bit+0x40/0x130
> Call Trace:
> build_sched_domains+0xad8/0xe50
> sched_init_smp+0xa8/0x164
> kernel_init_freeable+0x250/0x370
> ret_from_kernel_user_thread+0x14/0x1c
>
> On powerpc, cpu_coregroup_mask is available only when the underlying
> hardware support coregroup. In shared LPAR, QEMU guest or power9 etc
> coregroup isn;t supported. In such cases llc_mask was being referrenced
> when it was null leading to panic.
>
> on powerpc, LLC is at SMT core level. So assumption that coregroup(MC)
> domain point to LLC is wrong. Provide a way for archs to say where its
> LLC is if it not at MC domain.
>
> Fixes: b5ea300a17e3 ("sched/cache: Make LLC id continuous")
> Reported-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
> Closes: https://lore.kernel.org/all/51154de7-3700-4cb4-82f2-1b3a8fa427f7@linux.ibm.com/
> Suggested-by: Chen, Yu C <yu.c.chen@intel.com>
> Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com>
> ---
>   arch/powerpc/include/asm/topology.h |  3 +++
>   arch/powerpc/kernel/smp.c           | 10 ++++++++++
>   kernel/sched/topology.c             |  9 +++++++++
>   3 files changed, 22 insertions(+)
>

I had to apply this change manually - as it wasn't cleanly applicable
for me on linux-next. But since the changes were straight forward so it
wasn't a problem.

With this change I don't see the panic anymore, which I was observing
earlier.

Thanks for the quick fix. Feel free to add:
Tested-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>



^ permalink raw reply

* Re: [BUG] sched/cache: "Make LLC id continuous" causes NULL cpumask dereference in build_sched_domains on POWER9
From: Srikar Dronamraju @ 2026-05-28 15:56 UTC (permalink / raw)
  To: Shrikanth Hegde
  Cc: Venkat Rao Bagalkote, K Prateek Nayak, Chen, Yu C, Ritesh Harjani,
	Madhavan Srinivasan, Christophe Leroy (CS GROUP), LKML,
	linuxppc-dev, Peter Zijlstra, tim.c.chen
In-Reply-To: <74a61427-b5d8-41ad-bc5b-508ee246d510@linux.ibm.com>

* Shrikanth Hegde <sshegde@linux.ibm.com> [2026-05-28 16:57:54]:

> 
> 
> On 5/25/26 7:37 PM, Venkat Rao Bagalkote wrote:
> > Greetings!!!
> > 
> > I am seeing an early boot kernel panic due to NULL pointer dereference
> > on a POWER9 (pSeries) system when testing linux-next (next-20260522).
> > 
> 
> Hi Venkat, Ritesh,
> Could you please try the below diff and see if it helps.
> This helps to fix boot problem for SPLPAR for me.
> 
> Hi Chenyu,
> Let me know if I have to send the patch. Or
> if you want to add more comments or change it feel free to pick it up and send it.
> Either way is fine. Let me know.
> 
> Hi Prateek, Srikar,
> I hope the below diff makes sense. Please check.
> 
> nit: llc_mask is still under CONFIG_SCHED_MC, for ppc it is set to true
> always for SMP systems, and for others it is LLC domain. So not a concern i guess.
> ---
> 
> From 10e9413cef063446d67dc02c2b44e1ea582e5d53 Mon Sep 17 00:00:00 2001
> From: Shrikanth Hegde <sshegde@linux.ibm.com>
> Date: Thu, 28 May 2026 06:16:44 -0400
> Subject: [PATCH] topology: Provide arch_llc_mask for cache aware scheduling
> 
> Venkat Reported a boot kernel panic next-20260522. Git bisect pointed to
> b5ea300a17e3 ("sched/cache: Make LLC id continuous")
> 
> Stacktrace points to llc_mask being null.
> 
> NIP [c000000000e58504] _find_first_bit+0x44/0x130
> LR [c000000000e58500] _find_first_bit+0x40/0x130
> Call Trace:
> build_sched_domains+0xad8/0xe50
> sched_init_smp+0xa8/0x164
> kernel_init_freeable+0x250/0x370
> ret_from_kernel_user_thread+0x14/0x1c
> 
> On powerpc, cpu_coregroup_mask is available only when the underlying
> hardware support coregroup. In shared LPAR, QEMU guest or power9 etc
> coregroup isn;t supported. In such cases llc_mask was being referrenced
> when it was null leading to panic.
> 
> on powerpc, LLC is at SMT core level. So assumption that coregroup(MC)
> domain point to LLC is wrong. Provide a way for archs to say where its
> LLC is if it not at MC domain.
> 
> Fixes: b5ea300a17e3 ("sched/cache: Make LLC id continuous")
> Reported-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
> Closes: https://lore.kernel.org/all/51154de7-3700-4cb4-82f2-1b3a8fa427f7@linux.ibm.com/
> Suggested-by: Chen, Yu C <yu.c.chen@intel.com>
> Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com>
> ---
>  arch/powerpc/include/asm/topology.h |  3 +++
>  arch/powerpc/kernel/smp.c           | 10 ++++++++++
>  kernel/sched/topology.c             |  9 +++++++++
>  3 files changed, 22 insertions(+)
> 
> diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h
> index 66ed5fe1b718..bd1db3b1dbb0 100644
> --- a/arch/powerpc/include/asm/topology.h
> +++ b/arch/powerpc/include/asm/topology.h
> @@ -131,6 +131,9 @@ static inline int cpu_to_coregroup_id(int cpu)
>  #ifdef CONFIG_SMP
>  #include <asm/cputable.h>
> +const struct cpumask *arch_llc_mask(int cpu);
> +#define arch_llc_mask	arch_llc_mask
> +
>  struct cpumask *cpu_coregroup_mask(int cpu);
>  const struct cpumask *cpu_die_mask(int cpu);
>  int cpu_die_id(int cpu);
> diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
> index 3467f86fd78f..cc8e87d6cae9 100644
> --- a/arch/powerpc/kernel/smp.c
> +++ b/arch/powerpc/kernel/smp.c
> @@ -1101,6 +1101,16 @@ const struct cpumask *cpu_die_mask(int cpu)
>  }
>  EXPORT_SYMBOL_GPL(cpu_die_mask);
> +const struct cpumask *arch_llc_mask(int cpu)
> +{
> +	/* Power9, CACHE domain is the LLC*/
> +	if (shared_caches)
> +		return cpu_l2_cache_mask(cpu);
> +
> +	/* For others, SMT domain is the LLC*/
> +	return cpu_smt_mask(cpu);
> +}

Why dont we do 
#define arch_llc_mask cpu_l2_cache_mask


-- 
Thanks and Regards
Srikar Dronamraju


^ permalink raw reply

* Re: [BUG] sched/cache: "Make LLC id continuous" causes NULL cpumask
From: Srikar Dronamraju @ 2026-05-28 15:58 UTC (permalink / raw)
  To: Shrikanth Hegde
  Cc: Chen, Yu C, kprateek.nayak, venkat88, maddy, riteshh, chleroy,
	tim.c.chen, peterz, linux-kernel, linuxppc-dev, linux-sched
In-Reply-To: <42a19577-fe56-44b4-b0ed-37cde6d03ff5@linux.ibm.com>

* Shrikanth Hegde <sshegde@linux.ibm.com> [2026-05-27 23:37:30]:

> Hi Chen, Prateek.
> 
>  EXPORT_SYMBOL_GPL(cpu_die_mask);
> 
> +const struct cpumask *arch_llc_mask(int cpu)
> +{
> +       if (has_coregroup_support())
> +               return cpu_coregroup_mask(cpu);
> +       return cpu_smallcore_mask(cpu);
> +}
> +

This is not correct. why should we again send coregroup for llc.


>  int cpu_die_id(int cpu)
>  {
>         if (has_coregroup_support())
> diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
> index df2ceb54c970..3b5155121276 100644
> --- a/kernel/sched/topology.c
> +++ b/kernel/sched/topology.c
> @@ -2063,7 +2063,11 @@ const struct cpumask *tl_mc_mask(struct
> sched_domain_topology_level *tl, int cpu
>         return cpu_coregroup_mask(cpu);
>  }
> 

-- 
Thanks and Regards
Srikar Dronamraju


^ permalink raw reply

* Re: [BUG] sched/cache: "Make LLC id continuous" causes NULL cpumask dereference in build_sched_domains on POWER9
From: Srikar Dronamraju @ 2026-05-28 16:01 UTC (permalink / raw)
  To: Shrikanth Hegde
  Cc: Venkat Rao Bagalkote, Madhavan Srinivasan, Ritesh Harjani,
	Christophe Leroy (CS GROUP), LKML, linuxppc-dev, linux-sched,
	tim.c.chen, K Prateek Nayak, Peter Zijlstra, Chen, Yu C
In-Reply-To: <eaefc945-f2e5-458c-9d63-ead737c982bf@linux.ibm.com>

* Shrikanth Hegde <sshegde@linux.ibm.com> [2026-05-27 12:35:20]:

> On 5/26/26 10:54 AM, Venkat Rao Bagalkote wrote:
> > 
> > On 26/05/26 9:38 am, Chen, Yu C wrote:
> > > Hi Venkat,
> > > 
> > > On 5/26/2026 11:14 AM, Srikar Dronamraju wrote:
> > > > * Chen, Yu C <yu.c.chen@intel.com> [2026-05-25 23:35:45]:
> > > > 
> > > > > Hi Venkat,
> > > > > 
> > > > > On 5/25/2026 10:07 PM, Venkat Rao Bagalkote wrote:
> > > > > > Greetings!!!
> > > > > > 
> > > > > > I am seeing an early boot kernel panic due to NULL pointer dereference
> > > > > > on a POWER9 (pSeries) system when testing linux-next (next-20260522).
> > 
> > 
> > This issue is seen on P11 as well.
> > 
> > 
> > Regards,
> > 
> > Venkat.
> > 
> 
> Venkat,
> 
> Was it on P11 on Shared LPAR?

I also thought the same.
But I checked with Venkat, he said it was on a dedicated LPAR.
My multiple tries on dedicated, didnt reproduce the problem.

-- 
Thanks and Regards
Srikar Dronamraju


^ permalink raw reply

* Re: [BUG] sched/cache: "Make LLC id continuous" causes NULL cpumask dereference in build_sched_domains on POWER9
From: Srikar Dronamraju @ 2026-05-28 16:06 UTC (permalink / raw)
  To: Ritesh Harjani
  Cc: Venkat Rao Bagalkote, Peter Zijlstra, K Prateek Nayak, Chen, Yu C,
	tim.c.chen, Madhavan Srinivasan, Shrikanth Hegde, Ritesh Harjani,
	Christophe Leroy (CS GROUP), LKML, linuxppc-dev, linux-sched
In-Reply-To: <o6i06n2o.ritesh.list@gmail.com>

* Ritesh Harjani <ritesh.list@gmail.com> [2026-05-28 12:24:39]:

> Venkat Rao Bagalkote <venkat88@linux.ibm.com> writes:
> 
> > Greetings!!!
> >
> > I am seeing an early boot kernel panic due to NULL pointer dereference 
> > on a POWER9 (pSeries) system when testing linux-next (next-20260522).
> >
> >
> > [    0.039029] NIP [c000000000e58504] _find_first_bit+0x44/0x130
> > [    0.039043] LR [c000000000e58500] _find_first_bit+0x40/0x130
> > [    0.039054] Call Trace:
> > [    0.039060] [c0000000090e7b80] [c00000000416af20] 
> > schedutil_gov+0x0/0xa0 (unreliable)
> > [    0.039076] [c0000000090e7bc0] [c00000000038b3b8] 
> > build_sched_domains+0xad8/0xe50
> > [    0.039089] [c0000000090e7ce0] [c000000003045d78] 
> > sched_init_smp+0xa8/0x164
> > [    0.039102] [c0000000090e7d30] [c00000000300f374] 
> > kernel_init_freeable+0x250/0x370
> > [    0.039117] [c0000000090e7de0] [c000000000011f90] kernel_init+0x34/0x1e4
> > [    0.039129] [c0000000090e7e50] [c00000000000debc] 
> > ret_from_kernel_user_thread+0x14/0x1c
> > [    0.039142] ---- interrupt: 0 at 0x0
> > [    0.039150] Code: 41820090 7c0802a6 393cffff fbe10038 7c7f1b78 
> > fba10028 fbc10030 3bc00000 793dd7e2 f8010050 4bae6e9d 60000000 
> > <e93f0000> 2c290000 408200bc 283c0040
> > [    0.039196] ---[ end trace 0000000000000000 ]---
> >
> >
> 
> Well, I am hitting this on 7.1.0-rc5-next-20260526-00010-gbfac43765a97
> with Qemu Pseries TCG power10/11.
> 

Qemu Pseries guest would be a shared lpar. So thats expected to be similar
to P9. We would not have a coregroup_map allocated.

> [    0.342868][    T1] smp: Bringing up secondary CPUs ...
> [    0.342868][    T1] smp: Bringing up secondary CPUs ...
> [    0.525419][    T1] smp: Brought up 1 node, 4 CPUs
> [    0.525419][    T1] smp: Brought up 1 node, 4 CPUs
> [    0.527992][    T1] numa: Node 0 CPUs: 0-3
> [    0.527992][    T1] numa: Node 0 CPUs: 0-3
> [    0.552787][    T1] BUG: Kernel NULL pointer dereference on read at 0x00000000
> [    0.552787][    T1] BUG: Kernel NULL pointer dereference on read at 0x00000000
> [    0.557446][    T1] Faulting instruction address: 0xc000000000fe3f1c
> [    0.557446][    T1] Faulting instruction address: 0xc000000000fe3f1c
> cpu 0x0: Vector: 300 (Data Access) at [c000000006607800]
>     pc: c000000000fe3f1c: _find_first_bit+0xc/0xc0
>     lr: c00000000027b7d8: build_sched_domains+0xbb4/0x1938
>     sp: c000000006607ac0
>    msr: 8000000002009033
>    dar: 0
>  dsisr: 80000
>   current = 0xc000000006f9fb00
>   paca    = 0xc000000005670000   irqmask: 0x03   irq_happened: 0x09
>     pid   = 1, comm = swapper/0
> Linux version 7.1.0-rc5-next-20260526-00010-gbfac43765a97-dirty (powerpc64le-linux-gnu-gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #19 SMP PREEMPT Thu May 28 12:29:51 IST 2026
> enter ? for help
> [link register   ] c00000000027b7d8 build_sched_domains+0xbb4/0x1938
> [c000000006607ac0] c00000000027b0a8 build_sched_domains+0x484/0x1938 (unreliable)
> [c000000006607c20] c000000004053180 sched_init_domains+0x114/0x1cc
> [c000000006607c70] c0000000040515e0 sched_init_smp+0x5c/0x17c
> [c000000006607cc0] c000000004012888 kernel_init_freeable+0x258/0x790
> [c000000006607dc0] c000000000011f3c kernel_init+0x34/0x268
> [c000000006607e30] c00000000000debc ret_from_kernel_user_thread+0x14/0x1c
> ---- Exception: 0  at 0000000000000000
> 
> 
> 
> -ritesh

-- 
Thanks and Regards
Srikar Dronamraju


^ permalink raw reply

* Re: [BUG] sched/cache: "Make LLC id continuous" causes NULL cpumask dereference in build_sched_domains on POWER9
From: Shrikanth Hegde @ 2026-05-28 16:31 UTC (permalink / raw)
  To: Srikar Dronamraju
  Cc: Venkat Rao Bagalkote, K Prateek Nayak, Chen, Yu C, Ritesh Harjani,
	Madhavan Srinivasan, Christophe Leroy (CS GROUP), LKML,
	linuxppc-dev, Peter Zijlstra, tim.c.chen
In-Reply-To: <ahhlrQ1XO47FusNi@linux.ibm.com>



On 5/28/26 9:26 PM, Srikar Dronamraju wrote:
> * Shrikanth Hegde <sshegde@linux.ibm.com> [2026-05-28 16:57:54]:
> 
>>
>>
>> On 5/25/26 7:37 PM, Venkat Rao Bagalkote wrote:
>>> Greetings!!!
>>>
>>> I am seeing an early boot kernel panic due to NULL pointer dereference
>>> on a POWER9 (pSeries) system when testing linux-next (next-20260522).
>>>
>>
>> Hi Venkat, Ritesh,
>> Could you please try the below diff and see if it helps.
>> This helps to fix boot problem for SPLPAR for me.
>>
>> Hi Chenyu,
>> Let me know if I have to send the patch. Or
>> if you want to add more comments or change it feel free to pick it up and send it.
>> Either way is fine. Let me know.
>>
>> Hi Prateek, Srikar,
>> I hope the below diff makes sense. Please check.
>>
>> nit: llc_mask is still under CONFIG_SCHED_MC, for ppc it is set to true
>> always for SMP systems, and for others it is LLC domain. So not a concern i guess.
>> ---
>>
>>  From 10e9413cef063446d67dc02c2b44e1ea582e5d53 Mon Sep 17 00:00:00 2001
>> From: Shrikanth Hegde <sshegde@linux.ibm.com>
>> Date: Thu, 28 May 2026 06:16:44 -0400
>> Subject: [PATCH] topology: Provide arch_llc_mask for cache aware scheduling
>>
>> Venkat Reported a boot kernel panic next-20260522. Git bisect pointed to
>> b5ea300a17e3 ("sched/cache: Make LLC id continuous")
>>
>> Stacktrace points to llc_mask being null.
>>
>> NIP [c000000000e58504] _find_first_bit+0x44/0x130
>> LR [c000000000e58500] _find_first_bit+0x40/0x130
>> Call Trace:
>> build_sched_domains+0xad8/0xe50
>> sched_init_smp+0xa8/0x164
>> kernel_init_freeable+0x250/0x370
>> ret_from_kernel_user_thread+0x14/0x1c
>>
>> On powerpc, cpu_coregroup_mask is available only when the underlying
>> hardware support coregroup. In shared LPAR, QEMU guest or power9 etc
>> coregroup isn;t supported. In such cases llc_mask was being referrenced
>> when it was null leading to panic.
>>
>> on powerpc, LLC is at SMT core level. So assumption that coregroup(MC)
>> domain point to LLC is wrong. Provide a way for archs to say where its
>> LLC is if it not at MC domain.
>>
>> Fixes: b5ea300a17e3 ("sched/cache: Make LLC id continuous")
>> Reported-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
>> Closes: https://lore.kernel.org/all/51154de7-3700-4cb4-82f2-1b3a8fa427f7@linux.ibm.com/
>> Suggested-by: Chen, Yu C <yu.c.chen@intel.com>
>> Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com>
>> ---
>>   arch/powerpc/include/asm/topology.h |  3 +++
>>   arch/powerpc/kernel/smp.c           | 10 ++++++++++
>>   kernel/sched/topology.c             |  9 +++++++++
>>   3 files changed, 22 insertions(+)
>>
>> diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h
>> index 66ed5fe1b718..bd1db3b1dbb0 100644
>> --- a/arch/powerpc/include/asm/topology.h
>> +++ b/arch/powerpc/include/asm/topology.h
>> @@ -131,6 +131,9 @@ static inline int cpu_to_coregroup_id(int cpu)
>>   #ifdef CONFIG_SMP
>>   #include <asm/cputable.h>
>> +const struct cpumask *arch_llc_mask(int cpu);
>> +#define arch_llc_mask	arch_llc_mask
>> +
>>   struct cpumask *cpu_coregroup_mask(int cpu);
>>   const struct cpumask *cpu_die_mask(int cpu);
>>   int cpu_die_id(int cpu);
>> diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
>> index 3467f86fd78f..cc8e87d6cae9 100644
>> --- a/arch/powerpc/kernel/smp.c
>> +++ b/arch/powerpc/kernel/smp.c
>> @@ -1101,6 +1101,16 @@ const struct cpumask *cpu_die_mask(int cpu)
>>   }
>>   EXPORT_SYMBOL_GPL(cpu_die_mask);
>> +const struct cpumask *arch_llc_mask(int cpu)
>> +{
>> +	/* Power9, CACHE domain is the LLC*/
>> +	if (shared_caches)
>> +		return cpu_l2_cache_mask(cpu);
>> +
>> +	/* For others, SMT domain is the LLC*/
>> +	return cpu_smt_mask(cpu);
>> +}
> 
> Why dont we do
> #define arch_llc_mask cpu_l2_cache_mask
> 

I would prefer to keep the abstraction. This leaves
room for implementation details.



^ permalink raw reply

* Re: [BUG] sched/cache: "Make LLC id continuous" causes NULL cpumask dereference in build_sched_domains on POWER9
From: Srikar Dronamraju @ 2026-05-28 16:44 UTC (permalink / raw)
  To: Shrikanth Hegde
  Cc: Venkat Rao Bagalkote, K Prateek Nayak, Chen, Yu C, Ritesh Harjani,
	Madhavan Srinivasan, Christophe Leroy (CS GROUP), LKML,
	linuxppc-dev, Peter Zijlstra, tim.c.chen
In-Reply-To: <3498bef8-8835-4971-a753-029d73acffc7@linux.ibm.com>

* Shrikanth Hegde <sshegde@linux.ibm.com> [2026-05-28 22:01:53]:

> > > index 3467f86fd78f..cc8e87d6cae9 100644
> > > --- a/arch/powerpc/kernel/smp.c
> > > +++ b/arch/powerpc/kernel/smp.c
> > > @@ -1101,6 +1101,16 @@ const struct cpumask *cpu_die_mask(int cpu)
> > >   }
> > >   EXPORT_SYMBOL_GPL(cpu_die_mask);
> > > +const struct cpumask *arch_llc_mask(int cpu)
> > > +{
> > > +	/* Power9, CACHE domain is the LLC*/
> > > +	if (shared_caches)
> > > +		return cpu_l2_cache_mask(cpu);
> > > +
> > > +	/* For others, SMT domain is the LLC*/
> > > +	return cpu_smt_mask(cpu);
> > > +}
> > 
> > Why dont we do
> > #define arch_llc_mask cpu_l2_cache_mask
> > 
> 
> I would prefer to keep the abstraction. This leaves
> room for implementation details.
> 

We could always do that whenever we need it.
But doing it now will confuse the reader. Why keep if and else when both are
returning the same.

-- 
Thanks and Regards
Srikar Dronamraju


^ permalink raw reply

* RE: [PATCH v5 05/20] dma-pool: track decrypted atomic pools and select them via attrs
From: Michael Kelley @ 2026-05-28 18:29 UTC (permalink / raw)
  To: Aneesh Kumar K.V (Arm), iommu@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-coco@lists.linux.dev
  Cc: Robin Murphy, Marek Szyprowski, Will Deacon, Marc Zyngier,
	Steven Price, Suzuki K Poulose, Catalin Marinas, Jiri Pirko,
	Jason Gunthorpe, Mostafa Saleh, Petr Tesarik,
	Alexey Kardashevskiy, Dan Williams, Xu Yilun,
	linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org,
	Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy (CS GROUP), Alexander Gordeev, Gerald Schaefer,
	Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
	Sven Schnelle, x86@kernel.org, Jiri Pirko
In-Reply-To: <20260522042815.370873-6-aneesh.kumar@kernel.org>

From: Aneesh Kumar K.V (Arm) <aneesh.kumar@kernel.org>Sent: Thursday, May 21, 2026 9:28 PM
> 
> Teach the atomic DMA pool code to distinguish between encrypted and
> unencrypted pools, and make pool allocation select the matching pool based
> on DMA attributes.
> 
> Introduce a dma_gen_pool wrapper that records whether a pool is
> unencrypted, initialize that state when the atomic pools are created, and
> use it when expanding and resizing the pools. Update dma_alloc_from_pool()
> to take attrs and skip pools whose encrypted state does not match
> DMA_ATTR_CC_SHARED. Update dma_free_from_pool() accordingly.
> 
> Also pass DMA_ATTR_CC_SHARED from the swiotlb atomic allocation path so
> decrypted swiotlb allocations are taken from the correct atomic pool.
> 
> Tested-by: Jiri Pirko <jiri@nvidia.com>
> Reviewed-by: Mostafa Saleh <smostafa@google.com>
> Signed-off-by: Aneesh Kumar K.V (Arm) <aneesh.kumar@kernel.org>
> ---
>  drivers/iommu/dma-iommu.c   |   2 +-
>  include/linux/dma-map-ops.h |   2 +-
>  kernel/dma/direct.c         |  11 ++-
>  kernel/dma/pool.c           | 167 +++++++++++++++++++++++-------------
>  kernel/dma/swiotlb.c        |   7 +-
>  5 files changed, 123 insertions(+), 66 deletions(-)
>

[snip]
 
> +static __init struct dma_gen_pool *__dma_atomic_pool_init(struct dma_gen_pool *dma_pool,
> +		size_t pool_size, gfp_t gfp)
>  {
> -	struct gen_pool *pool;
>  	int ret;
> 
> -	pool = gen_pool_create(PAGE_SHIFT, NUMA_NO_NODE);
> -	if (!pool)
> +	dma_pool->pool = gen_pool_create(PAGE_SHIFT, NUMA_NO_NODE);
> +	if (!dma_pool->pool)
>  		return NULL;
> 
> -	gen_pool_set_algo(pool, gen_pool_first_fit_order_align, NULL);
> +	gen_pool_set_algo(dma_pool->pool, gen_pool_first_fit_order_align, NULL);
> +
> +	/* if platform is using memory encryption atomic pools are by default decrypted. */
> +	if (cc_platform_has(CC_ATTR_MEM_ENCRYPT))
> +		dma_pool->unencrypted = true;
> +	else
> +		dma_pool->unencrypted = false;

I'm curious about the name of the "unencrypted" field in struct dma_gen_pool,
and similarly in Patch 7 of the series for the swiotlb struct io_tlb_pool and
struct io_tlb_mem. Up through v3 of this series, you used "decrypted", but
starting in v4 switched to "unencrypted".

To me, the above "if" statement has some cognitive dissonance in that if
CC_ATTR_MEM_ENCRYPT is false (i.e., a normal VM), "unencrypted" is set
to false. But I think of memory in a normal VM as "unencrypted" since it
was never encrypted. A similar "if" statement occurs in your swiotlb changes.

Two related concepts are captured by the field:
1) Is some action needed to put the memory into the unencrypted state,
and to remove it from that state? This applies when assigning memory to the
pool, or freeing the memory in the pool.
2) Is the memory currently in the unencrypted state? This applies when
allocating memory from the pool to a caller.

It's hard to capture all that in a short field name. But I think I prefer "decrypted"
over "unencrypted".  The former implies that some action was taken. It's a
little easier to think of a normal VM as *not* having decrypted memory. The
memory was never encrypted in the first place, so no decryption action was taken.

Throughout the kernel, "decrypted" occurs much more frequently than
"unencrypted".  We have set_memory_encrypted() and set_memory_decrypted()
that are "take action" names.  But we also have force_dma_unencrypted(),
phys_to_dma_unencrypted(), and dma_addr_unencrypted(). So it's a bit
of a mess.

But maybe there's more background here that led to the change
between your v3 and v4.

Michael


^ permalink raw reply

* [PATCH 00/16] lib/cpumask: get rid of cpumap_print_to_pagebuf()
From: Yury Norov @ 2026-05-28 18:36 UTC (permalink / raw)
  To: Andrew Morton, Rasmus Villemoes, Yury Norov
  Cc: Russell King, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Madhavan Srinivasan, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy (CS GROUP), Peter Zijlstra,
	Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
	James Clark, Thomas Gleixner, Borislav Petkov, Dave Hansen,
	H. Peter Anvin, Rafael J. Wysocki, Len Brown, Greg Kroah-Hartman,
	Danilo Krummrich, Chanwoo Choi, MyungJoo Ham, Kyungmin Park,
	Heiko Stuebner, Lorenzo Pieralisi, Xu Yilun, Tom Rix,
	Moritz Fischer, Yicong Yang, Jonathan Cameron, Dennis Dalessandro,
	Jason Gunthorpe, Leon Romanovsky, Dan Williams, Vishal Verma,
	Dave Jiang, Ira Weiny, Bjorn Helgaas, Shuai Xue, Will Deacon,
	Jiucheng Xu, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Robin Murphy, Jing Zhang, Xu Yang,
	Linu Cherian, Gowthami Thiagarajan, Ji Sheng Teoh, Khuong Dinh,
	Daniel Lezcano, Zhang Rui, Lukasz Luba, Yury Norov, Kees Cook,
	Thomas Weißschuh, Aboorva Devarajan, Ritesh Harjani (IBM),
	Ilkka Koskinen, Besar Wicaksono, Ma Ke, Chengwen Feng,
	linux-arm-kernel, imx, linux-kernel, linuxppc-dev,
	linux-perf-users, linux-acpi, driver-core, linux-pm,
	linux-rockchip, linux-fpga, linux-rdma, nvdimm, linux-pci,
	linux-amlogic, linux-cxl, linux-arm-msm

cpumap_print_to_pagebuf() is the equivalent for the "&*pb[l]" notation
in printk-like functions. In some cases, it makes people to create
temporary buffers for the printed cpumasks, where it can be avoided.

Get rid of it in a favor of more standard printing API.

Each patch, except for the last one, is independent and may be moved with
the corresponding subsystem. Or I can take it in bitmap-for-next, at
maintainers' discretion.

On top of bitmap-for-next.

(Apologize for the bulky CC list. Feel free to review only relevant
patches.)

Yury Norov (16):
  psci: simplify hotplug_tests()
  arm: Use sysfs_emit() for cpumask show callbacks
  powerpc: Use sysfs_emit() for cpumask show callbacks
  x86/events: Use sysfs_emit() for cpumask show callbacks
  ACPI: pad: Use sysfs_emit() for idlecpus show
  cpu: Use sysfs_emit() for cpumask show callback
  devfreq: Use sysfs_emit() for cpumask show callbacks
  fpga: dfl-fme-perf: Use sysfs_emit() for cpumask show
  hwtracing: hisi_ptt: Use sysfs_emit() for cpumask show
  RDMA/hfi1: Use sysfs_emit() for cpumask show helper
  nvdimm: Use sysfs_emit() for cpumask show callback
  PCI/sysfs: Use sysfs_emit() for cpumask show callbacks
  perf: Use sysfs_emit() for cpumask show callbacks
  powercap: intel_rapl: Use sysfs_emit() for cpumask show
  thermal: intel: Use sysfs_emit() for powerclamp cpumask
  lib/bitmap-str: get rid of cpumap_print_to_pagebuf()

 arch/arm/mach-imx/mmdc.c                    |  2 +-
 arch/arm/mm/cache-l2x0-pmu.c                |  2 +-
 arch/powerpc/kernel/cacheinfo.c             |  3 ++-
 arch/powerpc/perf/hv-24x7.c                 |  2 +-
 arch/powerpc/perf/hv-gpci.c                 |  2 +-
 arch/powerpc/perf/imc-pmu.c                 |  2 +-
 arch/x86/events/amd/iommu.c                 |  2 +-
 arch/x86/events/amd/power.c                 |  2 +-
 arch/x86/events/amd/uncore.c                |  2 +-
 arch/x86/events/intel/core.c                |  2 +-
 arch/x86/events/intel/uncore.c              |  2 +-
 drivers/acpi/acpi_pad.c                     |  4 ++--
 drivers/base/cpu.c                          |  2 +-
 drivers/devfreq/event/rockchip-dfi.c        |  2 +-
 drivers/devfreq/hisi_uncore_freq.c          |  2 +-
 drivers/firmware/psci/psci_checker.c        | 14 ++------------
 drivers/fpga/dfl-fme-perf.c                 |  2 +-
 drivers/hwtracing/ptt/hisi_ptt.c            |  2 +-
 drivers/infiniband/hw/hfi1/sdma.c           |  3 ++-
 drivers/nvdimm/nd_perf.c                    |  2 +-
 drivers/pci/pci-sysfs.c                     |  7 ++++---
 drivers/perf/alibaba_uncore_drw_pmu.c       |  2 +-
 drivers/perf/amlogic/meson_ddr_pmu_core.c   |  2 +-
 drivers/perf/arm-cci.c                      |  2 +-
 drivers/perf/arm-ccn.c                      |  2 +-
 drivers/perf/arm-cmn.c                      |  2 +-
 drivers/perf/arm-ni.c                       |  2 +-
 drivers/perf/arm_cspmu/arm_cspmu.c          |  2 +-
 drivers/perf/arm_dmc620_pmu.c               |  4 ++--
 drivers/perf/arm_dsu_pmu.c                  |  2 +-
 drivers/perf/arm_pmu.c                      |  2 +-
 drivers/perf/arm_smmuv3_pmu.c               |  2 +-
 drivers/perf/arm_spe_pmu.c                  |  2 +-
 drivers/perf/cxl_pmu.c                      |  2 +-
 drivers/perf/dwc_pcie_pmu.c                 |  2 +-
 drivers/perf/fsl_imx8_ddr_perf.c            |  2 +-
 drivers/perf/fsl_imx9_ddr_perf.c            |  2 +-
 drivers/perf/fujitsu_uncore_pmu.c           |  2 +-
 drivers/perf/hisilicon/hisi_pcie_pmu.c      |  2 +-
 drivers/perf/hisilicon/hisi_uncore_pmu.c    |  2 +-
 drivers/perf/marvell_cn10k_ddr_pmu.c        |  2 +-
 drivers/perf/marvell_cn10k_tad_pmu.c        |  2 +-
 drivers/perf/marvell_pem_pmu.c              |  2 +-
 drivers/perf/nvidia_t410_c2c_pmu.c          |  2 +-
 drivers/perf/nvidia_t410_cmem_latency_pmu.c |  2 +-
 drivers/perf/qcom_l2_pmu.c                  |  2 +-
 drivers/perf/qcom_l3_pmu.c                  |  2 +-
 drivers/perf/starfive_starlink_pmu.c        |  2 +-
 drivers/perf/thunderx2_pmu.c                |  2 +-
 drivers/perf/xgene_pmu.c                    |  2 +-
 drivers/powercap/intel_rapl_common.c        |  2 +-
 drivers/thermal/intel/intel_powerclamp.c    |  2 +-
 include/linux/cpumask.h                     | 19 -------------------
 kernel/events/core.c                        |  2 +-
 lib/bitmap-str.c                            |  9 ++++-----
 55 files changed, 65 insertions(+), 92 deletions(-)

-- 
2.51.0


^ permalink raw reply

* [PATCH 02/16] arm: Use sysfs_emit() for cpumask show callbacks
From: Yury Norov @ 2026-05-28 18:36 UTC (permalink / raw)
  To: Andrew Morton, Rasmus Villemoes, Yury Norov
  Cc: Russell King, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Madhavan Srinivasan, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy (CS GROUP), Peter Zijlstra,
	Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
	James Clark, Thomas Gleixner, Borislav Petkov, Dave Hansen,
	H. Peter Anvin, Rafael J. Wysocki, Len Brown, Greg Kroah-Hartman,
	Danilo Krummrich, Chanwoo Choi, MyungJoo Ham, Kyungmin Park,
	Heiko Stuebner, Lorenzo Pieralisi, Xu Yilun, Tom Rix,
	Moritz Fischer, Yicong Yang, Jonathan Cameron, Dennis Dalessandro,
	Jason Gunthorpe, Leon Romanovsky, Dan Williams, Vishal Verma,
	Dave Jiang, Ira Weiny, Bjorn Helgaas, Shuai Xue, Will Deacon,
	Jiucheng Xu, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Robin Murphy, Jing Zhang, Xu Yang,
	Linu Cherian, Gowthami Thiagarajan, Ji Sheng Teoh, Khuong Dinh,
	Daniel Lezcano, Zhang Rui, Lukasz Luba, Yury Norov, Kees Cook,
	Thomas Weißschuh, Aboorva Devarajan, Ritesh Harjani (IBM),
	Ilkka Koskinen, Besar Wicaksono, Ma Ke, Chengwen Feng,
	linux-arm-kernel, imx, linux-kernel, linuxppc-dev,
	linux-perf-users, linux-acpi, driver-core, linux-pm,
	linux-rockchip, linux-fpga, linux-rdma, nvdimm, linux-pci,
	linux-amlogic, linux-cxl, linux-arm-msm
In-Reply-To: <20260528183625.870813-1-ynorov@nvidia.com>

These callbacks are sysfs show paths.

Use sysfs_emit() and cpumask_pr_args() to emit the masks.

This prepares for removing cpumap_print_to_pagebuf().

Signed-off-by: Yury Norov <ynorov@nvidia.com>
---
 arch/arm/mach-imx/mmdc.c     | 2 +-
 arch/arm/mm/cache-l2x0-pmu.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-imx/mmdc.c b/arch/arm/mach-imx/mmdc.c
index b71467c48b87..f6d993b9b1d4 100644
--- a/arch/arm/mach-imx/mmdc.c
+++ b/arch/arm/mach-imx/mmdc.c
@@ -127,7 +127,7 @@ static ssize_t mmdc_pmu_cpumask_show(struct device *dev,
 {
 	struct mmdc_pmu *pmu_mmdc = dev_get_drvdata(dev);
 
-	return cpumap_print_to_pagebuf(true, buf, &pmu_mmdc->cpu);
+	return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(&pmu_mmdc->cpu));
 }
 
 static struct device_attribute mmdc_pmu_cpumask_attr =
diff --git a/arch/arm/mm/cache-l2x0-pmu.c b/arch/arm/mm/cache-l2x0-pmu.c
index 3d9caf7464bf..478227078837 100644
--- a/arch/arm/mm/cache-l2x0-pmu.c
+++ b/arch/arm/mm/cache-l2x0-pmu.c
@@ -390,7 +390,7 @@ static struct attribute_group l2x0_pmu_event_attrs_group = {
 static ssize_t l2x0_pmu_cpumask_show(struct device *dev,
 				     struct device_attribute *attr, char *buf)
 {
-	return cpumap_print_to_pagebuf(true, buf, &pmu_cpu);
+	return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(&pmu_cpu));
 }
 
 static struct device_attribute l2x0_pmu_cpumask_attr =
-- 
2.51.0


^ permalink raw reply related

* [PATCH 03/16] powerpc: Use sysfs_emit() for cpumask show callbacks
From: Yury Norov @ 2026-05-28 18:36 UTC (permalink / raw)
  To: Andrew Morton, Rasmus Villemoes, Yury Norov
  Cc: Russell King, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Madhavan Srinivasan, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy (CS GROUP), Peter Zijlstra,
	Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
	James Clark, Thomas Gleixner, Borislav Petkov, Dave Hansen,
	H. Peter Anvin, Rafael J. Wysocki, Len Brown, Greg Kroah-Hartman,
	Danilo Krummrich, Chanwoo Choi, MyungJoo Ham, Kyungmin Park,
	Heiko Stuebner, Lorenzo Pieralisi, Xu Yilun, Tom Rix,
	Moritz Fischer, Yicong Yang, Jonathan Cameron, Dennis Dalessandro,
	Jason Gunthorpe, Leon Romanovsky, Dan Williams, Vishal Verma,
	Dave Jiang, Ira Weiny, Bjorn Helgaas, Shuai Xue, Will Deacon,
	Jiucheng Xu, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Robin Murphy, Jing Zhang, Xu Yang,
	Linu Cherian, Gowthami Thiagarajan, Ji Sheng Teoh, Khuong Dinh,
	Daniel Lezcano, Zhang Rui, Lukasz Luba, Yury Norov, Kees Cook,
	Thomas Weißschuh, Aboorva Devarajan, Ritesh Harjani (IBM),
	Ilkka Koskinen, Besar Wicaksono, Ma Ke, Chengwen Feng,
	linux-arm-kernel, imx, linux-kernel, linuxppc-dev,
	linux-perf-users, linux-acpi, driver-core, linux-pm,
	linux-rockchip, linux-fpga, linux-rdma, nvdimm, linux-pci,
	linux-amlogic, linux-cxl, linux-arm-msm
In-Reply-To: <20260528183625.870813-1-ynorov@nvidia.com>

These callbacks are sysfs show paths.

Use sysfs_emit() and cpumask_pr_args() to emit the masks.

This prepares for removing cpumap_print_to_pagebuf().

Signed-off-by: Yury Norov <ynorov@nvidia.com>
---
 arch/powerpc/kernel/cacheinfo.c | 3 ++-
 arch/powerpc/perf/hv-24x7.c     | 2 +-
 arch/powerpc/perf/hv-gpci.c     | 2 +-
 arch/powerpc/perf/imc-pmu.c     | 2 +-
 4 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/kernel/cacheinfo.c b/arch/powerpc/kernel/cacheinfo.c
index 90d51d9b3ed2..be415d2bb697 100644
--- a/arch/powerpc/kernel/cacheinfo.c
+++ b/arch/powerpc/kernel/cacheinfo.c
@@ -689,7 +689,8 @@ show_shared_cpumap(struct kobject *k, struct kobj_attribute *attr, char *buf, bo
 
 	mask = &cache->shared_cpu_map;
 
-	return cpumap_print_to_pagebuf(list, buf, mask);
+	return sysfs_emit(buf, list ? "%*pbl\n" : "%*pb\n",
+			  cpumask_pr_args(mask));
 }
 
 static ssize_t shared_cpu_map_show(struct kobject *k, struct kobj_attribute *attr, char *buf)
diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c
index 243c0a1c8cda..d661fc972c92 100644
--- a/arch/powerpc/perf/hv-24x7.c
+++ b/arch/powerpc/perf/hv-24x7.c
@@ -428,7 +428,7 @@ static char *memdup_to_str(char *maybe_str, int max_len, gfp_t gfp)
 static ssize_t cpumask_show(struct device *dev,
 			    struct device_attribute *attr, char *buf)
 {
-	return cpumap_print_to_pagebuf(true, buf, &hv_24x7_cpumask);
+	return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(&hv_24x7_cpumask));
 }
 
 static ssize_t sockets_show(struct device *dev,
diff --git a/arch/powerpc/perf/hv-gpci.c b/arch/powerpc/perf/hv-gpci.c
index 10c82cf8f5b3..655b9553ca54 100644
--- a/arch/powerpc/perf/hv-gpci.c
+++ b/arch/powerpc/perf/hv-gpci.c
@@ -99,7 +99,7 @@ static ssize_t kernel_version_show(struct device *dev,
 static ssize_t cpumask_show(struct device *dev,
 			    struct device_attribute *attr, char *buf)
 {
-	return cpumap_print_to_pagebuf(true, buf, &hv_gpci_cpumask);
+	return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(&hv_gpci_cpumask));
 }
 
 /* Interface attribute array index to store system information */
diff --git a/arch/powerpc/perf/imc-pmu.c b/arch/powerpc/perf/imc-pmu.c
index c1563b4eaa94..7cb909c47889 100644
--- a/arch/powerpc/perf/imc-pmu.c
+++ b/arch/powerpc/perf/imc-pmu.c
@@ -117,7 +117,7 @@ static ssize_t imc_pmu_cpumask_get_attr(struct device *dev,
 		return 0;
 	}
 
-	return cpumap_print_to_pagebuf(true, buf, active_mask);
+	return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(active_mask));
 }
 
 static DEVICE_ATTR(cpumask, S_IRUGO, imc_pmu_cpumask_get_attr, NULL);
-- 
2.51.0


^ permalink raw reply related

* [PATCH 04/16] x86/events: Use sysfs_emit() for cpumask show callbacks
From: Yury Norov @ 2026-05-28 18:36 UTC (permalink / raw)
  To: Andrew Morton, Rasmus Villemoes, Yury Norov
  Cc: Russell King, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Madhavan Srinivasan, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy (CS GROUP), Peter Zijlstra,
	Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
	James Clark, Thomas Gleixner, Borislav Petkov, Dave Hansen,
	H. Peter Anvin, Rafael J. Wysocki, Len Brown, Greg Kroah-Hartman,
	Danilo Krummrich, Chanwoo Choi, MyungJoo Ham, Kyungmin Park,
	Heiko Stuebner, Lorenzo Pieralisi, Xu Yilun, Tom Rix,
	Moritz Fischer, Yicong Yang, Jonathan Cameron, Dennis Dalessandro,
	Jason Gunthorpe, Leon Romanovsky, Dan Williams, Vishal Verma,
	Dave Jiang, Ira Weiny, Bjorn Helgaas, Shuai Xue, Will Deacon,
	Jiucheng Xu, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Robin Murphy, Jing Zhang, Xu Yang,
	Linu Cherian, Gowthami Thiagarajan, Ji Sheng Teoh, Khuong Dinh,
	Daniel Lezcano, Zhang Rui, Lukasz Luba, Yury Norov, Kees Cook,
	Thomas Weißschuh, Aboorva Devarajan, Ritesh Harjani (IBM),
	Ilkka Koskinen, Besar Wicaksono, Ma Ke, Chengwen Feng,
	linux-arm-kernel, imx, linux-kernel, linuxppc-dev,
	linux-perf-users, linux-acpi, driver-core, linux-pm,
	linux-rockchip, linux-fpga, linux-rdma, nvdimm, linux-pci,
	linux-amlogic, linux-cxl, linux-arm-msm
In-Reply-To: <20260528183625.870813-1-ynorov@nvidia.com>

These callbacks are sysfs show paths.

Use sysfs_emit() and cpumask_pr_args() to emit the masks.

This prepares for removing cpumap_print_to_pagebuf().

Signed-off-by: Yury Norov <ynorov@nvidia.com>
---
 arch/x86/events/amd/iommu.c    | 2 +-
 arch/x86/events/amd/power.c    | 2 +-
 arch/x86/events/amd/uncore.c   | 2 +-
 arch/x86/events/intel/core.c   | 2 +-
 arch/x86/events/intel/uncore.c | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/x86/events/amd/iommu.c b/arch/x86/events/amd/iommu.c
index 07b110e8418a..f332c7089bd5 100644
--- a/arch/x86/events/amd/iommu.c
+++ b/arch/x86/events/amd/iommu.c
@@ -137,7 +137,7 @@ static ssize_t _iommu_cpumask_show(struct device *dev,
 				   struct device_attribute *attr,
 				   char *buf)
 {
-	return cpumap_print_to_pagebuf(true, buf, &iommu_cpumask);
+	return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(&iommu_cpumask));
 }
 static DEVICE_ATTR(cpumask, S_IRUGO, _iommu_cpumask_show, NULL);
 
diff --git a/arch/x86/events/amd/power.c b/arch/x86/events/amd/power.c
index dad42790cf7d..890609961a6f 100644
--- a/arch/x86/events/amd/power.c
+++ b/arch/x86/events/amd/power.c
@@ -147,7 +147,7 @@ static void pmu_event_read(struct perf_event *event)
 static ssize_t
 get_attr_cpumask(struct device *dev, struct device_attribute *attr, char *buf)
 {
-	return cpumap_print_to_pagebuf(true, buf, &cpu_mask);
+	return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(&cpu_mask));
 }
 
 static DEVICE_ATTR(cpumask, S_IRUGO, get_attr_cpumask, NULL);
diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c
index dd956cfcadef..797dcce8bd89 100644
--- a/arch/x86/events/amd/uncore.c
+++ b/arch/x86/events/amd/uncore.c
@@ -321,7 +321,7 @@ static ssize_t amd_uncore_attr_show_cpumask(struct device *dev,
 	struct pmu *ptr = dev_get_drvdata(dev);
 	struct amd_uncore_pmu *pmu = container_of(ptr, struct amd_uncore_pmu, pmu);
 
-	return cpumap_print_to_pagebuf(true, buf, &pmu->active_mask);
+	return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(&pmu->active_mask));
 }
 static DEVICE_ATTR(cpumask, S_IRUGO, amd_uncore_attr_show_cpumask, NULL);
 
diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index dd1e3aa75ee9..5e9b65b2d1c1 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -7311,7 +7311,7 @@ static ssize_t intel_hybrid_get_attr_cpus(struct device *dev,
 	struct x86_hybrid_pmu *pmu =
 		container_of(dev_get_drvdata(dev), struct x86_hybrid_pmu, pmu);
 
-	return cpumap_print_to_pagebuf(true, buf, &pmu->supported_cpus);
+	return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(&pmu->supported_cpus));
 }
 
 static DEVICE_ATTR(cpus, S_IRUGO, intel_hybrid_get_attr_cpus, NULL);
diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c
index e9cc1ba921c5..746d0d526f1d 100644
--- a/arch/x86/events/intel/uncore.c
+++ b/arch/x86/events/intel/uncore.c
@@ -842,7 +842,7 @@ static ssize_t uncore_get_attr_cpumask(struct device *dev,
 {
 	struct intel_uncore_pmu *pmu = container_of(dev_get_drvdata(dev), struct intel_uncore_pmu, pmu);
 
-	return cpumap_print_to_pagebuf(true, buf, &pmu->cpu_mask);
+	return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(&pmu->cpu_mask));
 }
 
 static DEVICE_ATTR(cpumask, S_IRUGO, uncore_get_attr_cpumask, NULL);
-- 
2.51.0


^ permalink raw reply related

* [PATCH 05/16] ACPI: pad: Use sysfs_emit() for idlecpus show
From: Yury Norov @ 2026-05-28 18:36 UTC (permalink / raw)
  To: Andrew Morton, Rasmus Villemoes, Yury Norov
  Cc: Russell King, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Madhavan Srinivasan, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy (CS GROUP), Peter Zijlstra,
	Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
	James Clark, Thomas Gleixner, Borislav Petkov, Dave Hansen,
	H. Peter Anvin, Rafael J. Wysocki, Len Brown, Greg Kroah-Hartman,
	Danilo Krummrich, Chanwoo Choi, MyungJoo Ham, Kyungmin Park,
	Heiko Stuebner, Lorenzo Pieralisi, Xu Yilun, Tom Rix,
	Moritz Fischer, Yicong Yang, Jonathan Cameron, Dennis Dalessandro,
	Jason Gunthorpe, Leon Romanovsky, Dan Williams, Vishal Verma,
	Dave Jiang, Ira Weiny, Bjorn Helgaas, Shuai Xue, Will Deacon,
	Jiucheng Xu, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Robin Murphy, Jing Zhang, Xu Yang,
	Linu Cherian, Gowthami Thiagarajan, Ji Sheng Teoh, Khuong Dinh,
	Daniel Lezcano, Zhang Rui, Lukasz Luba, Yury Norov, Kees Cook,
	Thomas Weißschuh, Aboorva Devarajan, Ritesh Harjani (IBM),
	Ilkka Koskinen, Besar Wicaksono, Ma Ke, Chengwen Feng,
	linux-arm-kernel, imx, linux-kernel, linuxppc-dev,
	linux-perf-users, linux-acpi, driver-core, linux-pm,
	linux-rockchip, linux-fpga, linux-rdma, nvdimm, linux-pci,
	linux-amlogic, linux-cxl, linux-arm-msm
In-Reply-To: <20260528183625.870813-1-ynorov@nvidia.com>

idlecpus_show() is a sysfs show callback. Use sysfs_emit() and
cpumask_pr_args() to emit the mask.

This prepares for removing cpumap_print_to_pagebuf().

Signed-off-by: Yury Norov <ynorov@nvidia.com>
---
 drivers/acpi/acpi_pad.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c
index ec94b09bb747..04d61a6cc95f 100644
--- a/drivers/acpi/acpi_pad.c
+++ b/drivers/acpi/acpi_pad.c
@@ -334,8 +334,8 @@ static ssize_t idlecpus_store(struct device *dev,
 static ssize_t idlecpus_show(struct device *dev,
 	struct device_attribute *attr, char *buf)
 {
-	return cpumap_print_to_pagebuf(false, buf,
-				       to_cpumask(pad_busy_cpus_bits));
+	return sysfs_emit(buf, "%*pb\n",
+			  cpumask_pr_args(to_cpumask(pad_busy_cpus_bits)));
 }
 
 static DEVICE_ATTR_RW(idlecpus);
-- 
2.51.0



^ permalink raw reply related

* [PATCH 06/16] cpu: Use sysfs_emit() for cpumask show callback
From: Yury Norov @ 2026-05-28 18:36 UTC (permalink / raw)
  To: Andrew Morton, Rasmus Villemoes, Yury Norov
  Cc: Russell King, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Madhavan Srinivasan, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy (CS GROUP), Peter Zijlstra,
	Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
	James Clark, Thomas Gleixner, Borislav Petkov, Dave Hansen,
	H. Peter Anvin, Rafael J. Wysocki, Len Brown, Greg Kroah-Hartman,
	Danilo Krummrich, Chanwoo Choi, MyungJoo Ham, Kyungmin Park,
	Heiko Stuebner, Lorenzo Pieralisi, Xu Yilun, Tom Rix,
	Moritz Fischer, Yicong Yang, Jonathan Cameron, Dennis Dalessandro,
	Jason Gunthorpe, Leon Romanovsky, Dan Williams, Vishal Verma,
	Dave Jiang, Ira Weiny, Bjorn Helgaas, Shuai Xue, Will Deacon,
	Jiucheng Xu, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Robin Murphy, Jing Zhang, Xu Yang,
	Linu Cherian, Gowthami Thiagarajan, Ji Sheng Teoh, Khuong Dinh,
	Daniel Lezcano, Zhang Rui, Lukasz Luba, Yury Norov, Kees Cook,
	Thomas Weißschuh, Aboorva Devarajan, Ritesh Harjani (IBM),
	Ilkka Koskinen, Besar Wicaksono, Ma Ke, Chengwen Feng,
	linux-arm-kernel, imx, linux-kernel, linuxppc-dev,
	linux-perf-users, linux-acpi, driver-core, linux-pm,
	linux-rockchip, linux-fpga, linux-rdma, nvdimm, linux-pci,
	linux-amlogic, linux-cxl, linux-arm-msm
In-Reply-To: <20260528183625.870813-1-ynorov@nvidia.com>

show_cpus_attr() is a sysfs show callback. Use sysfs_emit() and
cpumask_pr_args() to emit the mask.

This prepares for removing cpumap_print_to_pagebuf().

Signed-off-by: Yury Norov <ynorov@nvidia.com>
---
 drivers/base/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 875abdc9942e..2ebc4e87ed9f 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -218,7 +218,7 @@ static ssize_t show_cpus_attr(struct device *dev,
 {
 	struct cpu_attr *ca = container_of(attr, struct cpu_attr, attr);
 
-	return cpumap_print_to_pagebuf(true, buf, ca->map);
+	return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(ca->map));
 }
 
 #define _CPU_ATTR(name, map) \
-- 
2.51.0



^ permalink raw reply related

* [PATCH 07/16] devfreq: Use sysfs_emit() for cpumask show callbacks
From: Yury Norov @ 2026-05-28 18:36 UTC (permalink / raw)
  To: Andrew Morton, Rasmus Villemoes, Yury Norov
  Cc: Russell King, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Madhavan Srinivasan, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy (CS GROUP), Peter Zijlstra,
	Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
	James Clark, Thomas Gleixner, Borislav Petkov, Dave Hansen,
	H. Peter Anvin, Rafael J. Wysocki, Len Brown, Greg Kroah-Hartman,
	Danilo Krummrich, Chanwoo Choi, MyungJoo Ham, Kyungmin Park,
	Heiko Stuebner, Lorenzo Pieralisi, Xu Yilun, Tom Rix,
	Moritz Fischer, Yicong Yang, Jonathan Cameron, Dennis Dalessandro,
	Jason Gunthorpe, Leon Romanovsky, Dan Williams, Vishal Verma,
	Dave Jiang, Ira Weiny, Bjorn Helgaas, Shuai Xue, Will Deacon,
	Jiucheng Xu, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Robin Murphy, Jing Zhang, Xu Yang,
	Linu Cherian, Gowthami Thiagarajan, Ji Sheng Teoh, Khuong Dinh,
	Daniel Lezcano, Zhang Rui, Lukasz Luba, Yury Norov, Kees Cook,
	Thomas Weißschuh, Aboorva Devarajan, Ritesh Harjani (IBM),
	Ilkka Koskinen, Besar Wicaksono, Ma Ke, Chengwen Feng,
	linux-arm-kernel, imx, linux-kernel, linuxppc-dev,
	linux-perf-users, linux-acpi, driver-core, linux-pm,
	linux-rockchip, linux-fpga, linux-rdma, nvdimm, linux-pci,
	linux-amlogic, linux-cxl, linux-arm-msm
In-Reply-To: <20260528183625.870813-1-ynorov@nvidia.com>

These callbacks are sysfs show paths. Use sysfs_emit() and
cpumask_pr_args() to emit the masks.

This prepares for removing cpumap_print_to_pagebuf().

Signed-off-by: Yury Norov <ynorov@nvidia.com>
---
 drivers/devfreq/event/rockchip-dfi.c | 2 +-
 drivers/devfreq/hisi_uncore_freq.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/devfreq/event/rockchip-dfi.c b/drivers/devfreq/event/rockchip-dfi.c
index 5e6e7e900bda..255aee1bdd91 100644
--- a/drivers/devfreq/event/rockchip-dfi.c
+++ b/drivers/devfreq/event/rockchip-dfi.c
@@ -354,7 +354,7 @@ static ssize_t ddr_perf_cpumask_show(struct device *dev,
 	struct pmu *pmu = dev_get_drvdata(dev);
 	struct rockchip_dfi *dfi = container_of(pmu, struct rockchip_dfi, pmu);
 
-	return cpumap_print_to_pagebuf(true, buf, cpumask_of(dfi->cpu));
+	return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(cpumask_of(dfi->cpu)));
 }
 
 static struct device_attribute ddr_perf_cpumask_attr =
diff --git a/drivers/devfreq/hisi_uncore_freq.c b/drivers/devfreq/hisi_uncore_freq.c
index 4d00d813c8ac..23b262d23a66 100644
--- a/drivers/devfreq/hisi_uncore_freq.c
+++ b/drivers/devfreq/hisi_uncore_freq.c
@@ -541,7 +541,7 @@ static ssize_t related_cpus_show(struct device *dev,
 {
 	struct hisi_uncore_freq *uncore = dev_get_drvdata(dev->parent);
 
-	return cpumap_print_to_pagebuf(true, buf, &uncore->related_cpus);
+	return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(&uncore->related_cpus));
 }
 
 static DEVICE_ATTR_RO(related_cpus);
-- 
2.51.0



^ permalink raw reply related

* [PATCH 08/16] fpga: dfl-fme-perf: Use sysfs_emit() for cpumask show
From: Yury Norov @ 2026-05-28 18:36 UTC (permalink / raw)
  To: Andrew Morton, Rasmus Villemoes, Yury Norov
  Cc: Russell King, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Madhavan Srinivasan, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy (CS GROUP), Peter Zijlstra,
	Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
	James Clark, Thomas Gleixner, Borislav Petkov, Dave Hansen,
	H. Peter Anvin, Rafael J. Wysocki, Len Brown, Greg Kroah-Hartman,
	Danilo Krummrich, Chanwoo Choi, MyungJoo Ham, Kyungmin Park,
	Heiko Stuebner, Lorenzo Pieralisi, Xu Yilun, Tom Rix,
	Moritz Fischer, Yicong Yang, Jonathan Cameron, Dennis Dalessandro,
	Jason Gunthorpe, Leon Romanovsky, Dan Williams, Vishal Verma,
	Dave Jiang, Ira Weiny, Bjorn Helgaas, Shuai Xue, Will Deacon,
	Jiucheng Xu, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Robin Murphy, Jing Zhang, Xu Yang,
	Linu Cherian, Gowthami Thiagarajan, Ji Sheng Teoh, Khuong Dinh,
	Daniel Lezcano, Zhang Rui, Lukasz Luba, Yury Norov, Kees Cook,
	Thomas Weißschuh, Aboorva Devarajan, Ritesh Harjani (IBM),
	Ilkka Koskinen, Besar Wicaksono, Ma Ke, Chengwen Feng,
	linux-arm-kernel, imx, linux-kernel, linuxppc-dev,
	linux-perf-users, linux-acpi, driver-core, linux-pm,
	linux-rockchip, linux-fpga, linux-rdma, nvdimm, linux-pci,
	linux-amlogic, linux-cxl, linux-arm-msm
In-Reply-To: <20260528183625.870813-1-ynorov@nvidia.com>

cpumask_show() is a sysfs show callback. Use sysfs_emit() and
cpumask_pr_args() to emit the mask.

This prepares for removing cpumap_print_to_pagebuf().

Signed-off-by: Yury Norov <ynorov@nvidia.com>
---
 drivers/fpga/dfl-fme-perf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/fpga/dfl-fme-perf.c b/drivers/fpga/dfl-fme-perf.c
index 7422d2bc6f37..7aa4983ab67d 100644
--- a/drivers/fpga/dfl-fme-perf.c
+++ b/drivers/fpga/dfl-fme-perf.c
@@ -183,7 +183,7 @@ static ssize_t cpumask_show(struct device *dev,
 
 	priv = to_fme_perf_priv(pmu);
 
-	return cpumap_print_to_pagebuf(true, buf, cpumask_of(priv->cpu));
+	return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(cpumask_of(priv->cpu)));
 }
 static DEVICE_ATTR_RO(cpumask);
 
-- 
2.51.0



^ permalink raw reply related

* [PATCH 09/16] hwtracing: hisi_ptt: Use sysfs_emit() for cpumask show
From: Yury Norov @ 2026-05-28 18:36 UTC (permalink / raw)
  To: Andrew Morton, Rasmus Villemoes, Yury Norov
  Cc: Russell King, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Madhavan Srinivasan, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy (CS GROUP), Peter Zijlstra,
	Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
	James Clark, Thomas Gleixner, Borislav Petkov, Dave Hansen,
	H. Peter Anvin, Rafael J. Wysocki, Len Brown, Greg Kroah-Hartman,
	Danilo Krummrich, Chanwoo Choi, MyungJoo Ham, Kyungmin Park,
	Heiko Stuebner, Lorenzo Pieralisi, Xu Yilun, Tom Rix,
	Moritz Fischer, Yicong Yang, Jonathan Cameron, Dennis Dalessandro,
	Jason Gunthorpe, Leon Romanovsky, Dan Williams, Vishal Verma,
	Dave Jiang, Ira Weiny, Bjorn Helgaas, Shuai Xue, Will Deacon,
	Jiucheng Xu, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Robin Murphy, Jing Zhang, Xu Yang,
	Linu Cherian, Gowthami Thiagarajan, Ji Sheng Teoh, Khuong Dinh,
	Daniel Lezcano, Zhang Rui, Lukasz Luba, Yury Norov, Kees Cook,
	Thomas Weißschuh, Aboorva Devarajan, Ritesh Harjani (IBM),
	Ilkka Koskinen, Besar Wicaksono, Ma Ke, Chengwen Feng,
	linux-arm-kernel, imx, linux-kernel, linuxppc-dev,
	linux-perf-users, linux-acpi, driver-core, linux-pm,
	linux-rockchip, linux-fpga, linux-rdma, nvdimm, linux-pci,
	linux-amlogic, linux-cxl, linux-arm-msm
In-Reply-To: <20260528183625.870813-1-ynorov@nvidia.com>

cpumask_show() is a sysfs show callback. Use sysfs_emit() and
cpumask_pr_args() to emit the mask.

This prepares for removing cpumap_print_to_pagebuf().

Signed-off-by: Yury Norov <ynorov@nvidia.com>
---
 drivers/hwtracing/ptt/hisi_ptt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwtracing/ptt/hisi_ptt.c b/drivers/hwtracing/ptt/hisi_ptt.c
index 94c371c49135..233c4c32513c 100644
--- a/drivers/hwtracing/ptt/hisi_ptt.c
+++ b/drivers/hwtracing/ptt/hisi_ptt.c
@@ -780,7 +780,7 @@ static ssize_t cpumask_show(struct device *dev, struct device_attribute *attr,
 	struct hisi_ptt *hisi_ptt = to_hisi_ptt(dev_get_drvdata(dev));
 	const cpumask_t *cpumask = cpumask_of_node(dev_to_node(&hisi_ptt->pdev->dev));
 
-	return cpumap_print_to_pagebuf(true, buf, cpumask);
+	return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(cpumask));
 }
 static DEVICE_ATTR_RO(cpumask);
 
-- 
2.51.0



^ permalink raw reply related

* [PATCH 01/16] psci: simplify hotplug_tests()
From: Yury Norov @ 2026-05-28 18:36 UTC (permalink / raw)
  To: Andrew Morton, Rasmus Villemoes, Yury Norov
  Cc: Russell King, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Madhavan Srinivasan, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy (CS GROUP), Peter Zijlstra,
	Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
	James Clark, Thomas Gleixner, Borislav Petkov, Dave Hansen,
	H. Peter Anvin, Rafael J. Wysocki, Len Brown, Greg Kroah-Hartman,
	Danilo Krummrich, Chanwoo Choi, MyungJoo Ham, Kyungmin Park,
	Heiko Stuebner, Lorenzo Pieralisi, Xu Yilun, Tom Rix,
	Moritz Fischer, Yicong Yang, Jonathan Cameron, Dennis Dalessandro,
	Jason Gunthorpe, Leon Romanovsky, Dan Williams, Vishal Verma,
	Dave Jiang, Ira Weiny, Bjorn Helgaas, Shuai Xue, Will Deacon,
	Jiucheng Xu, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Robin Murphy, Jing Zhang, Xu Yang,
	Linu Cherian, Gowthami Thiagarajan, Ji Sheng Teoh, Khuong Dinh,
	Daniel Lezcano, Zhang Rui, Lukasz Luba, Yury Norov, Kees Cook,
	Thomas Weißschuh, Aboorva Devarajan, Ritesh Harjani (IBM),
	Ilkka Koskinen, Besar Wicaksono, Ma Ke, Chengwen Feng,
	linux-arm-kernel, imx, linux-kernel, linuxppc-dev,
	linux-perf-users, linux-acpi, driver-core, linux-pm,
	linux-rockchip, linux-fpga, linux-rdma, nvdimm, linux-pci,
	linux-amlogic, linux-cxl, linux-arm-msm
In-Reply-To: <20260528183625.870813-1-ynorov@nvidia.com>

Switch to pr_info("... %pbl"), and drop the temporary buffer allocation.

This prepares for removing cpumap_print_to_pagebuf().

Signed-off-by: Yury Norov <ynorov@nvidia.com>
---
 drivers/firmware/psci/psci_checker.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/firmware/psci/psci_checker.c b/drivers/firmware/psci/psci_checker.c
index e67ba9891082..ecd745bb90bf 100644
--- a/drivers/firmware/psci/psci_checker.c
+++ b/drivers/firmware/psci/psci_checker.c
@@ -186,7 +186,6 @@ static int hotplug_tests(void)
 {
 	int i, nb_cpu_group, err = -ENOMEM;
 	cpumask_var_t offlined_cpus, *cpu_groups;
-	char *page_buf;
 
 	if (!alloc_cpumask_var(&offlined_cpus, GFP_KERNEL))
 		return err;
@@ -194,10 +193,6 @@ static int hotplug_tests(void)
 	nb_cpu_group = alloc_init_cpu_groups(&cpu_groups);
 	if (nb_cpu_group < 0)
 		goto out_free_cpus;
-	page_buf = (char *)__get_free_page(GFP_KERNEL);
-	if (!page_buf)
-		goto out_free_cpu_groups;
-
 	/*
 	 * Of course the last CPU cannot be powered down and cpu_down() should
 	 * refuse doing that.
@@ -210,16 +205,11 @@ static int hotplug_tests(void)
 	 * off, the cpu group itself should shut down.
 	 */
 	for (i = 0; i < nb_cpu_group; ++i) {
-		ssize_t len = cpumap_print_to_pagebuf(true, page_buf,
-						      cpu_groups[i]);
-		/* Remove trailing newline. */
-		page_buf[len - 1] = '\0';
-		pr_info("Trying to turn off and on again group %d (CPUs %s)\n",
-			i, page_buf);
+		pr_info("Trying to turn off and on again group %d (CPUs %*pbl)\n",
+			i, cpumask_pr_args(cpu_groups[i]));
 		err += down_and_up_cpus(cpu_groups[i], offlined_cpus);
 	}
 
-	free_page((unsigned long)page_buf);
 out_free_cpu_groups:
 	free_cpu_groups(nb_cpu_group, &cpu_groups);
 out_free_cpus:
-- 
2.51.0



^ permalink raw reply related

* [PATCH 10/16] RDMA/hfi1: Use sysfs_emit() for cpumask show helper
From: Yury Norov @ 2026-05-28 18:36 UTC (permalink / raw)
  To: Andrew Morton, Rasmus Villemoes, Yury Norov
  Cc: Russell King, Frank Li, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Madhavan Srinivasan, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy (CS GROUP), Peter Zijlstra,
	Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
	James Clark, Thomas Gleixner, Borislav Petkov, Dave Hansen,
	H. Peter Anvin, Rafael J. Wysocki, Len Brown, Greg Kroah-Hartman,
	Danilo Krummrich, Chanwoo Choi, MyungJoo Ham, Kyungmin Park,
	Heiko Stuebner, Lorenzo Pieralisi, Xu Yilun, Tom Rix,
	Moritz Fischer, Yicong Yang, Jonathan Cameron, Dennis Dalessandro,
	Jason Gunthorpe, Leon Romanovsky, Dan Williams, Vishal Verma,
	Dave Jiang, Ira Weiny, Bjorn Helgaas, Shuai Xue, Will Deacon,
	Jiucheng Xu, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Robin Murphy, Jing Zhang, Xu Yang,
	Linu Cherian, Gowthami Thiagarajan, Ji Sheng Teoh, Khuong Dinh,
	Daniel Lezcano, Zhang Rui, Lukasz Luba, Yury Norov, Kees Cook,
	Thomas Weißschuh, Aboorva Devarajan, Ritesh Harjani (IBM),
	Ilkka Koskinen, Besar Wicaksono, Ma Ke, Chengwen Feng,
	linux-arm-kernel, imx, linux-kernel, linuxppc-dev,
	linux-perf-users, linux-acpi, driver-core, linux-pm,
	linux-rockchip, linux-fpga, linux-rdma, nvdimm, linux-pci,
	linux-amlogic, linux-cxl, linux-arm-msm
In-Reply-To: <20260528183625.870813-1-ynorov@nvidia.com>

sdma_get_cpu_to_sde_map() is used by a sysfs show callback.

Use sysfs_emit() and cpumask_pr_args() to emit the mask.

This prepares for removing cpumap_print_to_pagebuf().

Signed-off-by: Yury Norov <ynorov@nvidia.com>
---
 drivers/infiniband/hw/hfi1/sdma.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/hfi1/sdma.c b/drivers/infiniband/hw/hfi1/sdma.c
index cfd9dd0f7e81..f253c8ee182d 100644
--- a/drivers/infiniband/hw/hfi1/sdma.c
+++ b/drivers/infiniband/hw/hfi1/sdma.c
@@ -11,6 +11,7 @@
 #include <linux/timer.h>
 #include <linux/vmalloc.h>
 #include <linux/highmem.h>
+#include <linux/sysfs.h>
 
 #include "hfi.h"
 #include "common.h"
@@ -1049,7 +1050,7 @@ ssize_t sdma_get_cpu_to_sde_map(struct sdma_engine *sde, char *buf)
 	if (cpumask_empty(&sde->cpu_mask))
 		snprintf(buf, PAGE_SIZE, "%s\n", "empty");
 	else
-		cpumap_print_to_pagebuf(true, buf, &sde->cpu_mask);
+		sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(&sde->cpu_mask));
 	mutex_unlock(&process_to_sde_mutex);
 	return strnlen(buf, PAGE_SIZE);
 }
-- 
2.51.0


^ permalink raw reply related


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