[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190924112155.rxeyksetgqmer3pg@linutronix.de>
Date: Tue, 24 Sep 2019 13:21:55 +0200
From: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
To: Scott Wood <swood@...hat.com>
Cc: linux-rt-users@...r.kernel.org, linux-kernel@...r.kernel.org,
"Paul E . McKenney" <paulmck@...ux.ibm.com>,
Joel Fernandes <joel@...lfernandes.org>,
Thomas Gleixner <tglx@...utronix.de>,
Steven Rostedt <rostedt@...dmis.org>,
Peter Zijlstra <peterz@...radead.org>,
Juri Lelli <juri.lelli@...hat.com>,
Clark Williams <williams@...hat.com>
Subject: Re: [PATCH RT v3 3/5] sched: migrate_dis/enable: Use rt_invol_sleep
On 2019-09-23 19:52:33 [+0200], To Scott Wood wrote:
I made dis:
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 885a195dfbe02..25afa2bb1a2cf 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -308,7 +308,9 @@ void pin_current_cpu(void)
preempt_lazy_enable();
preempt_enable();
+ sleeping_lock_inc();
__read_rt_lock(cpuhp_pin);
+ sleeping_lock_dec();
preempt_disable();
preempt_lazy_disable();
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index e1bdd7f9be054..63a6420d01053 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7388,6 +7388,7 @@ void migrate_enable(void)
WARN_ON(smp_processor_id() != task_cpu(p));
if (!cpumask_test_cpu(task_cpu(p), &p->cpus_mask)) {
+ struct task_struct *self = current;
const struct cpumask *cpu_valid_mask = cpu_active_mask;
struct migration_arg arg;
unsigned int dest_cpu;
@@ -7405,7 +7406,21 @@ void migrate_enable(void)
unpin_current_cpu();
preempt_lazy_enable();
preempt_enable();
+ rt_invol_sleep_inc();
+
+ raw_spin_lock_irq(&self->pi_lock);
+ self->saved_state = self->state;
+ __set_current_state_no_track(TASK_RUNNING);
+ raw_spin_unlock_irq(&self->pi_lock);
+
stop_one_cpu(task_cpu(p), migration_cpu_stop, &arg);
+
+ raw_spin_lock_irq(&self->pi_lock);
+ __set_current_state_no_track(self->saved_state);
+ self->saved_state = TASK_RUNNING;
+ raw_spin_unlock_irq(&self->pi_lock);
+
+ rt_invol_sleep_dec();
return;
}
}
I think we need to preserve the current state, otherwise we will lose
anything != TASK_RUNNING here. So the spin_lock() would preserve it
while waiting but the migrate_enable() will lose it if it needs to
change the CPU at the end.
I will try to prepare all commits for the next release before I release
so you can have a look first and yell if needed.
> > -Scott
Sebastian
Powered by blists - more mailing lists