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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 09 May 2009 21:59:57 +0200
From:	Peter Zijlstra <a.p.zijlstra@...llo.nl>
To:	Linus Torvalds <torvalds@...ux-foundation.org>
Cc:	Ingo Molnar <mingo@...e.hu>, Paul Mackerras <paulus@...ba.org>,
	Corey Ashford <cjashfor@...ux.vnet.ibm.com>,
	linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH 1/5] hrtimer: per-cpu cached values of ktime

On Sat, 2009-05-09 at 12:45 -0700, Linus Torvalds wrote:
> 
> On Fri, 8 May 2009, Peter Zijlstra wrote:
> >
> > The regular (hrtimer driven) tick calls ktime_get() 4 times:
> > 
> > hrtimer_interupt()
> >   ktimer_get()
> >   __run_hrtimer()
> >     tick_sched_timer()
> >       ktimer_get()
> >       update_process_times()
> >         run_local_timers()
> >         rcu_pending()
> >         printk_tick()
> >         scheduler_tick()
> >           sched_clock_tick()
> >             ktime_get()
> >           perf_counter_task_tick()
> >         run_posix_cpu_timers()
> >       profile_tick()
> >       hrtimer_forward()
> >     hrtimer_enqueue()
> >       tick_program_event()
> >         tick_dev_program_event()
> >           ktime_get()
> > 
> > Reduce that to 2 by caching the 1st ktime_get(). By clearing the state on
> > irq_exit() this always works, even for !hrtimer ticks.
> 
> Ugh. This looks pretty horrid. That special-case cache is just nasty.
> 
> Would it be entirely impossible to just instead do ktime_get() once at the 
> top and just pass it down. Yes, yes, it would involve calling convention 
> changes, but that sounds way saner than having an ad-hoc cache like this.
> 
> With this, you now have magic rules for when you can use the "get from 
> cache" version, and time goes backwards if you mix them by mistake (ie you 
> use a non-caching "ktime_get()" in between two caching "ktime_irq_get()" 
> calls, and now time will have gone backwards from the second to the third 
> case).
> 
> It just seems to be very hacky.

Agreed.. but that would mean passing it down to every hrtimer callback
function, most of whoem won't be interested in it. Furthermore, we'd
have to audit all other 'legacy' timer functions -- but so be it I
guess.

Also, I've had a report that this patch causes some funnies, so there's
definitely something fishy.

I'll look at doing this differently.

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ