linux-stable/drivers
Eric Lin 66843b14fb
perf: RISC-V: Remove PERF_HES_STOPPED flag checking in riscv_pmu_start()
Since commit 096b52fd2b ("perf: RISC-V: throttle perf events") the
perf_sample_event_took() function was added to report time spent in
overflow interrupts. If the interrupt takes too long, the perf framework
will lower the sysctl_perf_event_sample_rate and max_samples_per_tick.
When hwc->interrupts is larger than max_samples_per_tick, the
hwc->interrupts will be set to MAX_INTERRUPTS, and events will be
throttled within the __perf_event_account_interrupt() function.

However, the RISC-V PMU driver doesn't call riscv_pmu_stop() to update the
PERF_HES_STOPPED flag after perf_event_overflow() in pmu_sbi_ovf_handler()
function to avoid throttling. When the perf framework unthrottled the event
in the timer interrupt handler, it triggers riscv_pmu_start() function
and causes a WARN_ON_ONCE() warning, as shown below:

 ------------[ cut here ]------------
 WARNING: CPU: 0 PID: 240 at drivers/perf/riscv_pmu.c:184 riscv_pmu_start+0x7c/0x8e
 Modules linked in:
 CPU: 0 PID: 240 Comm: ls Not tainted 6.4-rc4-g19d0788e9ef2 #1
 Hardware name: SiFive (DT)
 epc : riscv_pmu_start+0x7c/0x8e
  ra : riscv_pmu_start+0x28/0x8e
 epc : ffffffff80aef864 ra : ffffffff80aef810 sp : ffff8f80004db6f0
  gp : ffffffff81c83750 tp : ffffaf80069f9bc0 t0 : ffff8f80004db6c0
  t1 : 0000000000000000 t2 : 000000000000001f s0 : ffff8f80004db720
  s1 : ffffaf8008ca1068 a0 : 0000ffffffffffff a1 : 0000000000000000
  a2 : 0000000000000001 a3 : 0000000000000870 a4 : 0000000000000000
  a5 : 0000000000000000 a6 : 0000000000000840 a7 : 0000000000000030
  s2 : 0000000000000000 s3 : ffffaf8005165800 s4 : ffffaf800424da00
  s5 : ffffffffffffffff s6 : ffffffff81cc7590 s7 : 0000000000000000
  s8 : 0000000000000006 s9 : 0000000000000001 s10: ffffaf807efbc340
  s11: ffffaf807efbbf00 t3 : ffffaf8006a16028 t4 : 00000000dbfbb796
  t5 : 0000000700000000 t6 : ffffaf8005269870
 status: 0000000200000100 badaddr: 0000000000000000 cause: 0000000000000003
 [<ffffffff80aef864>] riscv_pmu_start+0x7c/0x8e
 [<ffffffff80185b56>] perf_adjust_freq_unthr_context+0x15e/0x174
 [<ffffffff80188642>] perf_event_task_tick+0x88/0x9c
 [<ffffffff800626a8>] scheduler_tick+0xfe/0x27c
 [<ffffffff800b5640>] update_process_times+0x9a/0xba
 [<ffffffff800c5bd4>] tick_sched_handle+0x32/0x66
 [<ffffffff800c5e0c>] tick_sched_timer+0x64/0xb0
 [<ffffffff800b5e50>] __hrtimer_run_queues+0x156/0x2f4
 [<ffffffff800b6bdc>] hrtimer_interrupt+0xe2/0x1fe
 [<ffffffff80acc9e8>] riscv_timer_interrupt+0x38/0x42
 [<ffffffff80090a16>] handle_percpu_devid_irq+0x90/0x1d2
 [<ffffffff8008a9f4>] generic_handle_domain_irq+0x28/0x36

After referring other PMU drivers like Arm, Loongarch, Csky, and Mips,
they don't call *_pmu_stop() to update with PERF_HES_STOPPED flag
after perf_event_overflow() function nor do they add PERF_HES_STOPPED
flag checking in *_pmu_start() which don't cause this warning.

Thus, it's recommended to remove this unnecessary check in
riscv_pmu_start() function to prevent this warning.

Signed-off-by: Eric Lin <eric.lin@sifive.com>
Link: https://lore.kernel.org/r/20230710154328.19574-1-eric.lin@sifive.com
Fixes: 096b52fd2b ("perf: RISC-V: throttle perf events")
Cc: stable@vger.kernel.org
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
2023-07-12 07:41:23 -07:00
..
accel drm changes for 6.5-rc1: 2023-06-29 11:00:17 -07:00
accessibility
acpi More ACPI updates for 6.5-rc1 2023-07-06 22:25:06 -07:00
amba
android
ata driver core changes for 6.5-rc1 2023-07-03 12:56:23 -07:00
atm
auxdisplay drm changes for 6.5-rc1: 2023-06-29 11:00:17 -07:00
base driver core changes for 6.5-rc1 2023-07-03 12:56:23 -07:00
bcma
block Networking changes for 6.5. 2023-06-28 16:43:10 -07:00
bluetooth Including fixes from bluetooth, bpf and wireguard. 2023-07-05 15:44:45 -07:00
bus SoC fixes for 6.5, part 1 2023-07-06 09:56:53 -07:00
cdrom cdrom/gdrom: Fix build error 2023-06-29 08:09:31 -06:00
cdx
char virtio: features, fixes, cleanups 2023-07-03 15:38:26 -07:00
clk Another set of clk driver updates and fixes for the merge window. The 2023-07-04 11:07:45 -07:00
clocksource RISC-V Patches for the 6.5 Merge Window, Part 1 2023-06-30 09:37:26 -07:00
comedi comedi: make all 'class' structures const 2023-06-23 10:29:02 +02:00
connector
counter
cpufreq More power management updates for 6.5-rc1 2023-07-04 11:22:50 -07:00
cpuidle
crypto s390 updates for 6.5 merge window part 2 2023-07-06 13:18:30 -07:00
cxl cxl: Fix one kernel-doc comment 2023-06-29 16:03:58 -07:00
dax dax: enable dax fault handler to report VM_FAULT_HWPOISON 2023-06-26 07:54:23 -06:00
dca
devfreq
dio
dma dmaengine updates for v6.5 2023-07-06 09:48:31 -07:00
dma-buf drm changes for 6.5-rc1: 2023-06-29 11:00:17 -07:00
edac - Add initial support for RAS hardware found on AMD server GPUs (MI200). 2023-06-26 15:09:18 -07:00
eisa
extcon
firewire firewire: net: fix use after free in fwnet_finish_incoming_packet() 2023-06-24 14:03:46 +09:00
firmware Char/Misc and other driver subsystem updates for 6.5-rc1 2023-07-03 12:46:47 -07:00
fpga Char/Misc and other driver subsystem updates for 6.5-rc1 2023-07-03 12:46:47 -07:00
fsi
gnss
gpio Pin control changes for the v6.5 kernel cycle: 2023-06-30 14:57:19 -07:00
gpu drm fixes for 6.5-rc1 2023-07-06 22:42:54 -07:00
greybus
hid drm changes for 6.5-rc1: 2023-06-29 11:00:17 -07:00
hsi
hte
hv
hwmon driver core changes for 6.5-rc1 2023-07-03 12:56:23 -07:00
hwspinlock
hwtracing Char/Misc and other driver subsystem updates for 6.5-rc1 2023-07-03 12:46:47 -07:00
i2c Part 2 of I2C patches for 6.5 2023-07-08 12:28:00 -07:00
i3c
idle intel_idle: Add __init annotation to matchup_vm_state_with_baremetal() 2023-06-28 19:09:55 +02:00
iio driver core changes for 6.5-rc1 2023-07-03 12:56:23 -07:00
infiniband v6.5 merge window RDMA pull request 2023-06-29 21:01:17 -07:00
input ARM: SoC changes for 6.5 2023-06-29 15:28:33 -07:00
interconnect
iommu iommufd for 6.5 2023-06-29 20:57:27 -07:00
ipack
irqchip RISC-V Patches for the 6.5 Merge Window, Part 1 2023-06-30 09:37:26 -07:00
isdn
leds - New Drivers 2023-07-03 11:26:05 -07:00
macintosh
mailbox mailbox: ti-msgmgr: Fill non-message tx data fields with 0x0 2023-06-30 17:35:45 -05:00
mcb
md hardening fixes for v6.5-rc1 2023-07-08 12:08:39 -07:00
media media updates for v6.5-rc1 2023-07-05 10:42:32 -07:00
memory asm-generic updates for 6.5 2023-07-06 10:06:04 -07:00
memstick
message
mfd - New Drivers 2023-07-03 10:55:04 -07:00
misc Char/Misc and other driver subsystem updates for 6.5-rc1 2023-07-03 12:46:47 -07:00
mmc mmc: Revert "mmc: core: Allow mmc_start_host() synchronously detect a card" 2023-06-30 14:06:51 +02:00
most
mtd Core MTD changes: 2023-06-28 14:02:03 -07:00
mux
net Fixes for pci_clean_master, error handling in driver inits, and various 2023-07-09 09:35:51 -07:00
nfc Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2023-06-22 18:40:38 -07:00
ntb ntb: hw: amd: Fix debugfs_create_dir error checking 2023-07-08 13:55:44 -04:00
nubus
nvdimm dax: enable dax fault handler to report VM_FAULT_HWPOISON 2023-06-26 07:54:23 -06:00
nvme Including fixes from bluetooth, bpf and wireguard. 2023-07-05 15:44:45 -07:00
nvmem
of Devicetree updates for v6.5: 2023-06-29 14:58:26 -07:00
opp OPP: Properly propagate error along when failing to get icc_path 2023-06-27 07:35:14 +05:30
parisc parisc: Move init function declarations into header file 2023-06-30 17:14:15 +02:00
parport Char/Misc and other driver subsystem updates for 6.5-rc1 2023-07-03 12:46:47 -07:00
pci Fixes for pci_clean_master, error handling in driver inits, and various 2023-07-09 09:35:51 -07:00
pcmcia
peci
perf perf: RISC-V: Remove PERF_HES_STOPPED flag checking in riscv_pmu_start() 2023-07-12 07:41:23 -07:00
phy phy-for-6.5-v2 2023-07-05 21:38:13 -07:00
pinctrl Pin control changes for the v6.5 kernel cycle: 2023-06-30 14:57:19 -07:00
platform USB / Thunderbolt driver updates for 6.5-rc1 2023-07-03 13:23:10 -07:00
pnp
power power supply and reset changes for the 6.5 series 2023-07-03 17:23:16 -07:00
powercap ARM: SoC drivers for 6.5 2023-06-29 15:22:19 -07:00
pps
ps3
ptp ptp: Make max_phase_adjustment sysfs device attribute invisible when not supported 2023-07-03 13:17:25 -07:00
pwm pwm: Changes for v6.5-rc1 2023-07-05 12:55:06 -07:00
rapidio
ras
regulator regulator: Fix for v6.5 2023-07-06 19:20:23 -07:00
remoteproc remoteproc updates for v6.5 2023-07-03 17:03:05 -07:00
reset ARM: SoC drivers for 6.5 2023-06-29 15:22:19 -07:00
rpmsg
rtc RTC for 6.5 2023-07-03 10:43:10 -07:00
s390 s390 updates for 6.5 merge window part 2 2023-07-06 13:18:30 -07:00
sbus oradax: make 'cl' a static const structure 2023-06-23 10:27:02 +02:00
scsi SCSI misc on 20230708 2023-07-08 12:35:18 -07:00
sh
siox
slimbus
soc USB / Thunderbolt driver updates for 6.5-rc1 2023-07-03 13:23:10 -07:00
soundwire soundwire: stream: Make master_list ordered to prevent deadlocks 2023-06-21 16:31:45 +05:30
spi spi: Fixes for v6.5 2023-07-06 19:24:11 -07:00
spmi
ssb
staging media updates for v6.5-rc1 2023-07-05 10:42:32 -07:00
target SCSI misc on 20230708 2023-07-08 12:35:18 -07:00
tc
tee ARM: SoC drivers for 6.5 2023-06-29 15:22:19 -07:00
thermal Thermal control updates for 6.5-rc1 2023-06-26 19:41:26 -07:00
thunderbolt
tty TTY/Serial driver updates for 6.5-rc1. 2023-07-03 13:14:58 -07:00
ufs SCSI misc on 20230708 2023-07-08 12:35:18 -07:00
uio
usb USB / Thunderbolt driver updates for 6.5-rc1 2023-07-03 13:23:10 -07:00
vdpa virtio: features, fixes, cleanups 2023-07-03 15:38:26 -07:00
vfio VFIO updates for v6.5-rc1 2023-06-30 15:22:09 -07:00
vhost virtio: features, fixes, cleanups 2023-07-03 15:38:26 -07:00
video - New Functionality 2023-07-03 11:31:01 -07:00
virt workqueue: Ordered workqueue creation cleanups 2023-06-27 16:46:06 -07:00
virtio virtio: allow caller to override device DMA mask in vp_modern 2023-06-27 10:47:08 -04:00
vlynq
w1
watchdog watchdog: sp5100_tco: support Hygon FCH/SCH (Server Controller Hub) 2023-06-26 14:30:07 +02:00
xen - Yosry Ahmed brought back some cgroup v1 stats in OOM logs. 2023-06-28 10:28:11 -07:00
zorro
Kconfig
Makefile