[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <202410251647.21bf487b-lkp@intel.com>
Date: Fri, 25 Oct 2024 16:37:22 +0800
From: kernel test robot <oliver.sang@...el.com>
To: Peter Zijlstra <peterz@...radead.org>
CC: <oe-lkp@...ts.linux.dev>, <lkp@...el.com>,
<linux-perf-users@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<oliver.sang@...el.com>
Subject: [peterz-queue:perf/pmu-unregister] [perf] 24b8359383:
WARNING:possible_circular_locking_dependency_detected
Hello,
kernel test robot noticed "WARNING:possible_circular_locking_dependency_detected" on:
commit: 24b8359383aee40fcd58b700a9269e61afa864aa ("perf: Serialize perf_mmap() vs other entry points")
https://git.kernel.org/cgit/linux/kernel/git/peterz/queue.git perf/pmu-unregister
in testcase: trinity
version: trinity-i386-abe9de86-1_20230429
with following parameters:
runtime: 600s
config: i386-randconfig-015-20241023
compiler: clang-18
test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G
(please refer to attached dmesg/kmsg for entire log/backtrace)
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------+------------+
| | de20037e1b | 24b8359383 |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------+------------+
| WARNING:possible_circular_locking_dependency_detected | 0 | 16 |
| WARNING:possible_circular_locking_dependency_detected_trinity-c1_is_trying_to_acquire_lock:at:__might_fault_but_task_is_already_holding_lock:at:perf_event_ctx_lock_nested | 0 | 1 |
| WARNING:possible_circular_locking_dependency_detected_trinity-c1_is_trying_to_acquire_lock:at:perf_event_ctx_lock_nested_but_task_is_already_holding_lock:at:vm_mmap_pgoff | 0 | 6 |
| WARNING:possible_circular_locking_dependency_detected_trinity-c3_is_trying_to_acquire_lock:at:perf_event_ctx_lock_nested_but_task_is_already_holding_lock:at:vm_mmap_pgoff | 0 | 4 |
| WARNING:possible_circular_locking_dependency_detected_trinity-c2_is_trying_to_acquire_lock:at:perf_event_ctx_lock_nested_but_task_is_already_holding_lock:at:vm_mmap_pgoff | 0 | 3 |
| WARNING:possible_circular_locking_dependency_detected_trinity-c0_is_trying_to_acquire_lock:at:perf_event_ctx_lock_nested_but_task_is_already_holding_lock:at:vm_mmap_pgoff | 0 | 1 |
| WARNING:possible_circular_locking_dependency_detected_trinity-c0_is_trying_to_acquire_lock:at:__might_fault_but_task_is_already_holding_lock:at:perf_event_ctx_lock_nested | 0 | 1 |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------+------------+
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <oliver.sang@...el.com>
| Closes: https://lore.kernel.org/oe-lkp/202410251647.21bf487b-lkp@intel.com
[ 90.688729][ T589] WARNING: possible circular locking dependency detected
[ 90.689307][ T589] 6.12.0-rc2-00016-g24b8359383ae #1 Tainted: G T
[ 90.689852][ T589] ------------------------------------------------------
[ 90.690348][ T589] trinity-c2/589 is trying to acquire lock:
[ 90.690768][ T589] ee61f668 (&ctx->mutex){+.+.}-{3:3}, at: perf_event_ctx_lock_nested (kernel/events/core.c:1318)
[ 90.691425][ T589]
[ 90.691425][ T589] but task is already holding lock:
[ 90.691944][ T589] ed2041d4 (&mm->mmap_lock){++++}-{3:3}, at: vm_mmap_pgoff (arch/x86/include/asm/jump_label.h:41 include/linux/jump_label.h:207 include/linux/mmap_lock.h:35 include/linux/mmap_lock.h:123 mm/util.c:586)
[ 90.692525][ T589]
[ 90.692525][ T589] which lock already depends on the new lock.
[ 90.692525][ T589]
[ 90.693271][ T589]
[ 90.693271][ T589] the existing dependency chain (in reverse order) is:
[ 90.693907][ T589]
[ 90.693907][ T589] -> #1 (&mm->mmap_lock){++++}-{3:3}:
[ 90.694445][ T589] __might_fault (mm/memory.c:6700)
[ 90.694797][ T589] _copy_to_user (include/linux/uaccess.h:184 lib/usercopy.c:26)
[ 90.695152][ T589] perf_read (kernel/events/core.c:5773)
[ 90.695516][ T589] vfs_read (fs/read_write.c:567)
[ 90.695858][ T589] ksys_read (fs/read_write.c:712)
[ 90.696201][ T589] __ia32_sys_read (fs/read_write.c:720)
[ 90.696593][ T589] ia32_sys_call (kbuild/obj/consumer/i386-randconfig-015-20241023/./arch/x86/include/generated/asm/syscalls_32.h:?)
[ 90.696969][ T589] do_int80_syscall_32 (arch/x86/entry/common.c:?)
[ 90.697371][ T589] restore_all_switch_stack (arch/x86/entry/entry_32.S:944)
[ 90.697787][ T589]
[ 90.697787][ T589] -> #0 (&ctx->mutex){+.+.}-{3:3}:
[ 90.698312][ T589] __lock_acquire (kernel/locking/lockdep.c:?)
[ 90.698693][ T589] lock_acquire (kernel/locking/lockdep.c:5825)
[ 90.699044][ T589] __mutex_lock_common (kernel/locking/mutex.c:608)
[ 90.699444][ T589] mutex_lock_nested (kernel/locking/mutex.c:752 kernel/locking/mutex.c:804)
[ 90.699821][ T589] perf_event_ctx_lock_nested (kernel/events/core.c:1318)
[ 90.700261][ T589] perf_mmap (kernel/events/core.c:? kernel/events/core.c:6812)
[ 90.700597][ T589] mmap_region (mm/mmap.c:1441)
[ 90.700965][ T589] do_mmap (mm/mmap.c:496)
[ 90.701296][ T589] vm_mmap_pgoff (mm/util.c:588)
[ 90.701652][ T589] ksys_mmap_pgoff (mm/mmap.c:542)
[ 90.702033][ T589] __ia32_sys_mmap_pgoff (mm/mmap.c:553 mm/mmap.c:549 mm/mmap.c:549)
[ 90.702432][ T589] ia32_sys_call (kbuild/obj/consumer/i386-randconfig-015-20241023/./arch/x86/include/generated/asm/syscalls_32.h:?)
[ 90.702802][ T589] do_int80_syscall_32 (arch/x86/entry/common.c:?)
[ 90.703196][ T589] restore_all_switch_stack (arch/x86/entry/entry_32.S:944)
[ 90.703638][ T589]
[ 90.703638][ T589] other info that might help us debug this:
[ 90.703638][ T589]
[ 90.704379][ T589] Possible unsafe locking scenario:
[ 90.704379][ T589]
[ 90.704933][ T589] CPU0 CPU1
[ 90.705325][ T589] ---- ----
[ 90.705716][ T589] lock(&mm->mmap_lock);
[ 90.706051][ T589] lock(&ctx->mutex);
[ 90.706514][ T589] lock(&mm->mmap_lock);
[ 90.706994][ T589] lock(&ctx->mutex);
[ 90.707283][ T589]
[ 90.707283][ T589] *** DEADLOCK ***
[ 90.707283][ T589]
[ 90.707850][ T589] 1 lock held by trinity-c2/589:
[ 90.708198][ T589] #0: ed2041d4 (&mm->mmap_lock){++++}-{3:3}, at: vm_mmap_pgoff (arch/x86/include/asm/jump_label.h:41 include/linux/jump_label.h:207 include/linux/mmap_lock.h:35 include/linux/mmap_lock.h:123 mm/util.c:586)
[ 90.708811][ T589]
[ 90.708811][ T589] stack backtrace:
[ 90.709244][ T589] CPU: 0 UID: 65534 PID: 589 Comm: trinity-c2 Tainted: G T 6.12.0-rc2-00016-g24b8359383ae #1 8345be9a99138da25a7e4490e34d40eb8aa23b00
[ 90.710301][ T589] Tainted: [T]=RANDSTRUCT
[ 90.710606][ T589] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
[ 90.711338][ T589] Call Trace:
[ 90.711577][ T589] dump_stack_lvl (lib/dump_stack.c:122)
[ 90.711906][ T589] dump_stack (lib/dump_stack.c:129)
[ 90.712197][ T589] print_circular_bug (kernel/locking/lockdep.c:2076)
[ 90.712561][ T589] check_noncircular (kernel/locking/lockdep.c:2206)
[ 90.712930][ T589] __lock_acquire (kernel/locking/lockdep.c:?)
[ 90.713277][ T589] ? __lock_acquire (kernel/locking/lockdep.c:4646)
[ 90.713632][ T589] ? kvm_sched_clock_read (arch/x86/kernel/kvmclock.c:91)
[ 90.713997][ T589] ? sched_clock_noinstr (arch/x86/kernel/tsc.c:267)
[ 90.714360][ T589] ? local_clock_noinstr (kernel/sched/clock.c:301)
[ 90.714729][ T589] ? local_clock_noinstr (kernel/sched/clock.c:301)
[ 90.715098][ T589] ? __lock_acquire (kernel/locking/lockdep.c:4646)
[ 90.715457][ T589] lock_acquire (kernel/locking/lockdep.c:5825)
[ 90.715775][ T589] ? perf_event_ctx_lock_nested (kernel/events/core.c:1318)
[ 90.716196][ T589] ? __mutex_lock_common (kernel/locking/mutex.c:607)
[ 90.716571][ T589] ? __mutex_lock_common (kernel/locking/mutex.c:607)
[ 90.716963][ T589] __mutex_lock_common (kernel/locking/mutex.c:608)
[ 90.717328][ T589] ? perf_event_ctx_lock_nested (kernel/events/core.c:1318)
[ 90.717747][ T589] ? __this_cpu_preempt_check (lib/smp_processor_id.c:67)
[ 90.718136][ T589] mutex_lock_nested (kernel/locking/mutex.c:752 kernel/locking/mutex.c:804)
[ 90.718477][ T589] ? perf_event_ctx_lock_nested (kernel/events/core.c:1318)
[ 90.718898][ T589] perf_event_ctx_lock_nested (kernel/events/core.c:1318)
[ 90.719302][ T589] perf_mmap (kernel/events/core.c:? kernel/events/core.c:6812)
[ 90.719599][ T589] ? kmem_cache_alloc_noprof (mm/slub.c:4141)
[ 90.719988][ T589] ? kmem_cache_alloc_noprof (include/trace/events/kmem.h:12)
[ 90.720379][ T589] mmap_region (mm/mmap.c:1441)
[ 90.720728][ T589] do_mmap (mm/mmap.c:496)
[ 90.721046][ T589] vm_mmap_pgoff (mm/util.c:588)
[ 90.721387][ T589] ksys_mmap_pgoff (mm/mmap.c:542)
[ 90.721760][ T589] __ia32_sys_mmap_pgoff (mm/mmap.c:553 mm/mmap.c:549 mm/mmap.c:549)
[ 90.722126][ T589] ia32_sys_call (kbuild/obj/consumer/i386-randconfig-015-20241023/./arch/x86/include/generated/asm/syscalls_32.h:?)
[ 90.722462][ T589] do_int80_syscall_32 (arch/x86/entry/common.c:?)
[ 90.722826][ T589] ? exc_page_fault (arch/x86/mm/fault.c:1543)
[ 90.723163][ T589] entry_INT80_32 (arch/x86/entry/entry_32.S:944)
[ 90.723502][ T589] EIP: 0xa7fc5092
[ 90.723762][ T589] Code: 00 00 00 e9 90 ff ff ff ff a3 24 00 00 00 68 30 00 00 00 e9 80 ff ff ff ff a3 f8 ff ff ff 66 90 00 00 00 00 00 00 00 00 cd 80 <c3> 8d b4 26 00 00 00 00 8d b6 00 00 00 00 8b 1c 24 c3 8d b4 26 00
All code
========
0: 00 00 add %al,(%rax)
2: 00 e9 add %ch,%cl
4: 90 nop
5: ff (bad)
6: ff (bad)
7: ff (bad)
8: ff a3 24 00 00 00 jmp *0x24(%rbx)
e: 68 30 00 00 00 push $0x30
13: e9 80 ff ff ff jmp 0xffffffffffffff98
18: ff a3 f8 ff ff ff jmp *-0x8(%rbx)
1e: 66 90 xchg %ax,%ax
...
28: cd 80 int $0x80
2a:* c3 ret <-- trapping instruction
2b: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi
32: 8d b6 00 00 00 00 lea 0x0(%rsi),%esi
38: 8b 1c 24 mov (%rsp),%ebx
3b: c3 ret
3c: 8d .byte 0x8d
3d: b4 26 mov $0x26,%ah
...
Code starting with the faulting instruction
===========================================
0: c3 ret
1: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi
8: 8d b6 00 00 00 00 lea 0x0(%rsi),%esi
e: 8b 1c 24 mov (%rsp),%ebx
11: c3 ret
12: 8d .byte 0x8d
13: b4 26 mov $0x26,%ah
The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20241025/202410251647.21bf487b-lkp@intel.com
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Powered by blists - more mailing lists