Skip to content

Commit eec1f94

Browse files
paulmckrcuNeeraj Upadhyay (AMD)
authored andcommitted
rcutorture: Make rcutorture_one_extend_check() account for hard IRQs
This commit retrospectively prepares for testing of RCU readers invoked from hardware interrupt handlers (for example, HRTIMER_MODE_HARD hrtimer handlers) in kernels built with CONFIG_RCU_TORTURE_TEST_CHK_RDR_STATE=y, which is rarely used but sometimes extremely useful. This preparation involves taking early exits if in_hardirq(), and, while we are in the area, a very early exit if in_nmi(). This means that a number of insoftirq parameters are no longer needed, but that is the subject of a later commit. Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-lkp/[email protected] Signed-off-by: Paul E. McKenney <[email protected]> Tested-by: kernel test robot <[email protected]> Signed-off-by: Neeraj Upadhyay (AMD) <[email protected]>
1 parent 635bdb9 commit eec1f94

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

kernel/rcu/rcutorture.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,10 +1920,10 @@ static void rcutorture_one_extend_check(char *s, int curstate, int new, int old,
19201920
{
19211921
int mask;
19221922

1923-
if (!IS_ENABLED(CONFIG_RCU_TORTURE_TEST_CHK_RDR_STATE))
1923+
if (!IS_ENABLED(CONFIG_RCU_TORTURE_TEST_CHK_RDR_STATE) || in_nmi())
19241924
return;
19251925

1926-
WARN_ONCE(!(curstate & RCUTORTURE_RDR_IRQ) && irqs_disabled(), ROEC_ARGS);
1926+
WARN_ONCE(!(curstate & RCUTORTURE_RDR_IRQ) && irqs_disabled() && !in_hardirq(), ROEC_ARGS);
19271927
WARN_ONCE((curstate & RCUTORTURE_RDR_IRQ) && !irqs_disabled(), ROEC_ARGS);
19281928

19291929
// If CONFIG_PREEMPT_COUNT=n, further checks are unreliable.
@@ -1938,9 +1938,9 @@ static void rcutorture_one_extend_check(char *s, int curstate, int new, int old,
19381938
(curstate & (RCUTORTURE_RDR_RCU_1 | RCUTORTURE_RDR_RCU_2)) &&
19391939
cur_ops->readlock_nesting() == 0, ROEC_ARGS);
19401940

1941-
// Timer handlers have all sorts of stuff disabled, so ignore
1941+
// Interrupt handlers have all sorts of stuff disabled, so ignore
19421942
// unintended disabling.
1943-
if (insoftirq)
1943+
if (in_serving_softirq() || in_hardirq())
19441944
return;
19451945

19461946
WARN_ONCE(cur_ops->extendables &&

0 commit comments

Comments
 (0)