[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZH-SwxgV-Ec9ulq-@localhost.localdomain>
Date: Tue, 6 Jun 2023 22:10:43 +0200
From: Frederic Weisbecker <frederic@...nel.org>
To: Anna-Maria Behnsen <anna-maria@...utronix.de>
Cc: linux-kernel@...r.kernel.org,
Peter Zijlstra <peterz@...radead.org>,
John Stultz <jstultz@...gle.com>,
Thomas Gleixner <tglx@...utronix.de>,
Eric Dumazet <edumazet@...gle.com>,
"Rafael J . Wysocki" <rafael.j.wysocki@...el.com>,
Arjan van de Ven <arjan@...radead.org>,
"Paul E . McKenney" <paulmck@...nel.org>,
Frederic Weisbecker <fweisbec@...il.com>,
Rik van Riel <riel@...riel.com>,
Steven Rostedt <rostedt@...dmis.org>,
Sebastian Siewior <bigeasy@...utronix.de>,
Giovanni Gherdovich <ggherdovich@...e.cz>,
Lukasz Luba <lukasz.luba@....com>,
"Gautham R . Shenoy" <gautham.shenoy@....com>
Subject: Re: [PATCH v7 19/21] timer: Implement the hierarchical pull model
Le Wed, May 24, 2023 at 09:06:27AM +0200, Anna-Maria Behnsen a écrit :
> +u64 tmigr_cpu_deactivate(u64 nextexp)
> +{
> + struct tmigr_cpu *tmc = this_cpu_ptr(&tmigr_cpu);
> + u64 ret;
> +
> + if (!is_tmigr_enabled() || !tmc->tmgroup || !tmc->online)
> + return nextexp;
> +
> + raw_spin_lock(&tmc->lock);
> +
> + /*
> + * CPU is already deactivated in timer migration
> + * hierarchy. tick_nohz_get_sleep_length() calls
> + * tick_nohz_next_event() and thereby timer idle path is
> + * executed once more. tmc->wakeup holds the first timer, when
> + * timer migration hierarchy is completely idle and remote
> + * expiry was done.
This can also hold the first timer in the hierarchy on nodes
having no true migrator, but still with upper nodes having potentially
a migrator, right??
> + * If there is no new next expiry value
> + * handed in which should be inserted into the timer migration
> + * hierarchy, wakeup value is returned.
> + */
> + if (tmc->idle) {
> + ret = tmc->wakeup;
> +
> + tmc->wakeup = KTIME_MAX;
> +
> + if (nextexp != KTIME_MAX) {
This seem to assume that tick_nohz_next_event() on the last idle CPU in an idle
hierarchy is always called right after a timer interrupt arriving on time
(ie: right after a call to tmigr_handle_remote()), but this can actually be called
after any interrupt. Can the following happen or am I overlooking something?
do_idle() {
// ===> <IRQ>
tmigr_handle_remote() {
// find some timer in the hierarchy
// expiring in 2 jiffies
tmc->wakeup = jiffies + 2
}
//<=== </IRQ>
tick_nohz_get_sleep_length() {
get_next_timer_interrupt() {
tmigr_cpu_deactivate() {
wakeup = tmc->wakeup
tmc->wakeup = KTIME_MAX
return wakeup // jiffies + 2
}
}
}
tick_nohz_idle_stop_tick() {
// SLEEP 2 jiffies
}
// ===> <IRQ>
// whatever IRQ that is not timer
// or a timer IRQ firing too early
//<=== </IRQ>
tick_nohz_get_sleep_length() {
get_next_timer_interrupt() {
tmigr_cpu_deactivate() {
wakeup = tmc->wakeup
tmc->wakeup = KTIME_MAX
return wakeup // KTIME_MAX
}
}
}
tick_nohz_idle_stop_tick() {
// SLEEP forever, misses the timer in 2 jiffies
}
}
Thanks.
Powered by blists - more mailing lists