1. 18 Dec, 2018 25 commits
  2. 17 Dec, 2018 15 commits
    • Jiri Olsa's avatar
      perf trace: Add ordered processing · 028713aa
      Jiri Olsa authored
      Sort events to provide the precise outcome of ordered events, just like
      is done with 'perf report' and 'perf top'.
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Dmitry Levin <ldv@altlinux.org>
      Cc: Eugene Syromiatnikov <esyr@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Luis Cláudio Gonçalves <lclaudio@uudg.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/20181205160509.1168-9-jolsa@kernel.org
      [ split from a larger patch, added trace__ prefixes to new 'struct trace' methods ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      028713aa
    • Jiri Olsa's avatar
      perf ordered_events: Add first_time() method · 83356b3d
      Jiri Olsa authored
      To get the timestamp in the first event in the queue.
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Dmitry Levin <ldv@altlinux.org>
      Cc: Eugene Syromiatnikov <esyr@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Luis Cláudio Gonçalves <lclaudio@uudg.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: https://lkml.kernel.org/n/tip-appp27jw1ul8kgg872j43r5o@git.kernel.org
      [ split from a larger patch ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      83356b3d
    • Jiri Olsa's avatar
      perf trace: Move event delivery to a new deliver_event() function · 1f44b3e2
      Jiri Olsa authored
      Mov event delivery code to a new trace__deliver_event() function, so
      it's easier to add ordered delivery coming in the following patches.
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Dmitry Levin <ldv@altlinux.org>
      Cc: Eugene Syromiatnikov <esyr@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Luis Cláudio Gonçalves <lclaudio@uudg.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/20181205160509.1168-8-jolsa@kernel.org
      [ Add trace__ prefix to the deliver_event method ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1f44b3e2
    • Jiri Olsa's avatar
      perf ordered_events: Add ordered_events__flush_time interface · 68ca5d07
      Jiri Olsa authored
      Add OE_FLUSH__TIME flush type, to be able to flush only certain amount
      of the queue based on the provided timestamp. It will be used in the
      following patches.
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Dmitry Levin <ldv@altlinux.org>
      Cc: Eugene Syromiatnikov <esyr@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Luis Cláudio Gonçalves <lclaudio@uudg.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/20181205160509.1168-7-jolsa@kernel.org
      [ Fix the build on older systems such as centos 5 and 6 where 'time' shadows a global declaration ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      68ca5d07
    • Eugeniy Paltsev's avatar
      perf annotate: Introduce basic support for ARC · 6d99a79c
      Eugeniy Paltsev authored
      Introduce basic 'perf annotate' support for ARC to be able to use
      anotation via stdio interface.
      Signed-off-by: default avatarEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexey Brodkin <alexey.brodkin@synopsys.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: linux-snps-arc@lists.infradead.org
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Vineet Gupta <vineet.gupta1@synopsys.com>
      Link: http://lkml.kernel.org/r/20181204175118.25232-1-Eugeniy.Paltsev@synopsys.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6d99a79c
    • Sihyeon Jang's avatar
      perf config: Modify size factor of snprintf · 75c375c0
      Sihyeon Jang authored
      According to definition of snprintf, it gets size factor including
      null('\0') byte.  So '-1' is not neccessary. Also it will be helpful
      unfied style with other cases. (eg. builtin-script.c)
      Signed-off-by: default avatarSihyeon Jang <uneedsihyeon@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lkml.kernel.org/r/20181201154603.10093-1-uneedsihyeon@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      75c375c0
    • Alexey Budankov's avatar
      perf record: Fix memory leak on AIO objects deallocation · c8dd6ee5
      Alexey Budankov authored
      Sending a part which was missed between v12 and v13 of the patch set
      introducing AIO trace streaming for perf record mode.
      
      The part is essential to avoid memory leakage during deallocation of AIO
      related trace data buffers.
      Signed-off-by: default avatarAlexey Budankov <alexey.budankov@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/e5d3154e-1583-83bb-9527-28ddbc6dbf9d@linux.intel.com
      [ No need to test for NULL before calling zfree() ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c8dd6ee5
    • Andi Kleen's avatar
      perf vendor events intel: Fix Load_Miss_Real_Latency on SKL/SKX · 91b2b970
      Andi Kleen authored
      Fix incorrect event names for the Load_Miss_Real_Latency metric for
      Skylake and Skylake Server.
      
      Fixes https://github.com/andikleen/pmu-tools/issues/158
      
      Before:
      
        % perf stat -M Load_Miss_Real_Latency true
        event syntax error: '..ss.pending,mem_load_retired.l1_miss_ps,mem_load_retired.fb_hit_ps}:W'
                                          \___ parser error
      
         Usage: perf stat [<options>] [<command>]
      
            -M, --metrics <metric/metric group list>
                                  monitor specified metrics or metric groups (separated by ,)
      
      After:
      
        % perf stat -M Load_Miss_Real_Latency true
      
         Performance counter stats for 'true':
      
                   279,204      l1d_pend_miss.pending     #     14.0 Load_Miss_Real_Latency
                     4,784      mem_load_uops_retired.l1_miss
                    15,188      mem_load_uops_retired.hit_lfb
      
               0.000899640 seconds time elapsed
      Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Link: http://lkml.kernel.org/r/20181120050635.4215-1-andi@firstfloor.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      91b2b970
    • Arnaldo Carvalho de Melo's avatar
      perf parse-events: Fix unchecked usage of strncpy() · bd8d57fb
      Arnaldo Carvalho de Melo authored
      The strncpy() function may leave the destination string buffer
      unterminated, better use strlcpy() that we have a __weak fallback
      implementation for systems without it.
      
      This fixes this warning on an Alpine Linux Edge system with gcc 8.2:
      
        util/parse-events.c: In function 'print_symbol_events':
        util/parse-events.c:2465:4: error: 'strncpy' specified bound 100 equals destination size [-Werror=stringop-truncation]
            strncpy(name, syms->symbol, MAX_NAME_LEN);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        In function 'print_symbol_events.constprop',
            inlined from 'print_events' at util/parse-events.c:2508:2:
        util/parse-events.c:2465:4: error: 'strncpy' specified bound 100 equals destination size [-Werror=stringop-truncation]
            strncpy(name, syms->symbol, MAX_NAME_LEN);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        In function 'print_symbol_events.constprop',
            inlined from 'print_events' at util/parse-events.c:2511:2:
        util/parse-events.c:2465:4: error: 'strncpy' specified bound 100 equals destination size [-Werror=stringop-truncation]
            strncpy(name, syms->symbol, MAX_NAME_LEN);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        cc1: all warnings being treated as errors
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Fixes: 947b4ad1 ("perf list: Fix max event string size")
      Link: https://lkml.kernel.org/n/tip-b663e33bm6x8hrkie4uxh7u2@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      bd8d57fb
    • Arnaldo Carvalho de Melo's avatar
      perf probe: Fix unchecked usage of strncpy() · bef0b897
      Arnaldo Carvalho de Melo authored
      The strncpy() function may leave the destination string buffer
      unterminated, better use strlcpy() that we have a __weak fallback
      implementation for systems without it.
      
      In this case the 'target' buffer is coming from a list of build-ids that
      are expected to have a len of at most (SBUILD_ID_SIZE - 1) chars, so
      probably we're safe, but since we're using strncpy() here, use strlcpy()
      instead to provide the intended safety checking without the using the
      problematic strncpy() function.
      
      This fixes this warning on an Alpine Linux Edge system with gcc 8.2:
      
        util/probe-file.c: In function 'probe_cache__open.isra.5':
        util/probe-file.c:427:3: error: 'strncpy' specified bound 41 equals destination size [-Werror=stringop-truncation]
           strncpy(sbuildid, target, SBUILD_ID_SIZE);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        cc1: all warnings being treated as errors
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Fixes: 1f3736c9 ("perf probe: Show all cached probes")
      Link: https://lkml.kernel.org/n/tip-l7n8ggc9kl38qtdlouke5yp5@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      bef0b897
    • Arnaldo Carvalho de Melo's avatar
      perf ui helpline: Use strlcpy() as a shorter form of strncpy() + explicit set nul · 4d0f16d0
      Arnaldo Carvalho de Melo authored
      The strncpy() function may leave the destination string buffer
      unterminated, better use strlcpy() that we have a __weak fallback
      implementation for systems without it.
      
      In this case we are actually setting the null byte at the right place,
      but since we pass the buffer size as the limit to strncpy() and not
      it minus one, gcc ends up warning us about that, see below. So, lets
      just switch to the shorter form provided by strlcpy().
      
      This fixes this warning on an Alpine Linux Edge system with gcc 8.2:
      
        ui/tui/helpline.c: In function 'tui_helpline__push':
        ui/tui/helpline.c:27:2: error: 'strncpy' specified bound 512 equals destination size [-Werror=stringop-truncation]
          strncpy(ui_helpline__current, msg, sz)[sz - 1] = '\0';
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        cc1: all warnings being treated as errors
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Fixes: e6e90468 ("perf ui: Introduce struct ui_helpline")
      Link: https://lkml.kernel.org/n/tip-d1wz0hjjsh19xbalw69qpytj@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4d0f16d0
    • Arnaldo Carvalho de Melo's avatar
      perf svghelper: Fix unchecked usage of strncpy() · 2f530253
      Arnaldo Carvalho de Melo authored
      The strncpy() function may leave the destination string buffer
      unterminated, better use strlcpy() that we have a __weak fallback
      implementation for systems without it.
      
      In this specific case this would only happen if fgets() was buggy, as
      its man page states that it should read one less byte than the size of
      the destination buffer, so that it can put the nul byte at the end of
      it, so it would never copy 255 non-nul chars, as fgets reads into the
      orig buffer at most 254 non-nul chars and terminates it. But lets just
      switch to strlcpy to keep the original intent and silence the gcc 8.2
      warning.
      
      This fixes this warning on an Alpine Linux Edge system with gcc 8.2:
      
        In function 'cpu_model',
            inlined from 'svg_cpu_box' at util/svghelper.c:378:2:
        util/svghelper.c:337:5: error: 'strncpy' output may be truncated copying 255 bytes from a string of length 255 [-Werror=stringop-truncation]
             strncpy(cpu_m, &buf[13], 255);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Fixes: f48d55ce ("perf: Add a SVG helper library file")
      Link: https://lkml.kernel.org/n/tip-xzkoo0gyr56gej39ltivuh9g@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2f530253
    • Arnaldo Carvalho de Melo's avatar
      perf help: Remove needless use of strncpy() · b6313899
      Arnaldo Carvalho de Melo authored
      Since we make sure the destination buffer has at least strlen(orig) + 1,
      no need to do a strncpy(dest, orig, strlen(orig)), just use strcpy(dest,
      orig).
      
      This silences this gcc 8.2 warning on Alpine Linux:
      
        In function 'add_man_viewer',
            inlined from 'perf_help_config' at builtin-help.c:284:3:
        builtin-help.c:192:2: error: 'strncpy' output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation]
          strncpy((*p)->name, name, len);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        builtin-help.c: In function 'perf_help_config':
        builtin-help.c:187:15: note: length computed here
          size_t len = strlen(name);
                       ^~~~~~~~~~~~
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Fixes: 07800601 ("perf_counter tools: add in basic glue from Git")
      Link: https://lkml.kernel.org/n/tip-2f69l7drca427ob4km8i7kvo@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b6313899
    • Arnaldo Carvalho de Melo's avatar
      perf header: Fix unchecked usage of strncpy() · 5192bde7
      Arnaldo Carvalho de Melo authored
      The strncpy() function may leave the destination string buffer
      unterminated, better use strlcpy() that we have a __weak fallback
      implementation for systems without it.
      
      This fixes this warning on an Alpine Linux Edge system with gcc 8.2:
      
        util/header.c: In function 'perf_event__synthesize_event_update_name':
        util/header.c:3625:2: error: 'strncpy' output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation]
          strncpy(ev->data, evsel->name, len);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        util/header.c:3618:15: note: length computed here
          size_t len = strlen(evsel->name);
                       ^~~~~~~~~~~~~~~~~~~
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Fixes: a6e52817 ("perf tools: Add event_update event unit type")
      Link: https://lkml.kernel.org/n/tip-wycz66iy8dl2z3yifgqf894p@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5192bde7
    • Arnaldo Carvalho de Melo's avatar
      perf header: Fix unchecked usage of strncpy() · 75725880
      Arnaldo Carvalho de Melo authored
      The strncpy() function may leave the destination string buffer
      unterminated, better use strlcpy() that we have a __weak fallback
      implementation for systems without it.
      
      This fixes this warning on an Alpine Linux Edge system with gcc 8.2:
      
        util/header.c: In function 'perf_event__synthesize_event_update_unit':
        util/header.c:3586:2: error: 'strncpy' output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation]
          strncpy(ev->data, evsel->unit, size);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        util/header.c:3579:16: note: length computed here
          size_t size = strlen(evsel->unit);
                        ^~~~~~~~~~~~~~~~~~~
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Fixes: a6e52817 ("perf tools: Add event_update event unit type")
      Link: https://lkml.kernel.org/n/tip-fiikh5nay70bv4zskw2aa858@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      75725880