mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Anna-Maria Behnsen <anna-maria@linutronix.de>
To: Frederic Weisbecker <frederic@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>,
	John Stultz <jstultz@google.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Eric Dumazet <edumazet@google.com>,
	"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
	Arjan van de Ven <arjan@infradead.org>,
	"Paul E . McKenney" <paulmck@kernel.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Rik van Riel <riel@surriel.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Sebastian Siewior <bigeasy@linutronix.de>,
	Giovanni Gherdovich <ggherdovich@suse.cz>,
	Lukasz Luba <lukasz.luba@arm.com>,
	"Gautham R . Shenoy" <gautham.shenoy@amd.com>
Subject: Re: [PATCH v7 19/21] timer: Implement the hierarchical pull model
Date: Mon, 12 Jun 2023 14:29:25 +0200 (CEST)	[thread overview]
Message-ID: <46bb6830-660-f9ff-db1c-f67d680ea8c@linutronix.de> (raw)
In-Reply-To: <ZICMBw-Fo-nzqGXb@2a01cb0980007dab8d6b2773c13fd2df.ipv6.abo.wanadoo.fr>

[-- Attachment #1: Type: text/plain, Size: 3165 bytes --]

On Wed, 7 Jun 2023, Frederic Weisbecker wrote:

> Le Wed, May 24, 2023 at 09:06:27AM +0200, Anna-Maria Behnsen a écrit :
> > +/*
> > + * Returns true, if there is nothing to be propagated to the next level
> > + *
> > + * @data->nextexp is reset to KTIME_MAX; it is reused for first global
> > + * event which needs to be handled by migrator (in toplevel group)
> > + *
> > + * This is the only place where group event expiry value is set.
> > + */
> > +static bool tmigr_update_events(struct tmigr_group *group,
> > +				struct tmigr_group *child,
> > +				struct tmigr_walk *data)
> > +{
> > +	struct tmigr_event *evt, *first_childevt;
> > +	bool walk_done, remote = data->remote;
> > +	u64 nextexp;
> > +
> > +	if (child) {
> > +		if (data->childstate.active)
> > +			return true;
> > +
> > +		raw_spin_lock(&child->lock);
> > +		raw_spin_lock_nested(&group->lock, SINGLE_DEPTH_NESTING);
> > +
> > +		first_childevt = tmigr_next_groupevt(child);
> > +		nextexp = child->next_expiry;
> > +		evt = &child->groupevt;
> > +	} else {
> > +		nextexp = data->nextexp;
> > +
> > +		/*
> > +		 * Set @data->nextexp to KTIME_MAX; it is reused for first
> > +		 * global event which needs to be handled by migrator (in
> > +		 * toplevel group)
> > +		 */
> > +		data->nextexp = KTIME_MAX;
> > +
> > +		first_childevt = evt = data->evt;
> > +
> > +		/*
> > +		 * Walking the hierarchy is required in any case, when a
> > +		 * remote expiry was done before.
> 
> You can probably remove that comma because it feels like breaking the condition link.
> 
> > +		 * This ensures to not lost
> 
> lose
> 
> > +		 * already queued events in non active groups (see section
> > +		 * "Required event and timerqueue update after remote
> > +		 * expiry" in documentation at the top).
> > +		 */
> > +		if (evt->ignore && !remote)
> 
> It looks like in the case of !remote, this branch will never end up
> stopping the propagation up because either:
> 
> * We come here from tmigr_inactive_up() which takes care of the propagation.
> 
> or
> 
> * We come here from tmigr_new_timer() and ->ignore can't be set.
> 
> If I'm right, can we add a comment about that so that the poor reviewer
> doesn't stutter on that for too long?
> 

Right. It will never stop the propagation - but the condition could be
fulfilled when call site is tmigr_inactive_up(). My proposal for expanding
the comment is the following:

	/*
	 * Walking the hierarchy is required in any case when a
	 * remote expiry was done before. This ensures to not lose
	 * already queued events in non active groups (see section
	 * "Required event and timerqueue update after remote
	 * expiry" in documentation at the top).
	 *
	 * The two call sites which are executed without a remote expiry
	 * before, are not prevented from propagating changes through
	 * the hierarchy by the return:
	 *  - When entering this path by tmigr_new_timer(), evt->ignore
	 *    is never set.
	 *  - tmigr_inactive_up() takes care of propagation by itself
	 *    and ignores return value. But an immediate return is
	 *    required because nothing has to be done in this level as
	 *    event could be ignored.
	 */

Thanks,

	Anna-Maria

  reply	other threads:[~2023-06-12 12:30 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-24  7:06 [PATCH v7 00/21] timer: Move from a push remote at enqueue to a pull at expiry model Anna-Maria Behnsen
2023-05-24  7:06 ` [PATCH v7 01/21] tick-sched: Warn when next tick seems to be in the past Anna-Maria Behnsen
2023-05-24  7:06 ` [PATCH v7 02/21] timer: Do not IPI for deferrable timers Anna-Maria Behnsen
2023-06-05 21:29   ` Frederic Weisbecker
2023-05-24  7:06 ` [PATCH v7 03/21] timer: Add comment to get_next_timer_interrupt() description Anna-Maria Behnsen
2023-05-24  7:06 ` [PATCH v7 04/21] timer: Move store of next event into __next_timer_interrupt() Anna-Maria Behnsen
2023-05-24  7:06 ` [PATCH v7 05/21] timer: Split next timer interrupt logic Anna-Maria Behnsen
2023-05-24  7:06 ` [PATCH v7 06/21] timer: Rework idle logic Anna-Maria Behnsen
2023-05-24  7:06 ` [PATCH v7 07/21] timers: Introduce add_timer() variants which modify timer flags Anna-Maria Behnsen
2023-05-24  7:06 ` [PATCH v7 08/21] workqueue: Use global variant for add_timer() Anna-Maria Behnsen
2023-06-05 22:25   ` Frederic Weisbecker
2023-05-24  7:06 ` [PATCH v7 09/21] timer: add_timer_on(): Make sure TIMER_PINNED flag is set Anna-Maria Behnsen
2023-06-05 22:26   ` Frederic Weisbecker
2023-05-24  7:06 ` [PATCH v7 10/21] timers: Ease code in run_local_timers() Anna-Maria Behnsen
2023-05-24  7:06 ` [PATCH v7 11/21] timers: Create helper function to forward timer base clk Anna-Maria Behnsen
2023-05-24  7:06 ` [PATCH v7 12/21] timer: Keep the pinned timers separate from the others Anna-Maria Behnsen
2023-06-06 10:27   ` Frederic Weisbecker
2023-05-24  7:06 ` [PATCH v7 13/21] timer: Retrieve next expiry of pinned/non-pinned timers separately Anna-Maria Behnsen
2023-05-24  7:06 ` [PATCH v7 14/21] timer: Split out "get next timer interrupt" functionality Anna-Maria Behnsen
2023-05-24  7:06 ` [PATCH v7 15/21] timer: Add get next timer interrupt functionality for remote CPUs Anna-Maria Behnsen
2023-06-07 14:55   ` Frederic Weisbecker
2023-06-12 12:01     ` Anna-Maria Behnsen
2023-05-24  7:06 ` [PATCH v7 16/21] timer: Restructure internal locking Anna-Maria Behnsen
2023-05-24  7:06 ` [PATCH v7 17/21] timer: Check if timers base is handled already Anna-Maria Behnsen
2023-05-24  7:06 ` [PATCH v7 18/21] tick/sched: Split out jiffies update helper function Anna-Maria Behnsen
2023-05-24  7:06 ` [PATCH v7 19/21] timer: Implement the hierarchical pull model Anna-Maria Behnsen
2023-06-06 20:10   ` Frederic Weisbecker
2023-06-07 13:54   ` Frederic Weisbecker
2023-06-12 12:29     ` Anna-Maria Behnsen [this message]
2023-06-12 14:30       ` Frederic Weisbecker
2023-06-11 21:19   ` Frederic Weisbecker
2023-06-12 15:09   ` Frederic Weisbecker
2023-06-12 15:57     ` Anna-Maria Behnsen
2023-06-12 21:20       ` Frederic Weisbecker
2023-06-13 10:51   ` Frederic Weisbecker
2023-05-24  7:06 ` [PATCH v7 20/21] timer_migration: Add tracepoints Anna-Maria Behnsen
2023-05-24  7:06 ` [PATCH v7 21/21] timer: Always queue timers on the local CPU Anna-Maria Behnsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46bb6830-660-f9ff-db1c-f67d680ea8c@linutronix.de \
    --to=anna-maria@linutronix.de \
    --cc=arjan@infradead.org \
    --cc=bigeasy@linutronix.de \
    --cc=edumazet@google.com \
    --cc=frederic@kernel.org \
    --cc=fweisbec@gmail.com \
    --cc=gautham.shenoy@amd.com \
    --cc=ggherdovich@suse.cz \
    --cc=jstultz@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=riel@surriel.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®