All of lore.kernel.org
 help / color / mirror / Atom feed
* /proc/profile broken on UP machines in 2.6.29-rc3
@ 2009-02-09 14:50 Lennert Buytenhek
  2009-02-09 19:20 ` Hugh Dickins
  0 siblings, 1 reply; 3+ messages in thread
From: Lennert Buytenhek @ 2009-02-09 14:50 UTC (permalink / raw)
  To: rusty; +Cc: linux-kernel

I'm about 130k emails behind on my linux-kernel@ subscription, so I'm
not entirely sure whether this has been reported, but it seems that
profiling is broken on !CONFIG_SMP builds in 2.6.29-rc3.

It appears that since this commit:

	commit c309b917cab55799ea489d7b5f1b77025d9f8462
	Author: Rusty Russell <rusty@rustcorp.com.au>
	Date:   Thu Jan 1 10:12:27 2009 +1030

	    cpumask: convert kernel/profile.c

there's no longer anything that sets any bits in prof_cpu_mask on
UP systems at all (the default was to assign CPU_MASK_ALL, and
profile_cpu_callback() which clears/sets bits at run time is only
built and registered on SMP builds), so the cpumask_test_cpu()
test in profile_tick() always fails, and no samples are ever counted.

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

* Re: /proc/profile broken on UP machines in 2.6.29-rc3
  2009-02-09 14:50 /proc/profile broken on UP machines in 2.6.29-rc3 Lennert Buytenhek
@ 2009-02-09 19:20 ` Hugh Dickins
  2009-02-09 23:50   ` Ingo Molnar
  0 siblings, 1 reply; 3+ messages in thread
From: Hugh Dickins @ 2009-02-09 19:20 UTC (permalink / raw)
  To: Lennert Buytenhek; +Cc: Rusty Russell, Rafael Wysocki, linux-kernel

On Mon, 9 Feb 2009, Lennert Buytenhek wrote:

> I'm about 130k emails behind on my linux-kernel@ subscription, so I'm
> not entirely sure whether this has been reported, but it seems that
> profiling is broken on !CONFIG_SMP builds in 2.6.29-rc3.

Yes, and CONFIG_SMP builds, and 2.6.29-rc4.

> It appears that since this commit:
> 
> 	commit c309b917cab55799ea489d7b5f1b77025d9f8462
> 	Author: Rusty Russell <rusty@rustcorp.com.au>
> 	Date:   Thu Jan 1 10:12:27 2009 +1030
> 
> 	    cpumask: convert kernel/profile.c
> 
> there's no longer anything that sets any bits in prof_cpu_mask on
> UP systems at all (the default was to assign CPU_MASK_ALL, and
> profile_cpu_callback() which clears/sets bits at run time is only
> built and registered on SMP builds), so the cpumask_test_cpu()
> test in profile_tick() always fails, and no samples are ever counted.

I guess if you cpu down and up, or suspend and resume, that will get
aux cpus profiling in the SMP case, but basically SMP is as broken as
UP.  I noticed yesterday, took a look earlier today, here's the patch
which gets it working for me:


[PATCH] fix broken profiling regression

Commit c309b917cab55799ea489d7b5f1b77025d9f8462 "cpumask: convert
kernel/profile.c" broke profiling.  prof_cpu_mask was previously
initialized to CPU_MASK_ALL, but left uninitialized in that commit.
We need to copy cpu_possible_mask (cpu_online_mask is not enough).

Signed-off-by: Hugh Dickins <hugh@veritas.com>
---

 kernel/profile.c |    3 +++
 1 file changed, 3 insertions(+)

--- 2.6.29-rc4/kernel/profile.c	2009-01-11 01:33:38.000000000 +0000
+++ linux/kernel/profile.c	2009-02-09 15:23:34.000000000 +0000
@@ -114,12 +114,15 @@ int __ref profile_init(void)
 	if (!slab_is_available()) {
 		prof_buffer = alloc_bootmem(buffer_bytes);
 		alloc_bootmem_cpumask_var(&prof_cpu_mask);
+		cpumask_copy(prof_cpu_mask, cpu_possible_mask);
 		return 0;
 	}
 
 	if (!alloc_cpumask_var(&prof_cpu_mask, GFP_KERNEL))
 		return -ENOMEM;
 
+	cpumask_copy(prof_cpu_mask, cpu_possible_mask);
+
 	prof_buffer = kzalloc(buffer_bytes, GFP_KERNEL);
 	if (prof_buffer)
 		return 0;

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

* Re: /proc/profile broken on UP machines in 2.6.29-rc3
  2009-02-09 19:20 ` Hugh Dickins
@ 2009-02-09 23:50   ` Ingo Molnar
  0 siblings, 0 replies; 3+ messages in thread
From: Ingo Molnar @ 2009-02-09 23:50 UTC (permalink / raw)
  To: Hugh Dickins
  Cc: Lennert Buytenhek, Rusty Russell, Rafael Wysocki, linux-kernel


* Hugh Dickins <hugh@veritas.com> wrote:

> On Mon, 9 Feb 2009, Lennert Buytenhek wrote:
> 
> > I'm about 130k emails behind on my linux-kernel@ subscription, so I'm
> > not entirely sure whether this has been reported, but it seems that
> > profiling is broken on !CONFIG_SMP builds in 2.6.29-rc3.
> 
> Yes, and CONFIG_SMP builds, and 2.6.29-rc4.
> 
> > It appears that since this commit:
> > 
> > 	commit c309b917cab55799ea489d7b5f1b77025d9f8462
> > 	Author: Rusty Russell <rusty@rustcorp.com.au>
> > 	Date:   Thu Jan 1 10:12:27 2009 +1030
> > 
> > 	    cpumask: convert kernel/profile.c
> > 
> > there's no longer anything that sets any bits in prof_cpu_mask on
> > UP systems at all (the default was to assign CPU_MASK_ALL, and
> > profile_cpu_callback() which clears/sets bits at run time is only
> > built and registered on SMP builds), so the cpumask_test_cpu()
> > test in profile_tick() always fails, and no samples are ever counted.
> 
> I guess if you cpu down and up, or suspend and resume, that will get
> aux cpus profiling in the SMP case, but basically SMP is as broken as
> UP.  I noticed yesterday, took a look earlier today, here's the patch
> which gets it working for me:
> 
> 
> [PATCH] fix broken profiling regression
> 
> Commit c309b917cab55799ea489d7b5f1b77025d9f8462 "cpumask: convert
> kernel/profile.c" broke profiling.  prof_cpu_mask was previously
> initialized to CPU_MASK_ALL, but left uninitialized in that commit.
> We need to copy cpu_possible_mask (cpu_online_mask is not enough).
> 
> Signed-off-by: Hugh Dickins <hugh@veritas.com>
> ---
> 
>  kernel/profile.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> --- 2.6.29-rc4/kernel/profile.c	2009-01-11 01:33:38.000000000 +0000
> +++ linux/kernel/profile.c	2009-02-09 15:23:34.000000000 +0000
> @@ -114,12 +114,15 @@ int __ref profile_init(void)
>  	if (!slab_is_available()) {
>  		prof_buffer = alloc_bootmem(buffer_bytes);
>  		alloc_bootmem_cpumask_var(&prof_cpu_mask);
> +		cpumask_copy(prof_cpu_mask, cpu_possible_mask);
>  		return 0;
>  	}
>  
>  	if (!alloc_cpumask_var(&prof_cpu_mask, GFP_KERNEL))
>  		return -ENOMEM;
>  
> +	cpumask_copy(prof_cpu_mask, cpu_possible_mask);
> +
>  	prof_buffer = kzalloc(buffer_bytes, GFP_KERNEL);
>  	if (prof_buffer)
>  		return 0;

indeed. Applied to tip/tracing/urgent, thanks Hugh!

	Ingo

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

end of thread, other threads:[~2009-02-09 23:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-09 14:50 /proc/profile broken on UP machines in 2.6.29-rc3 Lennert Buytenhek
2009-02-09 19:20 ` Hugh Dickins
2009-02-09 23:50   ` Ingo Molnar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.