lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 12 Jul 2014 13:59:45 +0000 (UTC)
From:	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To:	Thomas Gleixner <tglx@...utronix.de>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	John Stultz <john.stultz@...aro.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Steven Rostedt <rostedt@...dmis.org>
Subject: Re: [patch 54/55] timekeeping: Provide fast and NMI safe access to
 CLOCK_MONOTONIC[_RAW]

----- Original Message -----
> From: "Thomas Gleixner" <tglx@...utronix.de>
> To: "Mathieu Desnoyers" <mathieu.desnoyers@...icios.com>
> Cc: "LKML" <linux-kernel@...r.kernel.org>, "John Stultz" <john.stultz@...aro.org>, "Peter Zijlstra"
> <peterz@...radead.org>, "Steven Rostedt" <rostedt@...dmis.org>
> Sent: Saturday, July 12, 2014 4:11:17 AM
> Subject: Re: [patch 54/55] timekeeping: Provide fast and NMI safe access to CLOCK_MONOTONIC[_RAW]
> 
> On Fri, 11 Jul 2014, Mathieu Desnoyers wrote:
> 
> > ----- Original Message -----
> > > From: "Thomas Gleixner" <tglx@...utronix.de>
> > > To: "LKML" <linux-kernel@...r.kernel.org>
> > > Cc: "John Stultz" <john.stultz@...aro.org>, "Peter Zijlstra"
> > > <peterz@...radead.org>, "Steven Rostedt"
> > > <rostedt@...dmis.org>, "Mathieu Desnoyers"
> > > <mathieu.desnoyers@...icios.com>
> > > Sent: Friday, July 11, 2014 9:45:19 AM
> > > Subject: [patch 54/55] timekeeping: Provide fast and NMI safe access to
> > > CLOCK_MONOTONIC[_RAW]
> > > On the update side:
> > > 
> > >   tkf->seq++;
> > >   smp_wmb();
> > >   update(tkf->base[0], tk;
> > 
> > missing ")"
> 
> :)
>  
> > Any reason why the updater wouldn't do:
> > 
> > tkf->seq++;
> > smp_wmb();
> > update(tkf->base[1 - (tkf->seq & 0x01)], tk);
> > 
> > instead of updating both array entries each time ?
> 
>   base[0];   	      <- Current active
>   seq++;	      -> Makes base[1] the active one for readers
>   update(base[0]);
> 
> So readers are always one update cycle behind. Probably not an issue
> most of the time, but think about fast wrapping clocksources and
> NOHZ....

Ah, yep, got it.

So instead of calling update() twice per update, could we do
the following instead ?

tkf->seq++;
smp_wmb();
update(tkf->base[0], tk);
tkf->seq++;
smp_wmb();
memcpy(tkf->base[1], tkf->base[0], sizeof(tkf->base[1]);

just in case "update" would happen to be expensive for
some clock implementation.

Thanks,

Mathieu


> 
> Thanks,
> 
> 	tglx
> 
> 
> 

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists