android_kernel_xiaomi_sm8350/arch
Robin Holt b291aa7a65 x86_64: fix HPET init race
I have had four seperate system lockups attributable to this exact problem
in two days of testing.  Instead of trying to handle all the weird end
cases and wrap, how about changing it to look for exactly what we appear
to want.

The following patch removes a couple races in setup_APIC_timer.  One occurs
when the HPET advances the COUNTER past the T0_CMP value between the time
the T0_CMP was originally read and when COUNTER is read.  This results in
a delay waiting for the counter to wrap.  The other results from the counter
wrapping.

This change takes a snapshot of T0_CMP at the beginning of the loop and
simply loops until T0_CMP has changed (a tick has happened).

<later>

I have one small concern about the patch.  I am not sure it meets the intent
as well as it should.  I think we are trying to match APIC timer interrupts up
with the hpet counter increment.  The event which appears to be disturbing
this loop in our test environment is the NMI watchdog.  What we believe has
been happening with the existing code is the setup_APIC_timer loop has read
the CMP value, and the NMI watchdog code fires for the first time.  This
results in a series of icache miss slowdowns and by the time we get back to
things it has wrapped.

I think this code is trying to get the CMP as close to the counter value as
possible.  If that is the intent, maybe we should really be testing against a
"window" around the CMP.  Something like COUNTER = CMP+/2.  It appears COUNTER
should get advanced every 89nSec (IIRC).  The above seems like an unreasonably
small window, but may be necessary.  Without documentation, I am not sure of
the original intent with this code.

In summary, this code fixes my boot hangs, but since I am not certain of the
intent of the existing code, I am not certain this has not introduced new bugs
or unexpected behaviors.

Signed-off-by: Robin Holt <holt@sgi.com>
Acked-by: Andi Kleen <ak@suse.de>
Cc: Vojtech Pavlik <vojtech@suse.cz>
Cc: "Aaron Durbin" <adurbin@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-08-11 15:47:39 -07:00
..
alpha add a missing LIB_Y to arch/alpha/boot Makefile 2007-07-31 15:39:39 -07:00
arm [ARM] rpc: update defconfig 2007-08-06 16:48:49 +01:00
avr32
blackfin Blackfin arch: after removing fs.h from mm.h, fix the broken on Blackfin arch 2007-08-11 15:47:39 -07:00
cris
frv FRV: Enable the MB86943 PCI arbiter correctly 2007-08-01 20:48:17 -07:00
h8300
i386 [x86 setup] EDD: add missing =m constraint 2007-08-02 13:45:49 -04:00
ia64 Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6 2007-08-01 20:48:54 -07:00
m32r m32r: build fix for removing fs.h from mm.h 2007-07-30 10:52:10 -07:00
m68k Remove fs.h from mm.h 2007-07-29 17:09:29 -07:00
m68knommu m68knommu: get rid of duplicate include 2007-07-31 15:39:40 -07:00
mips [MIPS] Add smp_call_function_single() 2007-07-31 21:35:37 +01:00
parisc Remove fs.h from mm.h 2007-07-29 17:09:29 -07:00
powerpc [POWERPC] Fixes for the SLB shadow buffer code 2007-08-03 19:36:01 +10:00
ppc Merge git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog 2007-07-31 20:43:52 -07:00
s390 Remove fs.h from mm.h 2007-07-29 17:09:29 -07:00
sh sh: fix defconfigs for sh7751r boards 2007-08-03 10:17:47 +09:00
sh64 sh64: Kill off virt_to_bus()/bus_to_virt(). 2007-07-31 13:11:25 +09:00
sparc [SPARC]: Centralize find_in_proplist() instead of duplicating N times. 2007-08-07 18:46:36 -07:00
sparc64 [SPARC64]: Fix memory leak when cpu hotplugging. 2007-08-08 17:33:52 -07:00
um UML: console should handle spurious IRQS 2007-07-31 15:39:37 -07:00
v850
x86_64 x86_64: fix HPET init race 2007-08-11 15:47:39 -07:00
xtensa