All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: John Stultz <john.stultz@linaro.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Sasha Levin <sasha.levin@oracle.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	David Vrabel <david.vrabel@citrix.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Prarit Bhargava <prarit@redhat.com>,
	Richard Cochran <richardcochran@gmail.com>,
	xen-devel@lists.xen.org, stable <stable@vger.kernel.org>
Subject: Re: [PATCH 2/3] timekeeping: Fix potential lost pv notification of time change
Date: Wed, 18 Dec 2013 11:08:07 +0100	[thread overview]
Message-ID: <20131218100807.GC19319@gmail.com> (raw)
In-Reply-To: <1387308457-25364-3-git-send-email-john.stultz@linaro.org>


* John Stultz <john.stultz@linaro.org> wrote:

> In 780427f0e11 (Indicate that clock was set in the pvclock
> gtod notifier), logic was added to pass a CLOCK_WAS_SET
> notification to the pvclock notifier chain.
> 
> While that patch added a action flag returned from
> accumulate_nsecs_to_secs(), it only uses the returned value
> in one location, and not in the logarithmic accumulation.
> 
> This means if a leap second triggered during the logarithmic
> accumulation (which is most likely where it would happen),
> the notification that the clock was set would not make it to
> the pv notifiers.
> 
> This patch extends the logarithmic_accumulation pass down
> that action flag so proper notification will occur.
> 
> Cc: Sasha Levin <sasha.levin@oracle.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: David Vrabel <david.vrabel@citrix.com>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Cc: Prarit Bhargava <prarit@redhat.com>
> Cc: Richard Cochran <richardcochran@gmail.com>
> Cc: <xen-devel@lists.xen.org>
> Cc: stable <stable@vger.kernel.org> #3.11+
> Signed-off-by: John Stultz <john.stultz@linaro.org>
> ---
>  kernel/time/timekeeping.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
> index 6bad3d9..998ec751 100644
> --- a/kernel/time/timekeeping.c
> +++ b/kernel/time/timekeeping.c
> @@ -1295,7 +1295,7 @@ static inline unsigned int accumulate_nsecs_to_secs(struct timekeeper *tk)
>   * Returns the unconsumed cycles.
>   */
>  static cycle_t logarithmic_accumulation(struct timekeeper *tk, cycle_t offset,
> -						u32 shift)
> +						u32 shift, unsigned int *action)

I have two complaints about this patch:

1)

I think the 'action' name sucks because it's too obfuscated. It's only 
ever set to TK_CLOCK_WAS_SET, so why not name it more descriptively, 
i.e. 'clock_was_set'?

2)

Secondly, the proliferation of parameters passed around I think calls 
for a helper structure which would carry the (offset, shift, 
clock_was_set) triple:

	struct acc_params {
		cycle_t		offset;
		u32		shift;
		bool		clock_was_set;
	};

And then passed down like this:

>  static cycle_t logarithmic_accumulation(struct timekeeper *tk, struct acc_params *params)

Agreed?

Thanks,

	Ingo

  parent reply	other threads:[~2013-12-18 10:08 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-17 19:27 [PATCH 0/3] Timekeeping fixes for 3.13 via tip/timers/urgent John Stultz
2013-12-17 19:27 ` [PATCH 1/3] timekeeping: Fix lost updates to tai adjustment John Stultz
2013-12-17 19:27 ` [PATCH 2/3] timekeeping: Fix potential lost pv notification of time change John Stultz
2013-12-17 19:27 ` John Stultz
2013-12-18 10:08   ` Ingo Molnar
2013-12-18 10:08   ` Ingo Molnar [this message]
2013-12-18 18:44     ` John Stultz
2013-12-18 19:14       ` John Stultz
2013-12-18 19:14       ` John Stultz
2013-12-19 12:48       ` Ingo Molnar
2013-12-19 12:48       ` Ingo Molnar
2013-12-18 18:44     ` John Stultz
2013-12-17 19:27 ` [PATCH 3/3] timekeeping: Avoid possible deadlock from clock_was_set_delayed John Stultz
  -- strict thread matches above, loose matches on Subject: below --
2013-12-20 18:59 [PATCH 0/3] Timekeeping fixes for 3.13? (v2) John Stultz
2013-12-20 18:59 ` [PATCH 2/3] timekeeping: Fix potential lost pv notification of time change John Stultz
2013-12-20 18:59 ` John Stultz

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=20131218100807.GC19319@gmail.com \
    --to=mingo@kernel.org \
    --cc=david.vrabel@citrix.com \
    --cc=john.stultz@linaro.org \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=prarit@redhat.com \
    --cc=richardcochran@gmail.com \
    --cc=sasha.levin@oracle.com \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=xen-devel@lists.xen.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.