On Wed, 13 Feb 2019, Will Deacon wrote: > On Fri, Feb 08, 2019 at 08:30:25PM +0100, Thomas Gleixner wrote: > > > > How is the in kernel ktime_get() correctness guaranteed then? > > Luck. > > I think we'll have to introduce a dummy dependent stack read into our > counter accessor so that it's ordered by the smp_rmb(). Example diff > below, which I'll roll into a proper patch series later on. Yikes. > static inline u64 arch_counter_get_cntpct(void) > { > + u64 cnt, tmp; > + > isb(); > - return arch_timer_reg_read_stable(cntpct_el0); > + cnt = arch_timer_reg_read_stable(cntpct_el0); > + > + /* > + * This insanity brought to you by speculative, out-of-order system > + * register reads, sequence locks and Thomas Gleixner. ROTFL