x86/hpet: Improve handling of timer_deadline
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 31 May 2017 13:56:26 +0000 (14:56 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 15 Aug 2017 14:08:57 +0000 (15:08 +0100)
commit9e051a840d7f7121118470a55d2d600b46be97f7
tree2579ccf2caadcaaa7b9192f046e810d8914dcf05
parent6e2a4c73564ab907b732059adb317d6ca2d138a2
x86/hpet: Improve handling of timer_deadline

timer_deadline is only ever updated via this_cpu() in timer_softirq_action(),
so is not going to change behind the back of the currently running cpu.

Update hpet_broadcast_{enter,exit}() to cache the value in a local variable to
avoid the repeated RELOC_HIDE() penalty.

handle_hpet_broadcast() reads the timer_deadlines of remote cpus, but there is
no need to force the read for cpus which are not present in the mask.  One
requirement is that we only sample the value once (which happens as a side
effect of RELOC_HIDE()), but is made more explicit with ACCESS_ONCE().

Bloat-o-meter shows a modest improvement:

  add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-144 (-144)
  function                                     old     new   delta
  hpet_broadcast_exit                          335     313     -22
  hpet_broadcast_enter                         327     278     -49
  handle_hpet_broadcast                        572     499     -73

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/hpet.c