On Thu, 14 May 2026 at 07:08, Jia He <[email protected]> wrote: > > On systems with many CPUs (e.g. 128 cores x 4 HW breakpoint slots = > 512 = MAX_TEST_BREAKPOINTS), test_many_cpus() advances idx to > MAX_TEST_BREAKPOINTS after the last fill_bp_slots(). The subsequent > register_test_bp() call hits WARN_ON(idx >= MAX_TEST_BREAKPOINTS), > returns NULL, and the -ENOSPC expectation fails. > > Bail out of the loop when idx reaches the limit. Earlier iterations > already validate the NOSPC path on other CPUs. > > To: Peter Zijlstra <[email protected]> > To: Ingo Molnar <[email protected]> > To: Arnaldo Carvalho de Melo <[email protected]> > To: Namhyung Kim <[email protected]> > To: Mark Rutland <[email protected]> > To: Alexander Shishkin <[email protected]> > To: Jiri Olsa <[email protected]> > To: Ian Rogers <[email protected]> > To: Adrian Hunter <[email protected]> > To: James Clark <[email protected]> > Cc: [email protected] > > Signed-off-by: Jia He <[email protected]>
Reviewed-by: Marco Elver <[email protected]> > --- > kernel/events/hw_breakpoint_test.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/kernel/events/hw_breakpoint_test.c > b/kernel/events/hw_breakpoint_test.c > index 2cfeeecf8de9..943d040d2224 100644 > --- a/kernel/events/hw_breakpoint_test.c > +++ b/kernel/events/hw_breakpoint_test.c > @@ -137,6 +137,9 @@ static void test_many_cpus(struct kunit *test) > for_each_online_cpu(cpu) { > bool do_continue = fill_bp_slots(test, &idx, cpu, NULL, 0); > > + if (idx >= MAX_TEST_BREAKPOINTS) > + break; > + > TEST_EXPECT_NOSPC(register_test_bp(cpu, NULL, idx)); > if (!do_continue) > break; > -- > 2.34.1 >

