Re: [RFC v2] perf: Rewrite core context handling

From: Ravi Bangoria
Date: Mon Aug 29 2022 - 00:01:22 EST


> With this, I can run 'perf test' and perf_event_tests without any error in
> dmesg. I'll run perf fuzzer over night and see if it reports any issue.

I also ran fuzzer on Intel machine over the weekend. I see only one WARN_ON()
hit. Otherwise system is running normal. FWIW, I was running fuzzer as normal
user with perf_event_paranoid=0.

WARNING: CPU: 3 PID: 2840537 at arch/x86/events/core.c:1606 x86_pmu_stop+0xd0/0x100
Modules linked in: ipmi_ssif intel_rapl_msr intel_rapl_common intel_tcc_cooling x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel wmi_bmof kvm rapl intel_cstate input_leds ee1004 joydev mei_me mei intel_pch_thermal ie31200_edac acpi_ipmi wmi ipmi_si mac_hid acpi_pad acpi_power_meter acpi_tad tcp_westwood sch_fq_codel dm_multipath scsi_dh_rdac bonding scsi_dh_emc tls scsi_dh_alua ipmi_devintf ipmi_msghandler msr ramoops reed_solomon pstore_blk pstore_zone efi_pstore ip_tables x_tables autofs4 btrfs blake2b_generic zstd_compress raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx libcrc32c xor raid6_pq raid1 raid0 multipath linear hid_generic uas usbhid cdc_ether hid usb_storage usbnet mii i915 ast drm_vram_helper drm_ttm_helper i2c_algo_bit drm_buddy drm_display_helper drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops cec rc_core ttm crct10dif_pclmul crc32_pclmul ghash_clmulni_intel aesni_intel crypto_simd i2c_i801 drm i40e cryptd
i2c_smbus ahci xhci_pci libahci xhci_pci_renesas video pinctrl_cannonlake
CPU: 3 PID: 2840537 Comm: perf_fuzzer Not tainted 6.0.0-rc2+ #3
Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./E3C246D4I-NL, BIOS L2.09C 09/23/2020
RIP: 0010:x86_pmu_stop+0xd0/0x100
Code: c8 01 41 89 84 24 d8 01 00 00 eb 9f 4c 89 e7 e8 76 fe ff ff 5b 41 83 8c 24 d8 01 00 00 02 41 5c 41 5d 41 5e 5d c3 cc cc cc cc <0f> 0b eb d1 4c 89 f6 48 c7 c7 00 86 03 b1 e8 cd 18 76 00 e9 48 ff
RSP: 0000:ffffbda8c818fbd0 EFLAGS: 00010002
RAX: 0000000000000003 RBX: ffff97b71de19c60 RCX: 0000000000000188
RDX: 0000000000000000 RSI: 00000000001382d0 RDI: 0000000000000188
RBP: ffffbda8c818fbf0 R08: ffffffffb1039100 R09: 0000000000000005
R10: ffff97b71de1a388 R11: 0000000000000004 R12: ffff97b069c19d40
R13: 0000000000000004 R14: 0000000000000002 R15: ffff97b71de00000
FS: 00007fbf787c6740(0000) GS:ffff97b71de00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000563033ec5010 CR3: 00000001ab91c002 CR4: 00000000003707e0
DR0: 0000000000000000 DR1: 000000000000ffff DR2: 0000000081008000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000600
Call Trace:
<TASK>
x86_pmu_del+0x8e/0x2d0
? debug_smp_processor_id+0x17/0x20
event_sched_out+0x10b/0x2b0
? x86_pmu_del+0x5c/0x2d0
merge_sched_in+0x39f/0x410
visit_groups_merge.constprop.0.isra.0+0x207/0x670
ctx_flexible_sched_in+0xb8/0xd0
ctx_sched_in+0x10a/0x290
ctx_resched+0x97/0x100
__perf_event_enable+0x21b/0x310
event_function+0xb3/0x120
? perf_duration_warn+0x30/0x30
remote_function+0x52/0x70
__flush_smp_call_function_queue+0xc4/0x510
generic_smp_call_function_single_interrupt+0x1a/0xb0
__sysvec_call_function_single+0x48/0x1f0
sysvec_call_function_single+0x56/0xd0
asm_sysvec_call_function_single+0x1b/0x20
RIP: 0033:0x563033ec501b
Code: 0f 1e fa 48 89 d1 31 c0 48 89 f2 89 fe bf 41 01 00 00 e9 48 f7 fe ff 0f 1f 84 00 00 00 00 00 f3 0f 1e fa 31 c9 b9 1f a1 07 00 <ff> c9 75 fc 31 c0 c3 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 f3
RSP: 002b:00007ffd7b16aaf8 EFLAGS: 00000202
RAX: 0000000000002303 RBX: 0000000000000000 RCX: 000000000006c1b6
RDX: 00007fbf787c6a00 RSI: 0000000000000000 RDI: 0000000000000001
RBP: 00007ffd7b16ab10 R08: 0000000000000000 R09: 00007fbf787c6740
R10: 00007fbf7880d0c8 R11: 0000000000000246 R12: 00007ffd7b16cf28
R13: 0000563033eb527a R14: 0000563033ed1b68 R15: 00007fbf7880c040
</TASK>
irq event stamp: 0
hardirqs last enabled at (0): [<0000000000000000>] 0x0
hardirqs last disabled at (0): [<ffffffffaf0bfef8>] copy_process+0xa38/0x1f80
softirqs last enabled at (0): [<ffffffffaf0bfef8>] copy_process+0xa38/0x1f80
softirqs last disabled at (0): [<0000000000000000>] 0x0
---[ end trace 0000000000000000 ]---