[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230321152900.GA2272870@hirez.programming.kicks-ass.net>
Date: Tue, 21 Mar 2023 16:29:00 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Anna-Maria Behnsen <anna-maria@...utronix.de>
Cc: linux-kernel@...r.kernel.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>
Subject: Re: [PATCH v5 16/18] timer: Implement the hierarchical pull model
On Wed, Mar 01, 2023 at 03:17:42PM +0100, Anna-Maria Behnsen wrote:
> +static bool tmigr_active_up(struct tmigr_group *group,
> + struct tmigr_group *child,
> + void *ptr)
> +{
> + union tmigr_state curstate, newstate;
> + struct tmigr_walk *data = ptr;
> + bool walk_done;
> + u32 childmask;
> +
> + childmask = data->childmask;
> + newstate = curstate = data->groupstate;
> +
> +retry:
> + walk_done = true;
> +
> + if (newstate.migrator == TMIGR_NONE) {
> + newstate.migrator = (u8)childmask;
> +
> + /* Changes need to be propagated */
> + walk_done = false;
> + }
> +
> + newstate.active |= (u8)childmask;
> +
> + newstate.seq++;
> +
> + if (atomic_cmpxchg(group->migr_state, curstate.state, newstate.state) != curstate.state) {
> + newstate.state = curstate.state = atomic_read(group->migr_state);
> + goto retry;
> + }
if (!atomic_try_cmpxchg(group->migr_state, &curstate.state, newstate.state)) {
newstate.state = curstate.state;
goto retry;
}
> +
> + if (group->parent && (walk_done == false)) {
> + data->groupstate.state = atomic_read(group->parent->migr_state);
> + data->childmask = group->childmask;
> + }
> +
> + /*
> + * Group is active, event will be ignored - bit is updated without
> + * holding the lock. In case bit is set while another CPU already
> + * handles remote events, nothing happens, because it is clear that
> + * CPU became active just in this moment, or in worst case event is
> + * handled remote. Nothing to worry about.
> + */
> + group->groupevt.ignore = 1;
> +
> + return walk_done;
> +}
Powered by blists - more mailing lists