Skip to content

Commit 204ab51

Browse files
paulmckrcuFrederic Weisbecker
authored andcommitted
refscale: Do not disable interrupts for tests involving local_bh_enable()
Some kernel configurations prohibit invoking local_bh_enable() while interrupts are disabled. However, refscale disables interrupts to reduce OS noise during the tests, which results in splats. This commit therefore adds an ->enable_irqs flag to the ref_scale_ops structure, and refrains from disabling interrupts when that flag is set. This flag is set for the "bh" and "incpercpubh" scale_type module-parameter values. Signed-off-by: Paul E. McKenney <paulmck@kernel.org> Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
1 parent 448b66a commit 204ab51

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

kernel/rcu/refscale.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ struct ref_scale_ops {
136136
void (*cleanup)(void);
137137
void (*readsection)(const int nloops);
138138
void (*delaysection)(const int nloops, const int udl, const int ndl);
139+
bool enable_irqs;
139140
const char *name;
140141
};
141142

@@ -488,6 +489,7 @@ static const struct ref_scale_ops incpercpubh_ops = {
488489
.init = rcu_sync_scale_init,
489490
.readsection = ref_incpercpubh_section,
490491
.delaysection = ref_incpercpubh_delay_section,
492+
.enable_irqs = true,
491493
.name = "incpercpubh"
492494
};
493495

@@ -865,6 +867,7 @@ static void ref_bh_delay_section(const int nloops, const int udl, const int ndl)
865867
static const struct ref_scale_ops bh_ops = {
866868
.readsection = ref_bh_section,
867869
.delaysection = ref_bh_delay_section,
870+
.enable_irqs = true,
868871
.name = "bh"
869872
};
870873

@@ -1227,15 +1230,18 @@ ref_scale_reader(void *arg)
12271230
if (!atomic_dec_return(&n_warmedup))
12281231
while (atomic_read_acquire(&n_warmedup))
12291232
rcu_scale_one_reader();
1230-
// Also keep interrupts disabled. This also has the effect
1231-
// of preventing entries into slow path for rcu_read_unlock().
1232-
local_irq_save(flags);
1233+
// Also keep interrupts disabled when it is safe to do so, which
1234+
// it is not for local_bh_enable(). This also has the effect of
1235+
// preventing entries into slow path for rcu_read_unlock().
1236+
if (!cur_ops->enable_irqs)
1237+
local_irq_save(flags);
12331238
start = ktime_get_mono_fast_ns();
12341239

12351240
rcu_scale_one_reader();
12361241

12371242
duration = ktime_get_mono_fast_ns() - start;
1238-
local_irq_restore(flags);
1243+
if (!cur_ops->enable_irqs)
1244+
local_irq_restore(flags);
12391245

12401246
rt->last_duration_ns = WARN_ON_ONCE(duration < 0) ? 0 : duration;
12411247
// To reduce runtime-skew noise, do maintain-load invocations until

0 commit comments

Comments
 (0)