mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] powerpc/perf/vpa-dtl: use GFP_ATOMIC for DTL buffer allocation
@ 2026-11-02 14:37 mdshahid03
  2026-11-10 17:54 ` mdshahid03
  2026-11-11  3:34 ` Ritesh Harjani
  0 siblings, 2 replies; 3+ messages in thread
From: mdshahid03 @ 2026-11-02 14:37 UTC (permalink / raw)
  To: maddy
  Cc: mpe, npiggin, chleroy, ritesh.list, sshegde, linuxppc-dev,
	linux-kernel, Mohammad Shahid

From: Mohammad Shahid <mdshahid03@gmail.com>

The DTL buffer is allocated while holding dtl_global_lock, which
is spinlock.

GFP_KERNEL allow direct memory reclaim and may sleep. Combining
GFP_KERNEL with GFP_ATOMIC does not remove the direct reclaim.

Use GFP_ATOMIC alone to ensure the allocation does not sleep
while the spinlock is held.

The issue is reported by script coccinelle call_kern.cocci.

Signed-off-by: Mohammad Shahid <mdshahid03@gmail.com>
---
 arch/powerpc/perf/vpa-dtl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/perf/vpa-dtl.c b/arch/powerpc/perf/vpa-dtl.c
index 3e3d65b6c796..3d34417e6aae 100644
--- a/arch/powerpc/perf/vpa-dtl.c
+++ b/arch/powerpc/perf/vpa-dtl.c
@@ -338,7 +338,7 @@ static int vpa_dtl_mem_alloc(int cpu)
 	if (!dtl_cache)
 		return -ENOMEM;
 
-	buf = kmem_cache_alloc_node(dtl_cache, GFP_KERNEL | GFP_ATOMIC, cpu_to_node(cpu));
+	buf = kmem_cache_alloc_node(dtl_cache, GFP_ATOMIC, cpu_to_node(cpu));
 	if (!buf) {
 		pr_warn("buffer allocation failed for cpu %d\n", cpu);
 		return -ENOMEM;
-- 
2.43.0


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

* Re: [PATCH] powerpc/perf/vpa-dtl: use GFP_ATOMIC for DTL buffer allocation
  2026-11-02 14:37 [PATCH] powerpc/perf/vpa-dtl: use GFP_ATOMIC for DTL buffer allocation mdshahid03
@ 2026-11-10 17:54 ` mdshahid03
  2026-11-11  3:34 ` Ritesh Harjani
  1 sibling, 0 replies; 3+ messages in thread
From: mdshahid03 @ 2026-11-10 17:54 UTC (permalink / raw)
  To: mdshahid03
  Cc: maddy, mpe, npiggin, chleroy, ritesh.list, sshegde, linuxppc-dev,
	linux-kernel

Hi,

Could you please review this patch and give your feedback,when time
permits.

Thanks
Shahid.

On 2026-11-02 20:07 +0530, mdshahid03@gmail.com wrote:
> From: Mohammad Shahid <mdshahid03@gmail.com>
> 
> The DTL buffer is allocated while holding dtl_global_lock, which
> is spinlock.
> 
> GFP_KERNEL allow direct memory reclaim and may sleep. Combining
> GFP_KERNEL with GFP_ATOMIC does not remove the direct reclaim.
> 
> Use GFP_ATOMIC alone to ensure the allocation does not sleep
> while the spinlock is held.
> 
> The issue is reported by script coccinelle call_kern.cocci.
> 
> Signed-off-by: Mohammad Shahid <mdshahid03@gmail.com>
> ---
>  arch/powerpc/perf/vpa-dtl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/perf/vpa-dtl.c b/arch/powerpc/perf/vpa-dtl.c
> index 3e3d65b6c796..3d34417e6aae 100644
> --- a/arch/powerpc/perf/vpa-dtl.c
> +++ b/arch/powerpc/perf/vpa-dtl.c
> @@ -338,7 +338,7 @@ static int vpa_dtl_mem_alloc(int cpu)
>  	if (!dtl_cache)
>  		return -ENOMEM;
>  
> -	buf = kmem_cache_alloc_node(dtl_cache, GFP_KERNEL | GFP_ATOMIC, cpu_to_node(cpu));
> +	buf = kmem_cache_alloc_node(dtl_cache, GFP_ATOMIC, cpu_to_node(cpu));
>  	if (!buf) {
>  		pr_warn("buffer allocation failed for cpu %d\n", cpu);
>  		return -ENOMEM;
> -- 
> 2.43.0
> 
> 
> 



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

* Re: [PATCH] powerpc/perf/vpa-dtl: use GFP_ATOMIC for DTL buffer allocation
  2026-11-02 14:37 [PATCH] powerpc/perf/vpa-dtl: use GFP_ATOMIC for DTL buffer allocation mdshahid03
  2026-11-10 17:54 ` mdshahid03
@ 2026-11-11  3:34 ` Ritesh Harjani
  1 sibling, 0 replies; 3+ messages in thread
From: Ritesh Harjani @ 2026-11-11  3:34 UTC (permalink / raw)
  To: mdshahid03, maddy
  Cc: mpe, npiggin, chleroy, sshegde, linuxppc-dev, linux-kernel,
	Mohammad Shahid

mdshahid03@gmail.com writes:

> From: Mohammad Shahid <mdshahid03@gmail.com>
>
> The DTL buffer is allocated while holding dtl_global_lock, which
> is spinlock.
>
> GFP_KERNEL allow direct memory reclaim and may sleep. Combining
> GFP_KERNEL with GFP_ATOMIC does not remove the direct reclaim.
>
> Use GFP_ATOMIC alone to ensure the allocation does not sleep
> while the spinlock is held.
>
> The issue is reported by script coccinelle call_kern.cocci.
>
> Signed-off-by: Mohammad Shahid <mdshahid03@gmail.com>

This make sense. However we should also add fixes tag and tag stable
so it gets backported to stable trees as well.

Fixes: 4708fba19ade ("powerpc/vpa_dtl: Add interface to expose vpa dtl counters via perf")
Cc: stable@vger.kernel.org

LGTM, so feel free to add:
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>


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

end of thread, other threads:[~2026-11-11  3:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-02 14:37 [PATCH] powerpc/perf/vpa-dtl: use GFP_ATOMIC for DTL buffer allocation mdshahid03
2026-11-10 17:54 ` mdshahid03
2026-11-11  3:34 ` Ritesh Harjani

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

all inboxes | Powered by JetHome®