Skip to content

Commit 6e442d0

Browse files
committed
Merge branch 'urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu
Pull RCU fixes from Paul McKenney: - fix regressions induced by a merge-window change in scheduler semantics, which means that smp_processor_id() can no longer be used in kthreads using simple affinity to bind themselves to a specific CPU. - fix a bug in Tasks Trace RCU that was thought to be strictly theoretical. However, production workloads have started hitting this, so these fixes need to be merged sooner rather than later. - fix a minor printk()-format-mismatch issue introduced during the merge window. * 'urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu: rcu: Fix pr_info() formats and values in show_rcu_gp_kthreads() rcu-tasks: Don't delete holdouts within trc_wait_for_one_reader() rcu-tasks: Don't delete holdouts within trc_inspect_reader() refscale: Avoid false-positive warnings in ref_scale_reader() scftorture: Avoid false-positive warnings in scftorture_invoker()
2 parents d936eb2 + 2a2ed56 commit 6e442d0

4 files changed

Lines changed: 10 additions & 12 deletions

File tree

kernel/rcu/refscale.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -487,13 +487,13 @@ ref_scale_reader(void *arg)
487487
s64 duration;
488488

489489
VERBOSE_SCALEOUT_BATCH("ref_scale_reader %ld: task started", me);
490-
set_cpus_allowed_ptr(current, cpumask_of(me % nr_cpu_ids));
490+
WARN_ON_ONCE(set_cpus_allowed_ptr(current, cpumask_of(me % nr_cpu_ids)));
491491
set_user_nice(current, MAX_NICE);
492492
atomic_inc(&n_init);
493493
if (holdoff)
494494
schedule_timeout_interruptible(holdoff * HZ);
495495
repeat:
496-
VERBOSE_SCALEOUT_BATCH("ref_scale_reader %ld: waiting to start next experiment on cpu %d", me, smp_processor_id());
496+
VERBOSE_SCALEOUT_BATCH("ref_scale_reader %ld: waiting to start next experiment on cpu %d", me, raw_smp_processor_id());
497497

498498
// Wait for signal that this reader can start.
499499
wait_event(rt->wq, (atomic_read(&nreaders_exp) && smp_load_acquire(&rt->start_reader)) ||
@@ -503,7 +503,7 @@ ref_scale_reader(void *arg)
503503
goto end;
504504

505505
// Make sure that the CPU is affinitized appropriately during testing.
506-
WARN_ON_ONCE(smp_processor_id() != me);
506+
WARN_ON_ONCE(raw_smp_processor_id() != me);
507507

508508
WRITE_ONCE(rt->start_reader, 0);
509509
if (!atomic_dec_return(&n_started))

kernel/rcu/tasks.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -953,10 +953,9 @@ static bool trc_inspect_reader(struct task_struct *t, void *arg)
953953
in_qs = likely(!t->trc_reader_nesting);
954954
}
955955

956-
// Mark as checked. Because this is called from the grace-period
957-
// kthread, also remove the task from the holdout list.
956+
// Mark as checked so that the grace-period kthread will
957+
// remove it from the holdout list.
958958
t->trc_reader_checked = true;
959-
trc_del_holdout(t);
960959

961960
if (in_qs)
962961
return true; // Already in quiescent state, done!!!
@@ -983,7 +982,6 @@ static void trc_wait_for_one_reader(struct task_struct *t,
983982
// The current task had better be in a quiescent state.
984983
if (t == current) {
985984
t->trc_reader_checked = true;
986-
trc_del_holdout(t);
987985
WARN_ON_ONCE(t->trc_reader_nesting);
988986
return;
989987
}

kernel/rcu/tree_stall.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -795,9 +795,9 @@ void show_rcu_gp_kthreads(void)
795795
jr = j - data_race(rcu_state.gp_req_activity);
796796
js = j - data_race(rcu_state.gp_start);
797797
jw = j - data_race(rcu_state.gp_wake_time);
798-
pr_info("%s: wait state: %s(%d) ->state: %#lx ->rt_priority %u delta ->gp_start %lu ->gp_activity %lu ->gp_req_activity %lu ->gp_wake_time %lu ->gp_wake_seq %ld ->gp_seq %ld ->gp_seq_needed %ld ->gp_max %lu ->gp_flags %#x\n",
798+
pr_info("%s: wait state: %s(%d) ->state: %#x ->rt_priority %u delta ->gp_start %lu ->gp_activity %lu ->gp_req_activity %lu ->gp_wake_time %lu ->gp_wake_seq %ld ->gp_seq %ld ->gp_seq_needed %ld ->gp_max %lu ->gp_flags %#x\n",
799799
rcu_state.name, gp_state_getname(rcu_state.gp_state),
800-
rcu_state.gp_state, t ? t->__state : 0x1ffffL, t ? t->rt_priority : 0xffU,
800+
rcu_state.gp_state, t ? t->__state : 0x1ffff, t ? t->rt_priority : 0xffU,
801801
js, ja, jr, jw, (long)data_race(rcu_state.gp_wake_seq),
802802
(long)data_race(rcu_state.gp_seq),
803803
(long)data_race(rcu_get_root()->gp_seq_needed),

kernel/scftorture.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,15 +405,15 @@ static int scftorture_invoker(void *arg)
405405

406406
VERBOSE_SCFTORTOUT("scftorture_invoker %d: task started", scfp->cpu);
407407
cpu = scfp->cpu % nr_cpu_ids;
408-
set_cpus_allowed_ptr(current, cpumask_of(cpu));
408+
WARN_ON_ONCE(set_cpus_allowed_ptr(current, cpumask_of(cpu)));
409409
set_user_nice(current, MAX_NICE);
410410
if (holdoff)
411411
schedule_timeout_interruptible(holdoff * HZ);
412412

413-
VERBOSE_SCFTORTOUT("scftorture_invoker %d: Waiting for all SCF torturers from cpu %d", scfp->cpu, smp_processor_id());
413+
VERBOSE_SCFTORTOUT("scftorture_invoker %d: Waiting for all SCF torturers from cpu %d", scfp->cpu, raw_smp_processor_id());
414414

415415
// Make sure that the CPU is affinitized appropriately during testing.
416-
curcpu = smp_processor_id();
416+
curcpu = raw_smp_processor_id();
417417
WARN_ONCE(curcpu != scfp->cpu % nr_cpu_ids,
418418
"%s: Wanted CPU %d, running on %d, nr_cpu_ids = %d\n",
419419
__func__, scfp->cpu, curcpu, nr_cpu_ids);

0 commit comments

Comments
 (0)