2014-06-30 08:57:17

by Christopher Li

[permalink] [raw]
Subject: [PATCH] sparse: Add CLOG option for saving warning

Currently sparse warning only output to stderr.
In the parallel build process, different source
file output is fixed together. It is hard to keep
track of the warning.

Add the CLOG=<logname> option in command line to
save the sparse warning into individual log file.

Typical usage:

make -j8 C=2 CLOG=<logname>

The log file is saved in the target directory as
.xxx.o.<logname>.sparse

By diffing between different log file, it is much
easier to analyze how the sparse change impact
the whole kernel build.

Signed-off-by: Christopher Li <[email protected]>


Chris


Attachments:
0001-sparse-Add-CLOG-option-for-saving-warning.patch (2.94 kB)

2014-07-04 07:48:03

by Christopher Li

[permalink] [raw]
Subject: Re: [PATCH] sparse: Add CLOG option for saving warning

On Mon, Jun 30, 2014 at 1:57 AM, Christopher Li <[email protected]> wrote:
>
> Add the CLOG=<logname> option in command line to
> save the sparse warning into individual log file.
>
> Typical usage:
>
> make -j8 C=2 CLOG=<logname>

Any feed back for this change? I want to clarify that this patch
is for the Linux kernel kbuild system, not sparse.

Thanks

Chris

2014-07-04 21:20:39

by Josh Triplett

[permalink] [raw]
Subject: Re: [PATCH] sparse: Add CLOG option for saving warning

On Fri, Jul 04, 2014 at 12:48:00AM -0700, Christopher Li wrote:
> On Mon, Jun 30, 2014 at 1:57 AM, Christopher Li <[email protected]> wrote:
> >
> > Add the CLOG=<logname> option in command line to
> > save the sparse warning into individual log file.
> >
> > Typical usage:
> >
> > make -j8 C=2 CLOG=<logname>
>
> Any feed back for this change? I want to clarify that this patch
> is for the Linux kernel kbuild system, not sparse.

Seems reasonable to me.

- Josh Triplett

2014-07-07 11:23:07

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH] sparse: Add CLOG option for saving warning

On Fri, Jul 04, 2014 at 12:48:00AM -0700, Christopher Li wrote:
> On Mon, Jun 30, 2014 at 1:57 AM, Christopher Li <[email protected]> wrote:
> >
> > Add the CLOG=<logname> option in command line to
> > save the sparse warning into individual log file.
> >
> > Typical usage:
> >
> > make -j8 C=2 CLOG=<logname>
>
> Any feed back for this change? I want to clarify that this patch
> is for the Linux kernel kbuild system, not sparse.
We do not need this kind of special handling of outputs from gcc.
For sparse you just do a run with C=2 then you have it.

In other words - this looks like overkill for somethign thas is achievable
with simpler means.

Sam

2014-07-08 05:49:37

by Christopher Li

[permalink] [raw]
Subject: Re: [PATCH] sparse: Add CLOG option for saving warning

On Mon, Jul 7, 2014 at 4:22 AM, Sam Ravnborg <[email protected]> wrote:

>> > Typical usage:
>> >
>> > make -j8 C=2 CLOG=<logname>
>>
> We do not need this kind of special handling of outputs from gcc.
> For sparse you just do a run with C=2 then you have it.
>
> In other words - this looks like overkill for somethign thas is achievable
> with simpler means.

I am aware of the C=2 flag. However, it does not provide consistent result
with "make -jn" flag.

Please consider that the gcc case is different. The kernel source is usually
clean of gcc warnings. If there is an error with gcc, the build process
stops. It is different with sparse. The primary goal of running sparse in
kernel build is to see those warning. Also sparse is a lot noisier than gcc
in the kernel build, so there is a need with logging which is not present
with gcc.

With this patch, here is a normal test procedure for me to see the impact of a
sparse change on kernel build:

$ make -j8 C=2 CLOG=std

# apply sparse change and make sparse

$ make -j8 C=2 CLOG=std-exp

$ find -name ".*.std.sparse" | while read -r file; do diff -du $file
${file/std.sparse/std-exp.
sparse} ; done > /tmp/sparse-diff


Without the CLOG= option, the only way to get similar diff
result is disable "-jn" option. Which make the test process painfully
slow.

I agree if I don't use "make -jn" flags, using C=2 is good enough.
However, what is your suggestion if I do want to use "make -jn" for
sparse checking in the previous mentioned usage case?

Thanks

Chris

2014-07-08 07:37:39

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH] sparse: Add CLOG option for saving warning

My kernel tree is full of drivers/foo.c.smatch and
drivers/foo.c.smatch-info files...

It would be nice to add it to .gitignore as well.

regards,
dan carpenter

2014-07-19 09:02:52

by Christopher Li

[permalink] [raw]
Subject: Re: [PATCH] sparse: Add CLOG option for saving warning

On Tue, Jul 8, 2014 at 12:37 AM, Dan Carpenter <[email protected]> wrote:
> My kernel tree is full of drivers/foo.c.smatch and
> drivers/foo.c.smatch-info files...
>
> It would be nice to add it to .gitignore as well.

Actually, ".*" is already in the .gitignore, there for the sparse log files
are covered.

Chris