Hello Boqun Feng, The patch f66c538098b6: "lockdep/selftests: Use SBRM APIs for wait context tests" from Jul 15, 2023 (linux-next), leads to the following Smatch static checker warning: lib/locking-selftest.c:2577 mutex_in_HARDIRQ() warn: sleeping in atomic context lib/locking-selftest.c 2567 GENERATE_2_CONTEXT_TESTCASE(RCU, , inner, inner_lock) \ 2568 GENERATE_2_CONTEXT_TESTCASE(RCU_BH, , inner, inner_lock) \ 2569 GENERATE_2_CONTEXT_TESTCASE(RCU_SCHED, , inner, inner_lock) \ 2570 GENERATE_2_CONTEXT_TESTCASE(raw_spinlock, &raw_lock_A, inner, inner_lock) \ 2571 GENERATE_2_CONTEXT_TESTCASE(spinlock, &lock_A, inner, inner_lock) \ 2572 GENERATE_2_CONTEXT_TESTCASE(mutex, &mutex_A, inner, inner_lock) 2573 2574 GENERATE_2_CONTEXT_TESTCASE_FOR_ALL_OUTER(RCU, ) 2575 GENERATE_2_CONTEXT_TESTCASE_FOR_ALL_OUTER(raw_spinlock, &raw_lock_B) 2576 GENERATE_2_CONTEXT_TESTCASE_FOR_ALL_OUTER(spinlock, &lock_B) --> 2577 GENERATE_2_CONTEXT_TESTCASE_FOR_ALL_OUTER(mutex, &mutex_B) This takes a mutex from HARD IRQ context which is illegal because HARDIRQ_ENTER() will disable preemption. Enable CONFIG_DEBUG_ATOMIC_SLEEP=y to see this bug at run time. This is a testing file so it does a lot of crazy stuff. It's a bit hard to tell what is intentional and what isn't. lib/locking-selftest.c:336 rlock_AA1() error: double locked '&rwlock_X1' (orig line 335) lib/locking-selftest.c:348 rsem_AA1() error: double locked '&rwsem_X1' (orig line 347) lib/locking-selftest.c:740 double_unlock_spin() error: double unlocked '&lock_A' (orig line 740) lib/locking-selftest.c:742 double_unlock_wlock() error: double unlocked '&rwlock_A' (orig line 742) lib/locking-selftest.c:744 double_unlock_rlock() error: double unlocked '&rwlock_A' (orig line 744) lib/locking-selftest.c:746 double_unlock_mutex() error: double unlocked '&mutex_A' (orig line 746) lib/locking-selftest.c:748 double_unlock_wsem() error: double unlocked '&rwsem_A' (orig line 748) lib/locking-selftest.c:750 double_unlock_rsem() error: double unlocked '&rwsem_A' (orig line 750) lib/locking-selftest.c:1678 ww_test_fail_acquire() warn: 'o.ctx' could be an error pointer lib/locking-selftest.c:1683 ww_test_fail_acquire() error: double locked '&o' (orig line 1676) lib/locking-selftest.c:1691 ww_test_fail_acquire() error: double locked '&o' (orig line 1683) lib/locking-selftest.c:1695 ww_test_fail_acquire() error: double locked '&o.base' (orig line 1686) lib/locking-selftest.c:1696 ww_test_fail_acquire() error: double unlocked '&o' (orig line 1693) lib/locking-selftest.c:1699 ww_test_fail_acquire() warn: inconsistent returns '&o'. lib/locking-selftest.c:1768 ww_test_normal() error: double locked '&o.base' (orig line 1767) lib/locking-selftest.c:1776 ww_test_normal() error: double unlocked '&o.base' (orig line 1770) lib/locking-selftest.c:1830 ww_test_object_unlock_twice() error: double unlocked '&o' (orig line 1829) lib/locking-selftest.c:1872 ww_test_edeadlk_normal() error: double locked '&o2' (orig line 1864) lib/locking-selftest.c:1898 ww_test_edeadlk_normal_slow() error: double locked '&o2' (orig line 1890) lib/locking-selftest.c:1923 ww_test_edeadlk_no_unlock() error: double locked '&o2' (orig line 1916) lib/locking-selftest.c:1948 ww_test_edeadlk_no_unlock_slow() error: double locked '&o2' (orig line 1941) lib/locking-selftest.c:2066 ww_test_edeadlk_acquire_wrong() warn: XXX '&o2' both locked and unlocked. lib/locking-selftest.c:2091 ww_test_edeadlk_acquire_wrong_slow() warn: XXX '&o2' both locked and unlocked. lib/locking-selftest.c:2236 ww_test_spin_block() warn: sleeping in atomic context lib/locking-selftest.c:2255 ww_test_spin_try() error: double locked '&o.base' (orig line 2248) lib/locking-selftest.c:2257 ww_test_spin_try() error: double unlocked '&o' (orig line 2252) lib/locking-selftest.c:2277 ww_test_spin_context() warn: sleeping in atomic context lib/locking-selftest.c:2577 mutex_in_HARDIRQ() warn: sleeping in atomic context regards, dan carpenter