1. 09 Feb, 2023 1 commit
    • Ian Rogers's avatar
      perf stat: Avoid merging/aggregating metric counts twice · 37f322cd
      Ian Rogers authored
      The added perf_stat_merge_counters combines uncore counters. When
      metrics are enabled, the counts are merged into a metric_leader via the
      stat-shadow saved_value logic. As the leader now is passed an aggregated
      count, it leads to all counters being added together twice and counts
      appearing approximately doubled in metrics.
      
      This change disables the saved_value merging of counts for evsels that
      are merged. It is recommended that later changes remove the saved_value
      entirely as the two layers of aggregation in the code is confusing.
      
      Fixes: 942c5593 ("perf stat: Add perf_stat_merge_counters()")
      Reported-by: default avatarPerry Taylor <perry.taylor@intel.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Eduard Zingerman <eddyz87@gmail.com>
      Cc: Florian Fischer <florian.fischer@muhq.space>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230209064447.83733-1-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      37f322cd
  2. 08 Feb, 2023 5 commits
    • Thomas Richter's avatar
      perf tools: Fix perf tool build error in util/pfm.c · 6a5558f1
      Thomas Richter authored
      I have downloaded linux-next and build the perf tool using
      
        # make LIBPFM4=1
      
      to have libpfm4 support built into perf. The build fails:
      
       # make LIBPFM4=1
      ....
      INSTALL libbpf_headers
        CC      util/pfm.o
      util/pfm.c: In function ‘print_libpfm_event’:
      util/pfm.c:189:9: error: too many arguments to function ‘print_cb->print_event’
        189 |         print_cb->print_event(print_state,
            |         ^~~~~~~~
      util/pfm.c:220:25: error: too many arguments to function ‘print_cb->print_event’
        220 |                         print_cb->print_event(print_state,
      
      The build error is caused by commit d9dc8874 ("perf pmu-events:
      Remove now unused event and metric variables") which changes the
      function prototype of
      
        struct print_callbacks {
            ...
            void (*print_event)(...);  --> last two parameters removed.
        };
      
      but does not adjust the usage of this function prototype in util/pfm.c.
      In file util/pfm.c function print_event() is still invoked with 13
      parameters instead of 11. The compile fails.
      
      When I adjust the file util/pfm.c as in this patch, the build works file.
      Please check this patch for correctness, I have just fixed the compile
      issue.
      
      Fixes: d9dc8874 ("perf pmu-events: Remove now unused event and metric variables")
      Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Tested-by: default avatarIan Rogers <irogers@google.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Sven Schnelle <svens@linux.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: egorenar@linux.ibm.com
      Cc: linux-kernel-next@vger.kernel.org
      Link: https://lore.kernel.org/r/20230207140447.1827741-1-tmricht@linux.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6a5558f1
    • Yicong Yang's avatar
      perf tools: Fix auto-complete on aarch64 · ffd1240e
      Yicong Yang authored
      On aarch64 CPU related events are not under event_source/devices/cpu/events,
      they're under event_source/devices/armv8_pmuv3_0/events on my machine.
      Using current auto-complete script will generate below error:
      
        [root@localhost bin]# perf stat -e
        ls: cannot access '/sys/bus/event_source/devices/cpu/events': No such file or directory
      
      Fix this by not testing /sys/bus/event_source/devices/cpu/events on
      aarch64 machine.
      
      Fixes: 74cd5815 ("perf tool: Improve bash command line auto-complete for multiple events with comma")
      Reviewed-by: default avatarJames Clark <james.clark@arm.com>
      Signed-off-by: default avatarYicong Yang <yangyicong@hisilicon.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linuxarm@huawei.com
      Cc: prime.zeng@hisilicon.com
      Link: https://lore.kernel.org/r/20230207035057.43394-1-yangyicong@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ffd1240e
    • Namhyung Kim's avatar
      perf lock contention: Support old rw_semaphore type · 1bece135
      Namhyung Kim authored
      The old kernel has a different type of the owner field in rwsem.  We can
      check it using bpf_core_type_matches() builtin in clang but it also
      needs its own version check since it's available on recent versions.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Hao Luo <haoluo@google.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Song Liu <song@kernel.org>
      Cc: Waiman Long <longman@redhat.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20230207002403.63590-4-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1bece135
    • Namhyung Kim's avatar
      perf lock contention: Add -o/--lock-owner option · 3477f079
      Namhyung Kim authored
      When there're many lock contentions in the system, people sometimes want
      to know who caused the contention, IOW who's the owner of the locks.
      
      The -o/--lock-owner option tries to follow the lock owners for the
      contended mutexes and rwsems from BPF, and then attributes the
      contention time to the owner instead of the waiter.  It's a best effort
      approach to get the owner info at the time of the contention and doesn't
      guarantee to have the precise tracking of owners if it's changing over
      time.
      
      Currently it only handles mutex and rwsem that have owner field in their
      struct and it basically points to a task_struct that owns the lock at
      the moment.
      
      Technically its type is atomic_long_t and it comes with some LSB bits
      used for other meanings.  So it needs to clear them when casting it to a
      pointer to task_struct.
      
      Also the atomic_long_t is a typedef of the atomic 32 or 64 bit types
      depending on arch which is a wrapper struct for the counter value.  I'm
      not aware of proper ways to access those kernel atomic types from BPF so
      I just read the internal counter value directly.  Please let me know if
      there's a better way.
      
      When -o/--lock-owner option is used, it goes to the task aggregation
      mode like -t/--threads option does.  However it cannot get the owner for
      other lock types like spinlock and sometimes even for mutex.
      
        $ sudo ./perf lock con -abo -- ./perf bench sched pipe
        # Running 'sched/pipe' benchmark:
        # Executed 1000000 pipe operations between two processes
      
             Total time: 4.766 [sec]
      
               4.766540 usecs/op
                 209795 ops/sec
         contended   total wait     max wait     avg wait          pid   owner
      
               403    565.32 us     26.81 us      1.40 us           -1   Unknown
                 4     27.99 us      8.57 us      7.00 us      1583145   sched-pipe
                 1      8.25 us      8.25 us      8.25 us      1583144   sched-pipe
                 1      2.03 us      2.03 us      2.03 us         5068   chrome
      
      As you can see, the owner is unknown for the most cases.  But if we
      filter only for the mutex locks, it'd more likely get the onwers.
      
        $ sudo ./perf lock con -abo -Y mutex -- ./perf bench sched pipe
        # Running 'sched/pipe' benchmark:
        # Executed 1000000 pipe operations between two processes
      
             Total time: 4.910 [sec]
      
               4.910435 usecs/op
                 203647 ops/sec
         contended   total wait     max wait     avg wait          pid   owner
      
                 2     15.50 us      8.29 us      7.75 us      1582852   sched-pipe
                 7      7.20 us      2.47 us      1.03 us           -1   Unknown
                 1      6.74 us      6.74 us      6.74 us      1582851   sched-pipe
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Hao Luo <haoluo@google.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Song Liu <song@kernel.org>
      Cc: Waiman Long <longman@redhat.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20230207002403.63590-3-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3477f079
    • Namhyung Kim's avatar
      perf lock contention: Fix to save callstack for the default modified · 55e39185
      Namhyung Kim authored
      The previous change missed to set the con->save_callstack for the
      LOCK_AGGR_CALLER mode resulting in no caller information.
      
      Fixes: ebab2916 ("perf lock contention: Support filters for different aggregation")
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Hao Luo <haoluo@google.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Song Liu <song@kernel.org>
      Cc: Waiman Long <longman@redhat.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20230207002403.63590-2-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      55e39185
  3. 06 Feb, 2023 8 commits
  4. 05 Feb, 2023 8 commits
    • Linus Torvalds's avatar
      Linux 6.2-rc7 · 4ec5183e
      Linus Torvalds authored
      4ec5183e
    • Linus Torvalds's avatar
      Merge tag 'usb-6.2-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · c608f6b5
      Linus Torvalds authored
      Pull USB fixes from Greg KH:
       "Here are some small USB fixes that resolve some reported problems.
        These include:
      
         - gadget driver fixes
      
         - dwc3 driver fix
      
         - typec driver fix
      
         - MAINTAINERS file update.
      
        All of these have been in linux-next with no reported problems"
      
      * tag 'usb-6.2-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
        usb: typec: ucsi: Don't attempt to resume the ports before they exist
        usb: gadget: udc: do not clear gadget driver.bus
        usb: gadget: f_uac2: Fix incorrect increment of bNumEndpoints
        usb: gadget: f_fs: Fix unbalanced spinlock in __ffs_ep0_queue_wait
        usb: dwc3: qcom: enable vbus override when in OTG dr-mode
        MAINTAINERS: Add myself as UVC Gadget Maintainer
      c608f6b5
    • Linus Torvalds's avatar
      Merge tag 'tty-6.2-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty · dc0ce181
      Linus Torvalds authored
      Pull tty/serial driver fixes from Greg KH:
       "Here are some small serial and vt fixes. These include:
      
         - 8250 driver fixes relating to dma issues
      
         - stm32 serial driver fix for threaded irqs
      
         - vc_screen bugfix for reported problems.
      
        All have been in linux-next for a while with no reported problems"
      
      * tag 'tty-6.2-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
        vc_screen: move load of struct vc_data pointer in vcs_read() to avoid UAF
        serial: 8250_dma: Fix DMA Rx rearm race
        serial: 8250_dma: Fix DMA Rx completion race
        serial: stm32: Merge hard IRQ and threaded IRQ handling into single IRQ handler
      dc0ce181
    • Linus Torvalds's avatar
      Merge tag 'char-misc-6.2-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc · d3feaff4
      Linus Torvalds authored
      Pull char/misc driver fixes from Greg KH:
       "Here are a number of small char/misc/whatever driver fixes. They
        include:
      
         - IIO driver fixes for some reported problems
      
         - nvmem driver fixes
      
         - fpga driver fixes
      
         - debugfs memory leak fix in the hv_balloon and irqdomain code
           (irqdomain change was acked by the maintainer)
      
        All have been in linux-next with no reported problems"
      
      * tag 'char-misc-6.2-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (33 commits)
        kernel/irq/irqdomain.c: fix memory leak with using debugfs_lookup()
        HV: hv_balloon: fix memory leak with using debugfs_lookup()
        nvmem: qcom-spmi-sdam: fix module autoloading
        nvmem: core: fix return value
        nvmem: core: fix cell removal on error
        nvmem: core: fix device node refcounting
        nvmem: core: fix registration vs use race
        nvmem: core: fix cleanup after dev_set_name()
        nvmem: core: remove nvmem_config wp_gpio
        nvmem: core: initialise nvmem->id early
        nvmem: sunxi_sid: Always use 32-bit MMIO reads
        nvmem: brcm_nvram: Add check for kzalloc
        iio: imu: fxos8700: fix MAGN sensor scale and unit
        iio: imu: fxos8700: remove definition FXOS8700_CTRL_ODR_MIN
        iio: imu: fxos8700: fix failed initialization ODR mode assignment
        iio: imu: fxos8700: fix incorrect ODR mode readback
        iio: light: cm32181: Fix PM support on system with 2 I2C resources
        iio: hid: fix the retval in gyro_3d_capture_sample
        iio: hid: fix the retval in accel_3d_capture_sample
        iio: imu: st_lsm6dsx: fix build when CONFIG_IIO_TRIGGERED_BUFFER=m
        ...
      d3feaff4
    • Linus Torvalds's avatar
      Merge tag 'fbdev-for-6.2-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev · 870c3a9a
      Linus Torvalds authored
      Pull fbdev fixes from Helge Deller:
      
       - fix fbcon to prevent fonts bigger than 32x32 pixels to avoid
         overflows reported by syzbot
      
       - switch omapfb to use kstrtobool()
      
       - switch some fbdev drivers to use the backlight helpers
      
      * tag 'fbdev-for-6.2-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev:
        fbcon: Check font dimension limits
        fbdev: omapfb: Use kstrtobool() instead of strtobool()
        fbdev: fbmon: fix function name in kernel-doc
        fbdev: atmel_lcdfb: Rework backlight status updates
        fbdev: riva: Use backlight helper
        fbdev: omapfb: panel-dsi-cm: Use backlight helper
        fbdev: nvidia: Use backlight helper
        fbdev: mx3fb: Use backlight helper
        fbdev: radeon: Use backlight helper
        fbdev: atyfb: Use backlight helper
        fbdev: aty128fb: Use backlight helper
      870c3a9a
    • Linus Torvalds's avatar
      Merge tag 'x86_urgent_for_v6.2_rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 9e482602
      Linus Torvalds authored
      Pull x86 fix from Borislav Petkov:
      
       - Prevent the compiler from reordering accesses to debug regs which
         could cause a #VC exception in SEV-ES guests at the wrong place in
         the NMI handling path
      
      * tag 'x86_urgent_for_v6.2_rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/debug: Fix stack recursion caused by wrongly ordered DR7 accesses
      9e482602
    • Linus Torvalds's avatar
      Merge tag 'perf_urgent_for_v6.2_rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · de506eec
      Linus Torvalds authored
      Pull perf fix from Borislav Petkov:
      
       - Lock the proper critical section when dealing with perf event context
      
      * tag 'perf_urgent_for_v6.2_rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        perf: Fix perf_event_pmu_context serialization
      de506eec
    • Linus Torvalds's avatar
      Merge tag 'powerpc-6.2-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · 837c07cf
      Linus Torvalds authored
      Pull powerpc fixes from Michael Ellerman:
       "It's a bit of a big batch for rc6, but just because I didn't send any
        fixes the last week or two while I was on vacation, next week should
        be quieter:
      
         - Fix a few objtool warnings since we recently enabled objtool.
      
         - Fix a deadlock with the hash MMU vs perf record.
      
         - Fix perf profiling of asynchronous interrupt handlers.
      
         - Revert the IMC PMU nest_init_lock to being a mutex.
      
         - Two commits fixing problems with the kexec_file FDT size
           estimation.
      
         - Two commits fixing problems with strict RWX vs kernels running at
           non-zero.
      
         - Reconnect tlb_flush() to hash__tlb_flush()
      
        Thanks to Kajol Jain, Nicholas Piggin, Sachin Sant Sathvika Vasireddy,
        and Sourabh Jain"
      
      * tag 'powerpc-6.2-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
        powerpc/64s: Reconnect tlb_flush() to hash__tlb_flush()
        powerpc/kexec_file: Count hot-pluggable memory in FDT estimate
        powerpc/64s/radix: Fix RWX mapping with relocated kernel
        powerpc/64s/radix: Fix crash with unaligned relocated kernel
        powerpc/kexec_file: Fix division by zero in extra size estimation
        powerpc/imc-pmu: Revert nest_init_lock to being a mutex
        powerpc/64: Fix perf profiling asynchronous interrupt handlers
        powerpc/64s: Fix local irq disable when PMIs are disabled
        powerpc/kvm: Fix unannotated intra-function call warning
        powerpc/85xx: Fix unannotated intra-function call warning
      837c07cf
  5. 04 Feb, 2023 7 commits
  6. 03 Feb, 2023 11 commits
    • Kan Liang's avatar
      perf script: Support Retire Latency · 17f248aa
      Kan Liang authored
      The Retire Latency field is added in the var3_w of the
      PERF_SAMPLE_WEIGHT_STRUCT. The Retire Latency reports the number of
      elapsed core clocks between the retirement of the instruction indicated
      by the Instruction Pointer field of the PEBS record and the retirement
      of the prior instruction. That's quite useful to display the information
      with perf script.
      
      Add a new field retire_lat for the Retire Latency information.
      Reviewed-by: default avatarAndi Kleen <ak@linux.intel.com>
      Signed-off-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20230104201349.1451191-9-kan.liang@linux.intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      17f248aa
    • Kan Liang's avatar
      perf report: Support Retire Latency · d7d213e0
      Kan Liang authored
      The Retire Latency field is added in the var3_w of the
      PERF_SAMPLE_WEIGHT_STRUCT. The Retire Latency reports pipeline stall of
      this instruction compared to the previous instruction in cycles.  That's
      quite useful to display the information with perf mem report.
      
      The p_stage_cyc for Power is also from the var3_w. Union the p_stage_cyc
      and retire_lat to share the code.
      
      Implement X86 specific codes to display the X86 specific header.
      
      Add a new sort key retire_lat for the Retire Latency.
      Reviewed-by: default avatarAndi Kleen <ak@linux.intel.com>
      Signed-off-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20230104201349.1451191-8-kan.liang@linux.intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d7d213e0
    • Namhyung Kim's avatar
      perf lock contention: Support filters for different aggregation · ebab2916
      Namhyung Kim authored
      It'd be useful to filter other than the current aggregation mode.  For
      example, users may want to see callstacks for specific locks only.  Or
      they may want tasks from a certain callstack.
      
      The tracepoints already collected the information but it needs to check
      the condition again when processing the event.  And it needs to change
      BPF to allow the key combinations.
      
      The lock contentions on 'rcu_state' spinlock can be monitored:
      
        $ sudo perf lock con -abv -L rcu_state sleep 1
        ...
         contended   total wait     max wait     avg wait         type   caller
      
                 4    151.39 us     62.57 us     37.85 us     spinlock   rcu_core+0xcb
                                0xffffffff81fd1666  _raw_spin_lock_irqsave+0x46
                                0xffffffff8172d76b  rcu_core+0xcb
                                0xffffffff822000eb  __softirqentry_text_start+0xeb
                                0xffffffff816a0ba9  __irq_exit_rcu+0xc9
                                0xffffffff81fc0112  sysvec_apic_timer_interrupt+0xa2
                                0xffffffff82000e46  asm_sysvec_apic_timer_interrupt+0x16
                                0xffffffff81d49f78  cpuidle_enter_state+0xd8
                                0xffffffff81d4a259  cpuidle_enter+0x29
                 1     30.21 us     30.21 us     30.21 us     spinlock   rcu_core+0xcb
                                0xffffffff81fd1666  _raw_spin_lock_irqsave+0x46
                                0xffffffff8172d76b  rcu_core+0xcb
                                0xffffffff822000eb  __softirqentry_text_start+0xeb
                                0xffffffff816a0ba9  __irq_exit_rcu+0xc9
                                0xffffffff81fc00c4  sysvec_apic_timer_interrupt+0x54
                                0xffffffff82000e46  asm_sysvec_apic_timer_interrupt+0x16
                 1     28.84 us     28.84 us     28.84 us     spinlock   rcu_accelerate_cbs_unlocked+0x40
                                0xffffffff81fd1c60  _raw_spin_lock+0x30
                                0xffffffff81728cf0  rcu_accelerate_cbs_unlocked+0x40
                                0xffffffff8172da82  rcu_core+0x3e2
                                0xffffffff822000eb  __softirqentry_text_start+0xeb
                                0xffffffff816a0ba9  __irq_exit_rcu+0xc9
                                0xffffffff81fc0112  sysvec_apic_timer_interrupt+0xa2
                                0xffffffff82000e46  asm_sysvec_apic_timer_interrupt+0x16
                                0xffffffff81d49f78  cpuidle_enter_state+0xd8
        ...
      
      To see tasks calling 'rcu_core' function:
      
        $ sudo perf lock con -abt -S rcu_core sleep 1
         contended   total wait     max wait     avg wait          pid   comm
      
                19     23.46 us      2.21 us      1.23 us            0   swapper
                 2     18.37 us     17.01 us      9.19 us      2061859   ThreadPoolForeg
                 3      5.76 us      1.97 us      1.92 us         3909   pipewire-pulse
                 1      2.26 us      2.26 us      2.26 us      1809271   MediaSu~isor #2
                 1      1.97 us      1.97 us      1.97 us      1514882   Chrome_ChildIOT
                 1       987 ns       987 ns       987 ns         3740   pipewire-pulse
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Hao Luo <haoluo@google.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Juri Lelli <juri.lelli@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Song Liu <song@kernel.org>
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20230203021324.143540-4-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ebab2916
    • Namhyung Kim's avatar
      perf lock contention: Use lock_stat_find{,new} · 16cad1d3
      Namhyung Kim authored
      This is a preparation work to support complex keys of BPF maps.  Now it
      has single value key according to the aggregation mode like stack_id or
      pid.  But we want to use a combination of those keys.
      
      Then lock_contention_read() should still aggregate the result based on
      the key that was requested by user.  The other key info will be used for
      filtering.
      
      So instead of creating a lock_stat entry always, Check if it's already
      there using lock_stat_find() first.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Hao Luo <haoluo@google.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Juri Lelli <juri.lelli@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Song Liu <song@kernel.org>
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20230203021324.143540-3-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      16cad1d3
    • Namhyung Kim's avatar
      perf lock contention: Factor out lock_contention_get_name() · 492fef21
      Namhyung Kim authored
      The lock_contention_get_name() returns a name for the lock stat entry
      based on the current aggregation mode.  As it's called sequentially in a
      single thread, it can return the address of a static buffer for symbol
      and offset of the caller.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Hao Luo <haoluo@google.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Juri Lelli <juri.lelli@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Song Liu <song@kernel.org>
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20230203021324.143540-2-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      492fef21
    • Rob Herring's avatar
      perf arm-spe: Add raw decoding for SPEv1.2 previous branch address · 7105311c
      Rob Herring authored
      Arm SPEv1.2 adds a new optional address packet type: previous branch
      target. The recorded address is the target virtual address of the most
      recently taken branch in program order.
      
      Add support for decoding the address packet in raw dumps.
      Reviewed-by: default avatarLeo Yan <leo.yan@linaro.org>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20230203162401.132931-1-robh@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7105311c
    • Ian Rogers's avatar
      perf jevents: Run metric_test.py at compile-time · b777b3d2
      Ian Rogers authored
      Add a target that generates a log file for running metric_test.py and
      make this a dependency on generating pmu-events.c. The log output is
      displayed if the test fails like (the test was modified to make it
      fail):
      
      ```
        TEST    /tmp/perf/pmu-events/metric_test.log
      F......
      ======================================================================
      FAIL: test_Brackets (__main__.TestMetricExpressions)
      ----------------------------------------------------------------------
      Traceback (most recent call last):
        File "tools/perf/pmu-events/metric_test.py", line 33, in test_Brackets
          self.assertEqual((a * b + c).ToPerfJson(), 'a * b + d')
      AssertionError: 'a * b + c' != 'a * b + d'
      - a * b + c
      ?         ^
      + a * b + d
      ?         ^
      
      ----------------------------------------------------------------------
      Ran 7 tests in 0.004s
      
      FAILED (failures=1)
      make[3]: *** [pmu-events/Build:32: /tmp/perf/pmu-events/metric_test.log] Error 1
      ```
      
      However, normal execution will just show the TEST line.
      
      This is roughly modeled on fortify testing in the kernel lib directory.
      
      Modify metric_test.py so that it is executable. This is necessary when
      PYTHON isn't specified in the build, the normal case.
      
      Use variables to make the paths to files clearer and more consistent.
      
      Committer notes:
      
      Add pmu-events/metric_test.log to tools/perf/.gitignore and to the
      'clean' target on tools/perf/Makefile.perf.
      Reviewed-by: default avatarKajol Jain <kjain@linux.ibm.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Florian Fischer <florian.fischer@muhq.space>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jing Zhang <renyu.zj@linux.alibaba.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Kang Minchul <tegongkang@gmail.com>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linuxppc-dev@lists.ozlabs.org
      Link: https://lore.kernel.org/r/20230126233645.200509-16-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b777b3d2
    • Linus Torvalds's avatar
      Merge tag 'block-6.2-2023-02-03' of git://git.kernel.dk/linux · 0136d86b
      Linus Torvalds authored
      Pull block fixes from Jens Axboe:
       "A bit bigger than I'd like at this point, but mostly a bunch of little
        fixes. In detail:
      
         - NVMe pull request via Christoph:
             - Fix a missing queue put in nvmet_fc_ls_create_association
               (Amit Engel)
             - Clear queue pointers on tag_set initialization failure
               (Maurizio Lombardi)
             - Use workqueue dedicated to authentication (Shin'ichiro
               Kawasaki)
      
         - Fix for an overflow in ublk (Liu)
      
         - Fix for leaking a queue reference in block cgroups (Ming)
      
         - Fix for a use-after-free in BFQ (Yu)"
      
      * tag 'block-6.2-2023-02-03' of git://git.kernel.dk/linux:
        blk-cgroup: don't update io stat for root cgroup
        nvme-auth: use workqueue dedicated to authentication
        nvme: clear the request_queue pointers on failure in nvme_alloc_io_tag_set
        nvme: clear the request_queue pointers on failure in nvme_alloc_admin_tag_set
        nvme-fc: fix a missing queue put in nvmet_fc_ls_create_association
        block: Fix the blk_mq_destroy_queue() documentation
        block: ublk: extending queue_size to fix overflow
        block, bfq: fix uaf for bfqq in bic_set_bfqq()
      0136d86b
    • Linus Torvalds's avatar
      Merge tag 'ceph-for-6.2-rc7' of https://github.com/ceph/ceph-client · 7b753a90
      Linus Torvalds authored
      Pull ceph fix from Ilya Dryomov:
       "A safeguard to prevent the kernel client from further damaging the
        filesystem after running into a case of an invalid snap trace.
      
        The root cause of this metadata corruption is still being investigated
        but it appears to be stemming from the MDS. As such, this is the best
        we can do for now"
      
      * tag 'ceph-for-6.2-rc7' of https://github.com/ceph/ceph-client:
        ceph: blocklist the kclient when receiving corrupted snap trace
        ceph: move mount state enum to super.h
      7b753a90
    • Linus Torvalds's avatar
      Merge tag 'efi-fixes-for-v6.2-3' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi · a0880c33
      Linus Torvalds authored
      Pull EFI fixes from Ard Biesheuvel:
      
       - handle potential mremap() failure gracefully
      
       - don't reject EFI memory attributes table version 2
      
      * tag 'efi-fixes-for-v6.2-3' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi:
        efi: fix potential NULL deref in efi_mem_reserve_persistent
        efi: Accept version 2 of memory attributes table
      a0880c33
    • Linus Torvalds's avatar
      Merge tag 'riscv-for-linus-6.2-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux · a30df1ea
      Linus Torvalds authored
      Pull RISC-V fixes from Palmer Dabbelt:
      
       - A build fix to avoid static branches in cpu_relax(), which greatly
         inflates the jump tables and breaks at least
         CONFIG_CC_OPTIMIZE_FOR_SIZE=y.
      
       - A fix for a kernel panic when probing impossible instruction
         positions.
      
       - A fix to disable unwind tables, which are enabled by default for
         GCC-13 and result in unhandled relocations in modules.
      
      * tag 'riscv-for-linus-6.2-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
        riscv: disable generation of unwind tables
        riscv: kprobe: Fixup kernel panic when probing an illegal position
        riscv: Fix build with CONFIG_CC_OPTIMIZE_FOR_SIZE=y
      a30df1ea