lkml.org 
[lkml]   [2015]   [Feb]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 4/4] sched_clock: Avoid deadlock during read from NMI
On Wed, 4 Feb 2015 17:23:51 -0800
Stephen Boyd <sboyd@codeaurora.org> wrote:

> On 01/30, Daniel Thompson wrote:
> > @@ -98,26 +98,50 @@ unsigned long long notrace sched_clock(void)
> > }
> >
> > /*
> > + * Updating the data required to read the clock.
> > + *
> > + * sched_clock will never observe mis-matched data even if called from
> > + * an NMI. We do this by maintaining an odd/even copy of the data and
> > + * steering sched_clock to one or the other using a sequence counter.
> > + * In order to preserve the data cache profile of sched_clock as much
> > + * as possible the system reverts back to the even copy when the update
> > + * completes; the odd copy is used *only* during an update.
> > + */
> > +static void update_clock_read_data(struct clock_read_data *rd)
>
> notrace?

Why? Isn't this for update, not for readers?

-- Steve

>
> > +{
> > + /* update the backup (odd) copy with the new data */
> > + cd.read_data[1] = *rd;
> > +
> > + /* steer readers towards the new data */
>
> s/new data/odd copy/?
>
> > + raw_write_seqcount_latch(&cd.seq);
> > +
> > + /* now its safe for us to update the normal (even) copy */
> > + cd.read_data[0] = *rd;
> > +
> > + /* switch readers back to the even copy */
> > + raw_write_seqcount_latch(&cd.seq);
> > +}
> > +
> > +/*
> >
>



\
 
 \ /
  Last update: 2015-02-05 03:01    [W:0.079 / U:0.480 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site