public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [2.6.29] Fix for enabling branch profiling makes sparse unusable
@ 2009-04-05 14:20 Bart Van Assche
  2009-04-07 19:30 ` [tip:tracing/urgent] branch tracer: " Bart Van Assche
  2009-04-08 17:29 ` [2.6.29] " Bart Van Assche
  0 siblings, 2 replies; 4+ messages in thread
From: Bart Van Assche @ 2009-04-05 14:20 UTC (permalink / raw)
  To: Steven Rostedt, Ingo Molnar; +Cc: Andrew Morton, LKML

One of the changes between kernels 2.6.28 and 2.6.29 is that a branch profiler
has been added for if() statements. Unfortunately this patch makes the sparse
output unusable with CONFIG_TRACE_BRANCH_PROFILING=y: when branch profiling is
enabled, sparse prints so much false positives that the real issues are no
longer visible. This behavior can be reproduced as follows:
* enable CONFIG_TRACE_BRANCH_PROFILING, e.g. by running make allyesconfig or
  make allmodconfig.
* run make C=2

Result: a huge number of the following sparse warnings.
...
include/linux/cpumask.h:547:2: warning: symbol '______r' shadows an earlier one
include/linux/cpumask.h:547:2: originally declared here
...

The patch below fixes this by disabling branch profiling while analyzing the
kernel code with sparse.

See also:
* http://lkml.org/lkml/2008/11/21/18
* http://bugzilla.kernel.org/show_bug.cgi?id=12925

Signed-off-by: Bart Van Assche <bart.vanassche@gmail.com>

--- orig/linux-2.6.29/include/linux/compiler.h	2009-03-23 19:12:14.000000000 -0400
+++ linux-2.6.29/include/linux/compiler.h	2009-03-24 08:46:46.000000000 -0400
@@ -75,7 +75,8 @@ struct ftrace_branch_data {
  * Note: DISABLE_BRANCH_PROFILING can be used by special lowlevel code
  * to disable branch tracing on a per file basis.
  */
-#if defined(CONFIG_TRACE_BRANCH_PROFILING) && !defined(DISABLE_BRANCH_PROFILING)
+#if defined(CONFIG_TRACE_BRANCH_PROFILING) \
+    && !defined(DISABLE_BRANCH_PROFILING) && !defined(__CHECKER__)
 void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
 
 #define likely_notrace(x)	__builtin_expect(!!(x), 1)

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

* [tip:tracing/urgent] branch tracer: Fix for enabling branch profiling makes sparse unusable
  2009-04-05 14:20 [2.6.29] Fix for enabling branch profiling makes sparse unusable Bart Van Assche
@ 2009-04-07 19:30 ` Bart Van Assche
  2009-04-08 17:29 ` [2.6.29] " Bart Van Assche
  1 sibling, 0 replies; 4+ messages in thread
From: Bart Van Assche @ 2009-04-07 19:30 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, akpm, srostedt, tglx, bart.vanassche,
	mingo

Commit-ID:  d9ad8bc0ca823705413f75b50c442a88cc518b35
Gitweb:     http://git.kernel.org/tip/d9ad8bc0ca823705413f75b50c442a88cc518b35
Author:     Bart Van Assche <bart.vanassche@gmail.com>
AuthorDate: Sun, 5 Apr 2009 16:20:02 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 7 Apr 2009 17:07:40 +0200

branch tracer: Fix for enabling branch profiling makes sparse unusable

One of the changes between kernels 2.6.28 and 2.6.29 is that a branch profiler
has been added for if() statements. Unfortunately this patch makes the sparse
output unusable with CONFIG_TRACE_BRANCH_PROFILING=y: when branch profiling is
enabled, sparse prints so much false positives that the real issues are no
longer visible. This behavior can be reproduced as follows:
* enable CONFIG_TRACE_BRANCH_PROFILING, e.g. by running make allyesconfig or
  make allmodconfig.
* run make C=2

Result: a huge number of the following sparse warnings.
..
include/linux/cpumask.h:547:2: warning: symbol '______r' shadows an earlier one
include/linux/cpumask.h:547:2: originally declared here
..

The patch below fixes this by disabling branch profiling while analyzing the
kernel code with sparse.

See also:
* http://lkml.org/lkml/2008/11/21/18
* http://bugzilla.kernel.org/show_bug.cgi?id=12925

Signed-off-by: Bart Van Assche <bart.vanassche@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Steven Rostedt <srostedt@redhat.com>
LKML-Reference: <200904051620.02311.bart.vanassche@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/compiler.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 6faa7e5..8872ad6 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -76,7 +76,8 @@ struct ftrace_branch_data {
  * Note: DISABLE_BRANCH_PROFILING can be used by special lowlevel code
  * to disable branch tracing on a per file basis.
  */
-#if defined(CONFIG_TRACE_BRANCH_PROFILING) && !defined(DISABLE_BRANCH_PROFILING)
+#if defined(CONFIG_TRACE_BRANCH_PROFILING) \
+    && !defined(DISABLE_BRANCH_PROFILING) && !defined(__CHECKER__)
 void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
 
 #define likely_notrace(x)	__builtin_expect(!!(x), 1)

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

* Re: [2.6.29] Fix for enabling branch profiling makes sparse unusable
  2009-04-05 14:20 [2.6.29] Fix for enabling branch profiling makes sparse unusable Bart Van Assche
  2009-04-07 19:30 ` [tip:tracing/urgent] branch tracer: " Bart Van Assche
@ 2009-04-08 17:29 ` Bart Van Assche
  2009-04-08 17:58   ` Ingo Molnar
  1 sibling, 1 reply; 4+ messages in thread
From: Bart Van Assche @ 2009-04-08 17:29 UTC (permalink / raw)
  To: Steven Rostedt, Ingo Molnar; +Cc: Andrew Morton, LKML

On Sun, Apr 5, 2009 at 4:20 PM, Bart Van Assche
<bart.vanassche@gmail.com> wrote:
> One of the changes between kernels 2.6.28 and 2.6.29 is that a branch profiler
> has been added for if() statements. Unfortunately this patch makes the sparse
> output unusable with CONFIG_TRACE_BRANCH_PROFILING=y: when branch profiling is
> enabled, sparse prints so much false positives that the real issues are no
> longer visible. This behavior can be reproduced as follows:
> * enable CONFIG_TRACE_BRANCH_PROFILING, e.g. by running make allyesconfig or
>  make allmodconfig.
> * run make C=2
>
> Result: a huge number of the following sparse warnings.
> ...
> include/linux/cpumask.h:547:2: warning: symbol '______r' shadows an earlier one
> include/linux/cpumask.h:547:2: originally declared here
> ...
>
> The patch below fixes this by disabling branch profiling while analyzing the
> kernel code with sparse.
>
> See also:
> * http://lkml.org/lkml/2008/11/21/18
> * http://bugzilla.kernel.org/show_bug.cgi?id=12925
>
> Signed-off-by: Bart Van Assche <bart.vanassche@gmail.com>
>
> --- orig/linux-2.6.29/include/linux/compiler.h  2009-03-23 19:12:14.000000000 -0400
> +++ linux-2.6.29/include/linux/compiler.h       2009-03-24 08:46:46.000000000 -0400
> @@ -75,7 +75,8 @@ struct ftrace_branch_data {
>  * Note: DISABLE_BRANCH_PROFILING can be used by special lowlevel code
>  * to disable branch tracing on a per file basis.
>  */
> -#if defined(CONFIG_TRACE_BRANCH_PROFILING) && !defined(DISABLE_BRANCH_PROFILING)
> +#if defined(CONFIG_TRACE_BRANCH_PROFILING) \
> +    && !defined(DISABLE_BRANCH_PROFILING) && !defined(__CHECKER__)
>  void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
>
>  #define likely_notrace(x)      __builtin_expect(!!(x), 1)

(ping)

Hello,

Is there any chance the above patch will get included in the 2.6.30 kernel ?

Bart.

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

* Re: [2.6.29] Fix for enabling branch profiling makes sparse unusable
  2009-04-08 17:29 ` [2.6.29] " Bart Van Assche
@ 2009-04-08 17:58   ` Ingo Molnar
  0 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2009-04-08 17:58 UTC (permalink / raw)
  To: Bart Van Assche; +Cc: Steven Rostedt, Andrew Morton, LKML


* Bart Van Assche <bart.vanassche@gmail.com> wrote:

> On Sun, Apr 5, 2009 at 4:20 PM, Bart Van Assche
> <bart.vanassche@gmail.com> wrote:
> > One of the changes between kernels 2.6.28 and 2.6.29 is that a branch profiler
> > has been added for if() statements. Unfortunately this patch makes the sparse
> > output unusable with CONFIG_TRACE_BRANCH_PROFILING=y: when branch profiling is
> > enabled, sparse prints so much false positives that the real issues are no
> > longer visible. This behavior can be reproduced as follows:
> > * enable CONFIG_TRACE_BRANCH_PROFILING, e.g. by running make allyesconfig or
> >  make allmodconfig.
> > * run make C=2
> >
> > Result: a huge number of the following sparse warnings.
> > ...
> > include/linux/cpumask.h:547:2: warning: symbol '______r' shadows an earlier one
> > include/linux/cpumask.h:547:2: originally declared here
> > ...
> >
> > The patch below fixes this by disabling branch profiling while analyzing the
> > kernel code with sparse.
> >
> > See also:
> > * http://lkml.org/lkml/2008/11/21/18
> > * http://bugzilla.kernel.org/show_bug.cgi?id=12925
> >
> > Signed-off-by: Bart Van Assche <bart.vanassche@gmail.com>
> >
> > --- orig/linux-2.6.29/include/linux/compiler.h  2009-03-23 19:12:14.000000000 -0400
> > +++ linux-2.6.29/include/linux/compiler.h       2009-03-24 08:46:46.000000000 -0400
> > @@ -75,7 +75,8 @@ struct ftrace_branch_data {
> >  * Note: DISABLE_BRANCH_PROFILING can be used by special lowlevel code
> >  * to disable branch tracing on a per file basis.
> >  */
> > -#if defined(CONFIG_TRACE_BRANCH_PROFILING) && !defined(DISABLE_BRANCH_PROFILING)
> > +#if defined(CONFIG_TRACE_BRANCH_PROFILING) \
> > +    && !defined(DISABLE_BRANCH_PROFILING) && !defined(__CHECKER__)
> >  void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
> >
> >  #define likely_notrace(x)      __builtin_expect(!!(x), 1)
> 
> (ping)
> 
> Hello,
> 
> Is there any chance the above patch will get included in the 2.6.30 kernel ?

it already is part of .30-rc1, see 
d9ad8bc0ca823705413f75b50c442a88cc518b35.

	Ingo

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

end of thread, other threads:[~2009-04-08 18:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-05 14:20 [2.6.29] Fix for enabling branch profiling makes sparse unusable Bart Van Assche
2009-04-07 19:30 ` [tip:tracing/urgent] branch tracer: " Bart Van Assche
2009-04-08 17:29 ` [2.6.29] " Bart Van Assche
2009-04-08 17:58   ` Ingo Molnar

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