Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1504223

Re: [PATCH 1/3] tools lib traceevent: Add -O2 option to traceevent

From Steven Rostedt <rostedt@goodmis.org>
Newsgroups linux.kernel
Subject Re: [PATCH 1/3] tools lib traceevent: Add -O2 option to traceevent
Date 2016-10-19 20:30 +0200
Message-ID <su3MJ-4ZU-7@gated-at.bofh.it> (permalink)
References <stgVH-4zx-5@gated-at.bofh.it> <sts0O-3Pu-29@gated-at.bofh.it> <stEEF-3BE-25@gated-at.bofh.it> <su3a2-4te-37@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, 19 Oct 2016 14:48:45 -0300
Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> Em Tue, Oct 18, 2016 at 11:29:53AM -0400, Steven Rostedt escreveu:
> > On Tue, 18 Oct 2016 11:01:09 +0900
> > Namhyung Kim <namhyung@kernel.org> wrote:
> >   
> > > Hi Honggyu,
> > > 
> > > You need to CC relevant maintainers when you send patches to LKML.
> > > For the libtraceevent, they are Arnaldo and Steven.  You can use
> > > scripts/get_maintainer.pl for this job later.  In addition running
> > > scripts/checkpatch.pl before sending patches is a good habit.
> > > 
> > > Arnaldo and Steve,
> > > 
> > > This is from uftrace building libtraceevent with the optimization flag
> > > and we want to fix the upstream as well.
> > >   
> > 
> > Acked-by: Steven Rostedt <rostedt@goodmis.org>  
> 
> So right after applying this patch I get these new warnings, investigating...
> 
> [acme@jouet linux]$ gcc -v
> Using built-in specs.
> COLLECT_GCC=gcc
> COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/6.2.1/lto-wrapper
> Target: x86_64-redhat-linux
> Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --disable-libgcj --with-isl --enable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
> Thread model: posix
> gcc version 6.2.1 20160916 (Red Hat 6.2.1-2) (GCC) 
> [acme@jouet linux]$ 
> 
>   LD       /tmp/build/perf/plugin_mac80211-in.o
> kbuffer-parse.c: In function ‘__old_next_event’:
> kbuffer-parse.c:339:27: warning: ‘length’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>   kbuf->next = kbuf->index + length;
>                ~~~~~~~~~~~~^~~~~~~~
> kbuffer-parse.c:297:15: note: ‘length’ was declared here
>   unsigned int length;
>                ^~~~~~

Actually, that may be a bug.

>   CC       /tmp/build/perf/plugin_sched_switch.o
>   CC       /tmp/build/perf/run-command.o
> event-parse.c: In function ‘pevent_find_event_by_name’:
> event-parse.c:3513:21: warning: ‘event’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>   pevent->last_event = event;
>   ~~~~~~~~~~~~~~~~~~~^~~~~~~
>   CC       /tmp/build/perf/sigchain.o
>   LD       /tmp/build/perf/plugin_sched_switch-in.o
>   CC       /tmp/build/perf/plugin_function.o
> event-parse.c: In function ‘pevent_data_lat_fmt’:
> event-parse.c:5156:4: warning: ‘migrate_disable’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>     trace_seq_printf(s, "%d", migrate_disable);
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> event-parse.c:5163:4: warning: ‘lock_depth’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>     trace_seq_printf(s, "%d", lock_depth);

These two don't look like bugs because they need to have both
migrate_disable_exists and lock_depth_exists to be set, and when they
are those variables are. Funny it only complains about the one in the
trace_seq_printf() and not the compare before them.

ie. if (migrate_disable < 0)

which is checked before calling the trace_seq_printf().

>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> plugin_function.c: In function ‘function_handler’:
> plugin_function.c:133:6: warning: ‘index’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>   int index;
>       ^~~~~

Ah, this is a bug too.

>   CC       /tmp/build/perf/subcmd-config.o
>   GEN      perf-archive
>   LD       /tmp/build/perf/plugin_function-in.o
>   GEN      perf-with-kcore
>   CC       /tmp/build/perf/plugin_xen.o
> event-parse.c: In function ‘pevent_event_info’:
> event-parse.c:5003:7: warning: ‘len_arg’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>        trace_seq_printf(s, format, len_arg, (char)val);
>        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> event-parse.c:4846:6: note: ‘len_arg’ was declared here
>   int len_arg;

Again, the "len_as_arg" needs to be set for this to be an issue. We
could just initialize len_arg to zero to shut gcc up.

-- Steve

>       ^~~~~~~
>   MKDIR    /tmp/build/perf/util/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 1/3] tools lib traceevent: Add -O2 option to traceevent Honggyu Kim <hong.gyu.kim@lge.com> - 2016-10-17 16:20 +0200
  [PATCH 2/3] tools lib traceevent: Check the return value of asprintf Honggyu Kim <hong.gyu.kim@lge.com> - 2016-10-17 16:20 +0200
    Re: [PATCH 2/3] tools lib traceevent: Check the return value of  asprintf Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-10-18 20:00 +0200
      Re: [PATCH 2/3] tools lib traceevent: Check the return value of  asprintf Namhyung Kim <namhyung@kernel.org> - 2016-10-19 02:30 +0200
  [PATCH 3/3] tools lib traceevent: Fix to set uninitialized variables Honggyu Kim <hong.gyu.kim@lge.com> - 2016-10-17 16:20 +0200
    Re: [PATCH 3/3] tools lib traceevent: Fix to set uninitialized  variables Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-10-18 20:10 +0200
  Re: [PATCH 1/3] tools lib traceevent: Add -O2 option to traceevent Namhyung Kim <namhyung@kernel.org> - 2016-10-18 04:10 +0200
    Re: [PATCH 1/3] tools lib traceevent: Add -O2 option to traceevent Steven Rostedt <rostedt@goodmis.org> - 2016-10-18 17:40 +0200
      Re: [PATCH 1/3] tools lib traceevent: Add -O2 option to traceevent Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-10-19 19:50 +0200
        Re: [PATCH 1/3] tools lib traceevent: Add -O2 option to traceevent Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-10-19 20:10 +0200
          Re: [PATCH 1/3] tools lib traceevent: Add -O2 option to traceevent Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-10-19 20:10 +0200
            Re: [PATCH 1/3] tools lib traceevent: Add -O2 option to traceevent Steven Rostedt <rostedt@goodmis.org> - 2016-10-19 21:30 +0200
          Re: [PATCH 1/3] tools lib traceevent: Add -O2 option to traceevent Steven Rostedt <rostedt@goodmis.org> - 2016-10-19 21:30 +0200
        Re: [PATCH 1/3] tools lib traceevent: Add -O2 option to traceevent Steven Rostedt <rostedt@goodmis.org> - 2016-10-19 20:30 +0200

csiph-web