* John Stultz <[email protected]> wrote:

> On 12/18/2013 02:08 AM, Ingo Molnar wrote:
> > * John Stultz <[email protected]> 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 <[email protected]>
> >> Cc: Thomas Gleixner <[email protected]>
> >> Cc: Ingo Molnar <[email protected]>
> >> Cc: David Vrabel <[email protected]>
> >> Cc: Konrad Rzeszutek Wilk <[email protected]>
> >> Cc: Prarit Bhargava <[email protected]>
> >> Cc: Richard Cochran <[email protected]>
> >> Cc: <[email protected]>
> >> Cc: stable <[email protected]> #3.11+
> >> Signed-off-by: John Stultz <[email protected]>
> >> ---
> >>  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'?
> 
> Sure, I was reusing the existing variables, but no issue changing 
> the name here too.
>
> > 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?
> 
> Huh. Ok, I don't see the parameters structure likely being reused, 
> so this would be a special struct only for the 
> logarithmic_accumulation() call?

Yeah. If you think that's overkill then I'm fine with your original 
result-pointer approach as well, as long as it's named talkatively.

> Also, since we want to pass down TK_CLOCK_WAS_SET to 
> timekeeping_update, you ok with clock_was_set being an int instead 
> of a bool?

Sure - I didn't notice that detail.

Thanks,

        Ingo
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to