Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] Data race on lockless global `dept_ut_results` test counters. --
commit ed16879949bb8cfa840ac89b2502567868a42cfe Author: Byungchul Park <[email protected]> dept: implement a basic unit test for dept This commit introduces CONFIG_DEPT_UNIT_TEST and a corresponding kernel module that runs basic unit tests for the Dependency Tracker (DEPT). > diff --git a/include/linux/dept_unit_test.h b/include/linux/dept_unit_test.h > new file mode 100644 > index 0000000000000..753ac9ac727c6 > --- /dev/null > +++ b/include/linux/dept_unit_test.h [ ... ] > +static inline void dept_ut_ecxt_stack_account(bool valid) > +{ > + dept_ut_results.ecxt_stack_total_cnt++; [Severity: Medium] Since this global counter is incremented non-atomically, can it race with concurrent DEPT evaluations (e.g., from print_dep()) on other CPUs? A standard data race here might lead to corrupted test counters or trigger KCSAN warnings. [ ... ] > diff --git a/kernel/dependency/dept_unit_test.c > b/kernel/dependency/dept_unit_test.c > new file mode 100644 > index 0000000000000..e8dada2e3dfba > --- /dev/null > +++ b/kernel/dependency/dept_unit_test.c [ ... ] > +static DEFINE_SPINLOCK(s1); > +static DEFINE_SPINLOCK(s2); > +static bool test_spin_lock_deadlock(void) > +{ > + dept_ut_results.circle_detected = false; [Severity: Medium] Is it safe to reset this flag without protection? If a genuine dependency issue triggers DEPT on another CPU and calls print_circle() concurrently, could it set circle_detected to true and interfere with this test's result? [ ... ] > +static int __init dept_ut_init(void) > +{ > + int i; > + > + lockdep_off(); > + > + dept_ut_results.ecxt_stack_valid_cnt = 0; > + dept_ut_results.ecxt_stack_total_cnt = 0; > + dept_ut_results.wait_stack_valid_cnt = 0; > + dept_ut_results.wait_stack_total_cnt = 0; > + dept_ut_results.evnt_stack_valid_cnt = 0; > + dept_ut_results.evnt_stack_total_cnt = 0; [Severity: Medium] Could resetting these global counters locklessly and without accessors like WRITE_ONCE cause issues? It appears this setup could race with concurrent DEPT reports modifying them simultaneously in print_dep(). -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=40

