1. 06 7月, 2020 2 次提交
  2. 03 7月, 2020 9 次提交
    • T
      tools lib traceevent: Add proper KBUFFER_TYPE_TIME_STAMP handling · 2160d6c8
      Tom Zanussi 提交于
      Kernel commit dc4e2801 (ring-buffer: Redefine the unimplemented
      RINGBUF_TYPE_TIME_STAMP) changed the way the ring buffer timestamps work
      - after that commit the previously unimplemented RINGBUF_TYPE_TIME_STAMP
      type causes the time delta to be used as a timestamp rather than a delta
      to be added to the timestamp.
      
      The trace-cmd code didn't get updated to handle this, so misinterprets
      the event data for this case, which causes a cascade of errors,
      including trace-report not being able to identify synthetic (or any
      other) events generated by the histogram code (which uses TIME_STAMP
      mode).  For example, the following triggers along with the trace-cmd
      shown cause an UNKNOWN_EVENT error and trace-cmd report crash:
      
        # echo 'wakeup_latency  u64 lat pid_t pid char comm[16]' > /sys/kernel/debug/tracing/synthetic_events
      
        # echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="ping"' > /sys/kernel/debug/tracing/events/sched/sched_wakeup/trigger
        # echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0:onmatch(sched.sched_wakeup).trace(wakeup_latency,$wakeup_lat,next_pid,next_comm) if next_comm=="ping"' > /sys/kernel/debug/tracing/events/sched/sched_switch/trigger
        # echo 'hist:keys=comm,pid,lat:wakeup_lat=lat:sort=lat' > /sys/kernel/debug/tracing/events/synthetic/wakeup_latency/trigger
      
        # trace-cmd record -e wakeup_latency -e sched_wakeup -f comm==\"ping\" ping localhost -c 5
      
        # trace-cmd report
        CPU 0 is empty
        CPU 1 is empty
        CPU 2 is empty
        CPU 3 is empty
        CPU 5 is empty
        CPU 6 is empty
        CPU 7 is empty
        cpus=8
          ug! no event found for type 0
        [UNKNOWN TYPE 0]
          ug! no event found for type 11520
        Segmentation fault (core dumped)
      
      After this patch we get the correct interpretation and the events are
      shown properly:
      
        # trace-cmd report
        CPU 0 is empty
        CPU 1 is empty
        CPU 2 is empty
        CPU 3 is empty
        CPU 5 is empty
        CPU 6 is empty
        CPU 7 is empty
        cpus=8
                <idle>-0     [004] 23284.341392: sched_wakeup:         ping:12031 [120] success=1 CPU:004
                <idle>-0     [004] 23284.341464: wakeup_latency:       lat=58, pid=12031, comm=ping
                <idle>-0     [004] 23285.365303: sched_wakeup:         ping:12031 [120] success=1 CPU:004
                <idle>-0     [004] 23285.365382: wakeup_latency:       lat=64, pid=12031, comm=ping
                <idle>-0     [004] 23286.389290: sched_wakeup:         ping:12031 [120] success=1 CPU:004
                <idle>-0     [004] 23286.389378: wakeup_latency:       lat=72, pid=12031, comm=ping
                <idle>-0     [004] 23287.413213: sched_wakeup:         ping:12031 [120] success=1 CPU:004
                <idle>-0     [004] 23287.413291: wakeup_latency:       lat=64, pid=12031, comm=ping
      
      Link: http://lkml.kernel.org/r/1567628224.13841.4.camel@kernel.org
      Link: http://lore.kernel.org/linux-trace-devel/20200625100516.365338-3-tz.stoyanov@gmail.comSigned-off-by: NTom Zanussi <zanussi@kernel.org>
      [ Ported from trace-cmd.git ]
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: linux-trace-devel@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20200702185703.785094515@goodmis.orgSigned-off-by: NTzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
      Signed-off-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      2160d6c8
    • S
      tools lib traceevent: Add API to read time information from kbuffer · 374855c5
      Steven Rostedt (Red Hat) 提交于
      Add the functions kbuffer_subbuf_timestamp() and kbuffer_ptr_delta() to
      get the timing data stored in the ring buffer that is used to produced
      the time stamps of the records.
      
      This is useful for tools like trace-cmd to be able to display the
      content of the read data to understand why the records show the time
      stamps that they do.
      
      Link: http://lore.kernel.org/linux-trace-devel/20200625100516.365338-2-tz.stoyanov@gmail.comSigned-off-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
      [ Ported from trace-cmd.git ]
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: linux-trace-devel@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20200702185703.619656282@goodmis.orgSigned-off-by: NTzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      374855c5
    • A
      perf scripts python: exported-sql-viewer.py: Fix time chart call tree · f18d5cf8
      Adrian Hunter 提交于
      Using Python version 3.8.2 and PySide2 version 5.14.0, time chart call tree
      would not expand the tree to the result. Fix by using setExpanded().
      
      Example:
      
        $ perf record -e intel_pt//u uname
        Linux
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.034 MB perf.data ]
        $ perf script --itrace=bep -s ~/libexec/perf-core/scripts/python/export-to-sqlite.py perf.data.db branches calls
        2020-06-26 15:32:14.928997 Creating database ...
        2020-06-26 15:32:14.933971 Writing records...
        2020-06-26 15:32:15.535251 Adding indexes
        2020-06-26 15:32:15.542993 Dropping unused tables
        2020-06-26 15:32:15.549716 Done
        $ python3 ~/libexec/perf-core/scripts/python/exported-sql-viewer.py perf.data.db
      
        Select: Charts -> Time chart by CPU
        Move mouse over middle of chart
        Right-click and select Show Call Tree
      
      Before: displays Call Tree but not expanded to selected time
      After: displays Call Tree expanded to selected time
      
      Fixes: e69d5df7 ("perf scripts python: exported-sql-viewer.py: Add ability for Call tree to open at a specified task and time")
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: stable@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20200629091955.17090-7-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f18d5cf8
    • A
      perf scripts python: exported-sql-viewer.py: Fix zero id in call tree 'Find' result · 031c8d5e
      Adrian Hunter 提交于
      Using ctrl-F ('Find') would not find 'unknown' because it matches id
      zero.  Fix by excluding id zero from selection.
      
      Example:
      
         $ perf record -e intel_pt//u uname
         Linux
         [ perf record: Woken up 1 times to write data ]
         [ perf record: Captured and wrote 0.034 MB perf.data ]
         $ perf script --itrace=bep -s ~/libexec/perf-core/scripts/python/export-to-sqlite.py perf.data.db branches calls
         2020-06-26 15:32:14.928997 Creating database ...
         2020-06-26 15:32:14.933971 Writing records...
         2020-06-26 15:32:15.535251 Adding indexes
         2020-06-26 15:32:15.542993 Dropping unused tables
         2020-06-26 15:32:15.549716 Done
         $ python3 ~/libexec/perf-core/scripts/python/exported-sql-viewer.py perf.data.db
      
         Select: Reports -> Call Tree
         Press: Ctrl-F
         Enter: unknown
         Press: Enter
      
      Before: displays 'unknown' not found
      After: tree is expanded to line showing 'unknown'
      
      Fixes: ae8b887c ("perf scripts python: exported-sql-viewer.py: Add call tree")
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: stable@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20200629091955.17090-6-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      031c8d5e
    • A
      perf scripts python: exported-sql-viewer.py: Fix zero id in call graph 'Find' result · 7ff520b0
      Adrian Hunter 提交于
      Using ctrl-F ('Find') would not find 'unknown' because it matches id zero.
      Fix by excluding id zero from selection.
      
      Example:
      
        $ perf record -e intel_pt//u uname
        Linux
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.034 MB perf.data ]
        $ perf script --itrace=bep -s ~/libexec/perf-core/scripts/python/export-to-sqlite.py perf.data.db branches calls
        2020-06-26 15:32:14.928997 Creating database ...
        2020-06-26 15:32:14.933971 Writing records...
        2020-06-26 15:32:15.535251 Adding indexes
        2020-06-26 15:32:15.542993 Dropping unused tables
        2020-06-26 15:32:15.549716 Done
        $ python3 ~/libexec/perf-core/scripts/python/exported-sql-viewer.py perf.data.db
      
        Select: Reports -> Context-Sensitive Call Graph
        Press: Ctrl-F
        Enter: unknown
        Press: Enter
      
      Before: gets stuck
      After: tree is expanded to line showing 'unknown'
      
      Fixes: 254c0d82 ("perf scripts python: exported-sql-viewer.py: Factor out CallGraphModelBase")
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: stable@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20200629091955.17090-5-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      7ff520b0
    • A
      perf scripts python: exported-sql-viewer.py: Fix unexpanded 'Find' result · 3a3cf7c5
      Adrian Hunter 提交于
      Using Python version 3.8.2 and PySide2 version 5.14.0, ctrl-F ('Find')
      would not expand the tree to the result. Fix by using setExpanded().
      
      Example:
      
        $ perf record -e intel_pt//u uname
        Linux
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.034 MB perf.data ]
        $ perf script --itrace=bep -s ~/libexec/perf-core/scripts/python/export-to-sqlite.py perf.data.db branches calls
        2020-06-26 15:32:14.928997 Creating database ...
        2020-06-26 15:32:14.933971 Writing records...
        2020-06-26 15:32:15.535251 Adding indexes
        2020-06-26 15:32:15.542993 Dropping unused tables
        2020-06-26 15:32:15.549716 Done
        $ python3 ~/libexec/perf-core/scripts/python/exported-sql-viewer.py perf.data.db
      
        Select: Reports -> Context-Sensitive Call Graph    or     Reports -> Call Tree
        Press: Ctrl-F
        Enter: main
        Press: Enter
      
      Before: line showing 'main' does not display
      
      After: tree is expanded to line showing 'main'
      
      Fixes: ebd70c7d ("perf scripts python: exported-sql-viewer.py: Add ability to find symbols in the call-graph")
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: stable@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20200629091955.17090-4-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3a3cf7c5
    • A
      perf record: Fix duplicated sideband events with Intel PT system wide tracing · 442ad225
      Adrian Hunter 提交于
      Commit 0a892c1c ("perf record: Add dummy event during system wide
      synthesis") reveals an issue with Intel PT system wide tracing.
      Specifically that Intel PT already adds a dummy tracking event, and it
      is not the first event.  Adding another dummy tracking event causes
      duplicated sideband events.  Fix by checking for an existing dummy
      tracking event first.
      
      Example showing duplicated switch events:
      
       Before:
      
         # perf record -a -e intel_pt//u uname
         Linux
         [ perf record: Woken up 1 times to write data ]
         [ perf record: Captured and wrote 0.895 MB perf.data ]
         # perf script --no-itrace --show-switch-events | head
                  swapper     0 [007]  6390.516222: PERF_RECORD_SWITCH_CPU_WIDE OUT preempt  next pid/tid:    11/11
                  swapper     0 [007]  6390.516222: PERF_RECORD_SWITCH_CPU_WIDE OUT preempt  next pid/tid:    11/11
                rcu_sched    11 [007]  6390.516223: PERF_RECORD_SWITCH_CPU_WIDE IN           prev pid/tid:     0/0
                rcu_sched    11 [007]  6390.516224: PERF_RECORD_SWITCH_CPU_WIDE IN           prev pid/tid:     0/0
                rcu_sched    11 [007]  6390.516227: PERF_RECORD_SWITCH_CPU_WIDE OUT          next pid/tid:     0/0
                rcu_sched    11 [007]  6390.516227: PERF_RECORD_SWITCH_CPU_WIDE OUT          next pid/tid:     0/0
                  swapper     0 [007]  6390.516228: PERF_RECORD_SWITCH_CPU_WIDE IN           prev pid/tid:    11/11
                  swapper     0 [007]  6390.516228: PERF_RECORD_SWITCH_CPU_WIDE IN           prev pid/tid:    11/11
                  swapper     0 [002]  6390.516415: PERF_RECORD_SWITCH_CPU_WIDE OUT preempt  next pid/tid:  5556/5559
                  swapper     0 [002]  6390.516416: PERF_RECORD_SWITCH_CPU_WIDE OUT preempt  next pid/tid:  5556/5559
      
       After:
      
         # perf record -a -e intel_pt//u uname
         Linux
         [ perf record: Woken up 1 times to write data ]
         [ perf record: Captured and wrote 0.868 MB perf.data ]
         #  perf script --no-itrace --show-switch-events | head
                  swapper     0 [005]  6450.567013: PERF_RECORD_SWITCH_CPU_WIDE OUT preempt  next pid/tid:  7179/7181
                     perf  7181 [005]  6450.567014: PERF_RECORD_SWITCH_CPU_WIDE IN           prev pid/tid:     0/0
                     perf  7181 [005]  6450.567028: PERF_RECORD_SWITCH_CPU_WIDE OUT          next pid/tid:     0/0
                  swapper     0 [005]  6450.567029: PERF_RECORD_SWITCH_CPU_WIDE IN           prev pid/tid:  7179/7181
                  swapper     0 [005]  6450.571699: PERF_RECORD_SWITCH_CPU_WIDE OUT preempt  next pid/tid:    11/11
                rcu_sched    11 [005]  6450.571700: PERF_RECORD_SWITCH_CPU_WIDE IN           prev pid/tid:     0/0
                rcu_sched    11 [005]  6450.571702: PERF_RECORD_SWITCH_CPU_WIDE OUT          next pid/tid:     0/0
                  swapper     0 [005]  6450.571703: PERF_RECORD_SWITCH_CPU_WIDE IN           prev pid/tid:    11/11
                  swapper     0 [005]  6450.579703: PERF_RECORD_SWITCH_CPU_WIDE OUT preempt  next pid/tid:    11/11
                rcu_sched    11 [005]  6450.579704: PERF_RECORD_SWITCH_CPU_WIDE IN           prev pid/tid:     0/0
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lore.kernel.org/lkml/20200629091955.17090-3-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      442ad225
    • A
      perf scripts python: export-to-postgresql.py: Fix struct.pack() int argument · 640432e6
      Adrian Hunter 提交于
      Python 3.8 is requiring that arguments being packed as integers are also
      integers.  Add int() accordingly.
      
       Before:
      
         $ perf record -e intel_pt//u uname
         $ perf script --itrace=bep -s ~/libexec/perf-core/scripts/python/export-to-postgresql.py perf_data_db branches calls
         2020-06-25 16:09:10.547256 Creating database...
         2020-06-25 16:09:10.733185 Writing to intermediate files...
         Traceback (most recent call last):
           File "/home/ahunter/libexec/perf-core/scripts/python/export-to-postgresql.py", line 1106, in synth_data
             cbr(id, raw_buf)
           File "/home/ahunter/libexec/perf-core/scripts/python/export-to-postgresql.py", line 1058, in cbr
             value = struct.pack("!hiqiiiiii", 4, 8, id, 4, cbr, 4, MHz, 4, percent)
         struct.error: required argument is not an integer
         Fatal Python error: problem in Python trace event handler
         Python runtime state: initialized
      
         Current thread 0x00007f35d3695780 (most recent call first):
         <no Python frame>
         Aborted (core dumped)
      
       After:
      
         $ dropdb perf_data_db
         $ rm -rf perf_data_db-perf-data
         $ perf script --itrace=bep -s ~/libexec/perf-core/scripts/python/export-to-postgresql.py perf_data_db branches calls
         2020-06-25 16:09:40.990267 Creating database...
         2020-06-25 16:09:41.207009 Writing to intermediate files...
         2020-06-25 16:09:41.270915 Copying to database...
         2020-06-25 16:09:41.382030 Removing intermediate files...
         2020-06-25 16:09:41.384630 Adding primary keys
         2020-06-25 16:09:41.541894 Adding foreign keys
         2020-06-25 16:09:41.677044 Dropping unused tables
         2020-06-25 16:09:41.703761 Done
      
      Fixes: aba44287 ("perf scripts python: export-to-postgresql.py: Export Intel PT power and ptwrite events")
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: stable@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20200629091955.17090-2-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      640432e6
    • A
      tools arch: Update arch/x86/lib/memcpy_64.S copy used in 'perf bench mem memcpy' · eb25de27
      Arnaldo Carvalho de Melo 提交于
      To bring in the change made in this cset:
      
        e3a9e681 ("x86/entry: Fixup bad_iret vs noinstr")
      
      This doesn't cause any functional changes to tooling, just a rebuild.
      
      Addresses this perf build warning:
      
        Warning: Kernel ABI header at 'tools/arch/x86/lib/memcpy_64.S' differs from latest version at 'arch/x86/lib/memcpy_64.S'
        diff -u tools/arch/x86/lib/memcpy_64.S arch/x86/lib/memcpy_64.S
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      eb25de27
  3. 30 6月, 2020 3 次提交
  4. 27 6月, 2020 3 次提交
  5. 26 6月, 2020 3 次提交
    • H
      selftests/powerpc: Fix build failure in ebb tests · 896066aa
      Harish 提交于
      We use OUTPUT directory as TMPOUT for checking no-pie option.
      
      Since commit f2f02ebd ("kbuild: improve cc-option to clean up all
      temporary files") when building powerpc/ from selftests directory, the
      OUTPUT directory points to powerpc/pmu/ebb/ and gets removed when
      checking for -no-pie option in try-run routine, subsequently build
      fails with the following:
      
        $ make -C powerpc
        ...
        TARGET=ebb; BUILD_TARGET=$OUTPUT/$TARGET; mkdir -p $BUILD_TARGET; make OUTPUT=$BUILD_TARGET -k -C $TARGET all
        make[2]: Entering directory '/home/linux-master/tools/testing/selftests/powerpc/pmu/ebb'
        make[2]: *** No rule to make target 'Makefile'.
        make[2]: Failed to remake makefile 'Makefile'.
        make[2]: *** No rule to make target 'ebb.c', needed by '/home/linux-master/tools/testing/selftests/powerpc/pmu/ebb/reg_access_test'.
        make[2]: *** No rule to make target 'ebb_handler.S', needed by '/home/linux-master/tools/testing/selftests/powerpc/pmu/ebb/reg_access_test'.
        make[2]: *** No rule to make target 'trace.c', needed by '/home/linux-master/tools/testing/selftests/powerpc/pmu/ebb/reg_access_test'.
        make[2]: *** No rule to make target 'busy_loop.S', needed by '/home/linux-master/tools/testing/selftests/powerpc/pmu/ebb/reg_access_test'.
        make[2]: Target 'all' not remade because of errors.
      
      Fix this by adding a suffix to the OUTPUT directory so that the
      failure is avoided.
      
      Fixes: 9686813f ("selftests/powerpc: Fix try-run when source tree is not writable")
      Signed-off-by: NHarish <harish@linux.ibm.com>
      [mpe: Mention that commit that triggered the breakage]
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20200625165721.264904-1-harish@linux.ibm.com
      896066aa
    • B
      tc-testing: avoid action cookies with odd length. · b6186d41
      Briana Oursler 提交于
      Update odd length cookie hexstrings in csum.json, tunnel_key.json and
      bpf.json to be even length to comply with check enforced in commit
      0149dabf2a1b ("tc: m_actions: check cookie hexstring len") in iproute2.
      Signed-off-by: NBriana Oursler <briana.oursler@gmail.com>
      Reviewed-by: NStefano Brivio <sbrivio@redhat.com>
      Reviewed-by: NDavide Caratti <dcaratti@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b6186d41
    • N
      bpf: tcp: bpf_cubic: fix spurious HYSTART_DELAY exit upon drop in min RTT · 7d21d54d
      Neal Cardwell 提交于
      Apply the fix from:
       "tcp_cubic: fix spurious HYSTART_DELAY exit upon drop in min RTT"
      to the BPF implementation of TCP CUBIC congestion control.
      
      Repeating the commit description here for completeness:
      
      Mirja Kuehlewind reported a bug in Linux TCP CUBIC Hystart, where
      Hystart HYSTART_DELAY mechanism can exit Slow Start spuriously on an
      ACK when the minimum rtt of a connection goes down. From inspection it
      is clear from the existing code that this could happen in an example
      like the following:
      
      o The first 8 RTT samples in a round trip are 150ms, resulting in a
        curr_rtt of 150ms and a delay_min of 150ms.
      
      o The 9th RTT sample is 100ms. The curr_rtt does not change after the
        first 8 samples, so curr_rtt remains 150ms. But delay_min can be
        lowered at any time, so delay_min falls to 100ms. The code executes
        the HYSTART_DELAY comparison between curr_rtt of 150ms and delay_min
        of 100ms, and the curr_rtt is declared far enough above delay_min to
        force a (spurious) exit of Slow start.
      
      The fix here is simple: allow every RTT sample in a round trip to
      lower the curr_rtt.
      
      Fixes: 6de4a9c4 ("bpf: tcp: Add bpf_cubic example")
      Reported-by: NMirja Kuehlewind <mirja.kuehlewind@ericsson.com>
      Signed-off-by: NNeal Cardwell <ncardwell@google.com>
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Acked-by: NSoheil Hassas Yeganeh <soheil@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7d21d54d
  6. 25 6月, 2020 2 次提交
  7. 24 6月, 2020 2 次提交
  8. 23 6月, 2020 8 次提交
  9. 21 6月, 2020 1 次提交
  10. 20 6月, 2020 1 次提交
  11. 18 6月, 2020 6 次提交
    • P
      objtool: Fix noinstr vs KCOV · 0f1441b4
      Peter Zijlstra 提交于
      Since many compilers cannot disable KCOV with a function attribute,
      help it to NOP out any __sanitizer_cov_*() calls injected in noinstr
      code.
      
      This turns:
      
      12:   e8 00 00 00 00          callq  17 <lockdep_hardirqs_on+0x17>
      		13: R_X86_64_PLT32      __sanitizer_cov_trace_pc-0x4
      
      into:
      
      12:   0f 1f 44 00 00          nopl   0x0(%rax,%rax,1)
      		13: R_X86_64_NONE      __sanitizer_cov_trace_pc-0x4
      
      Just like recordmcount does.
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: NDmitry Vyukov <dvyukov@google.com>
      0f1441b4
    • P
      objtool: Provide elf_write_{insn,reloc}() · fdabdd0b
      Peter Zijlstra 提交于
      This provides infrastructure to rewrite instructions; this is
      immediately useful for helping out with KCOV-vs-noinstr, but will
      also come in handy for a bunch of variable sized jump-label patches
      that are still on ice.
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      fdabdd0b
    • P
      objtool: Clean up elf_write() condition · 2b10be23
      Peter Zijlstra 提交于
      With there being multiple ways to change the ELF data, let's more
      concisely track modification.
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      2b10be23
    • T
      perf build: Fix error message when asking for -fsanitize=address without required libraries · 6a1515c9
      Tiezhu Yang 提交于
      When build perf with ASan or UBSan, if libasan or libubsan can not find,
      the feature-glibc is 0 and there exists the following error log which is
      wrong, because we can find gnu/libc-version.h in /usr/include,
      glibc-devel is also installed.
      
        [yangtiezhu@linux perf]$ make DEBUG=1 EXTRA_CFLAGS='-fno-omit-frame-pointer -fsanitize=address'
          BUILD:   Doing 'make -j4' parallel build
          HOSTCC   fixdep.o
          HOSTLD   fixdep-in.o
          LINK     fixdep
        <stdin>:1:0: warning: -fsanitize=address and -fsanitize=kernel-address are not supported for this target
        <stdin>:1:0: warning: -fsanitize=address not supported for this target
      
        Auto-detecting system features:
        ...                         dwarf: [ OFF ]
        ...            dwarf_getlocations: [ OFF ]
        ...                         glibc: [ OFF ]
        ...                          gtk2: [ OFF ]
        ...                      libaudit: [ OFF ]
        ...                        libbfd: [ OFF ]
        ...                        libcap: [ OFF ]
        ...                        libelf: [ OFF ]
        ...                       libnuma: [ OFF ]
        ...        numa_num_possible_cpus: [ OFF ]
        ...                       libperl: [ OFF ]
        ...                     libpython: [ OFF ]
        ...                     libcrypto: [ OFF ]
        ...                     libunwind: [ OFF ]
        ...            libdw-dwarf-unwind: [ OFF ]
        ...                          zlib: [ OFF ]
        ...                          lzma: [ OFF ]
        ...                     get_cpuid: [ OFF ]
        ...                           bpf: [ OFF ]
        ...                        libaio: [ OFF ]
        ...                       libzstd: [ OFF ]
        ...        disassembler-four-args: [ OFF ]
      
        Makefile.config:393: *** No gnu/libc-version.h found, please install glibc-dev[el].  Stop.
        Makefile.perf:224: recipe for target 'sub-make' failed
        make[1]: *** [sub-make] Error 2
        Makefile:69: recipe for target 'all' failed
        make: *** [all] Error 2
        [yangtiezhu@linux perf]$ ls /usr/include/gnu/libc-version.h
        /usr/include/gnu/libc-version.h
      
      After install libasan and libubsan, the feature-glibc is 1 and the build
      process is success, so the cause is related with libasan or libubsan, we
      should check them and print an error log to reflect the reality.
      
      Committer testing:
      
        $ rm -rf /tmp/build/perf ; mkdir -p /tmp/build/perf
        $ make DEBUG=1 EXTRA_CFLAGS='-fno-omit-frame-pointer -fsanitize=address' O=/tmp/build/perf -C tools/perf/ install-bin
        make: Entering directory '/home/acme/git/perf/tools/perf'
          BUILD:   Doing 'make -j12' parallel build
          HOSTCC   /tmp/build/perf/fixdep.o
          HOSTLD   /tmp/build/perf/fixdep-in.o
          LINK     /tmp/build/perf/fixdep
      
        Auto-detecting system features:
        ...                         dwarf: [ OFF ]
        ...            dwarf_getlocations: [ OFF ]
        ...                         glibc: [ OFF ]
        ...                          gtk2: [ OFF ]
        ...                        libbfd: [ OFF ]
        ...                        libcap: [ OFF ]
        ...                        libelf: [ OFF ]
        ...                       libnuma: [ OFF ]
        ...        numa_num_possible_cpus: [ OFF ]
        ...                       libperl: [ OFF ]
        ...                     libpython: [ OFF ]
        ...                     libcrypto: [ OFF ]
        ...                     libunwind: [ OFF ]
        ...            libdw-dwarf-unwind: [ OFF ]
        ...                          zlib: [ OFF ]
        ...                          lzma: [ OFF ]
        ...                     get_cpuid: [ OFF ]
        ...                           bpf: [ OFF ]
        ...                        libaio: [ OFF ]
        ...                       libzstd: [ OFF ]
        ...        disassembler-four-args: [ OFF ]
      
        Makefile.config:401: *** No libasan found, please install libasan.  Stop.
        make[1]: *** [Makefile.perf:231: sub-make] Error 2
        make: *** [Makefile:70: all] Error 2
        make: Leaving directory '/home/acme/git/perf/tools/perf'
        $
        $
        $ sudo dnf install libasan
        <SNIP>
        Installed:
          libasan-9.3.1-2.fc31.x86_64
        $
        $
        $ make DEBUG=1 EXTRA_CFLAGS='-fno-omit-frame-pointer -fsanitize=address' O=/tmp/build/perf -C tools/perf/ install-bin
        make: Entering directory '/home/acme/git/perf/tools/perf'
          BUILD:   Doing 'make -j12' parallel build
      
        Auto-detecting system features:
        ...                         dwarf: [ on  ]
        ...            dwarf_getlocations: [ on  ]
        ...                         glibc: [ on  ]
        ...                          gtk2: [ on  ]
        ...                        libbfd: [ on  ]
        ...                        libcap: [ on  ]
        ...                        libelf: [ on  ]
        ...                       libnuma: [ on  ]
        ...        numa_num_possible_cpus: [ on  ]
        ...                       libperl: [ on  ]
        ...                     libpython: [ on  ]
        ...                     libcrypto: [ on  ]
        ...                     libunwind: [ on  ]
        ...            libdw-dwarf-unwind: [ on  ]
        ...                          zlib: [ on  ]
        ...                          lzma: [ on  ]
        ...                     get_cpuid: [ on  ]
        ...                           bpf: [ on  ]
        ...                        libaio: [ on  ]
        ...                       libzstd: [ on  ]
        ...        disassembler-four-args: [ on  ]
         <SNIP>
          CC       /tmp/build/perf/util/pmu-flex.o
          FLEX     /tmp/build/perf/util/expr-flex.c
          CC       /tmp/build/perf/util/expr-bison.o
          CC       /tmp/build/perf/util/expr.o
          CC       /tmp/build/perf/util/expr-flex.o
          CC       /tmp/build/perf/util/parse-events-flex.o
          CC       /tmp/build/perf/util/parse-events.o
          LD       /tmp/build/perf/util/intel-pt-decoder/perf-in.o
          LD       /tmp/build/perf/util/perf-in.o
          LD       /tmp/build/perf/perf-in.o
          LINK     /tmp/build/perf/perf
        <SNIP>
          INSTALL  python-scripts
          INSTALL  perf_completion-script
          INSTALL  perf-tip
        make: Leaving directory '/home/acme/git/perf/tools/perf'
        $ ldd ~/bin/perf | grep asan
        	libasan.so.5 => /lib64/libasan.so.5 (0x00007f0904164000)
        $
      
      And if we rebuild without -fsanitize-address:
      
        $ rm -rf /tmp/build/perf ; mkdir -p /tmp/build/perf
        $ make O=/tmp/build/perf -C tools/perf/ install-bin
        make: Entering directory '/home/acme/git/perf/tools/perf'
          BUILD:   Doing 'make -j12' parallel build
          HOSTCC   /tmp/build/perf/fixdep.o
          HOSTLD   /tmp/build/perf/fixdep-in.o
          LINK     /tmp/build/perf/fixdep
      
        Auto-detecting system features:
        ...                         dwarf: [ on  ]
        ...            dwarf_getlocations: [ on  ]
        ...                         glibc: [ on  ]
        ...                          gtk2: [ on  ]
        ...                        libbfd: [ on  ]
        ...                        libcap: [ on  ]
        ...                        libelf: [ on  ]
        ...                       libnuma: [ on  ]
        ...        numa_num_possible_cpus: [ on  ]
        ...                       libperl: [ on  ]
        ...                     libpython: [ on  ]
        ...                     libcrypto: [ on  ]
        ...                     libunwind: [ on  ]
        ...            libdw-dwarf-unwind: [ on  ]
        ...                          zlib: [ on  ]
        ...                          lzma: [ on  ]
        ...                     get_cpuid: [ on  ]
        ...                           bpf: [ on  ]
        ...                        libaio: [ on  ]
        ...                       libzstd: [ on  ]
        ...        disassembler-four-args: [ on  ]
      
          GEN      /tmp/build/perf/common-cmds.h
          CC       /tmp/build/perf/exec-cmd.o
        <SNIP>
          INSTALL  perf_completion-script
          INSTALL  perf-tip
        make: Leaving directory '/home/acme/git/perf/tools/perf'
        $ ldd ~/bin/perf | grep asan
        $
      Signed-off-by: NTiezhu Yang <yangtiezhu@loongson.cn>
      Acked-by: NJiri Olsa <jolsa@redhat.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: tiezhu yang <yangtiezhu@loongson.cn>
      Cc: xuefeng li <lixuefeng@loongson.cn>
      Link: http://lore.kernel.org/lkml/1592445961-28044-1-git-send-email-yangtiezhu@loongson.cnSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      6a1515c9
    • S
      tools lib traceevent: Add handler for __builtin_expect() · 1b20d949
      Steven Rostedt (VMware) 提交于
      In order to move pointer checks like IS_ERR_VALUE() out of the hotpath
      and into the reader path of a trace event, user space tools need to be
      able to parse that. IS_ERR_VALUE() is defined as:
      
       #define IS_ERR_VALUE() unlikely((unsigned long)(void *)(x) >= (unsigned long)-MAX_ERRNO)
      
      Which eventually turns into:
      
        __builtin_expect(!!((unsigned long)(void *)(x) >= (unsigned long)-4095), 0)
      
      Now the traceevent parser can handle most of that except for the
      __builtin_expect(), which needs to be added.
      
      Link: https://lore.kernel.org/linux-mm/20200320055823.27089-3-jaewon31.kim@samsung.com/Signed-off-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Jaewon Kim <jaewon31.kim@samsung.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Kees Kook <keescook@chromium.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: linux-mm@kvack.org
      Cc: linux-trace-devel@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20200324200956.821799393@goodmis.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      1b20d949
    • S
      tools lib traceevent: Handle __attribute__((user)) in field names · 74621d92
      Steven Rostedt (VMware) 提交于
      Commit c61f13ea ("gcc-plugins: Add structleak for more stack
      initialization") added "__attribute__((user))" to the user when
      stackleak detector is enabled. This now appears in the field format of
      system call trace events for system calls that have user buffers. The
      "__attribute__((user))" breaks the parsing in libtraceevent. That needs
      to be handled.
      Signed-off-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Jaewon Kim <jaewon31.kim@samsung.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Kees Kook <keescook@chromium.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: linux-mm@kvack.org
      Cc: linux-trace-devel@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20200324200956.663647256@goodmis.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      74621d92