From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: Fwd: x86: HPET: read back compare register before reading counter Date: Fri, 21 Nov 2008 13:44:00 +0000 Message-ID: <4926C930.76E4.0078.0@novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Wouldn't this be needed in Xen, too? On top of this, there is a patch converting the WARN_ON() to WARN_ON_ONCE(), and in our SLE11 tree we have an additional McCreary specific fix that actually does a 'pre-read' = prior to the WARN_ON_ONCE() as on that platform the first read apparently = returns the comparator value from before the last write. It is however being = reported that the issue seen here isn't present in 2.6.28 anymore, which seems suspicious to me. See http://git.kernel.org/?p=3Dlinux/kernel/git/torvalds/linux-2.6.git;a=3D= commitdiff;h=3D72d43d9bc9210d24d09202eaf219eac09e17b339. Jan From: Thomas Gleixner After fixing the u32 thinko I sill had occasional hickups on ATI chipsets with small deltas. There seems to be a delay between writing the compare register and the transffer to the internal register which triggers the interrupt. Reading back the value makes sure, that it hit the internal match register befor we compare against the counter value. Signed-off-by: Thomas Gleixner --- diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c index 801497a..73deaff 100644 --- a/arch/x86/kernel/hpet.c +++ b/arch/x86/kernel/hpet.c @@ -278,6 +278,13 @@ static int hpet_legacy_next_event(unsigned long = delta, cnt +=3D (u32) delta; hpet_writel(cnt, HPET_T0_CMP); =20 + /* + * We need to read back the CMP register to make sure that + * what we wrote hit the chip before we compare it to the + * counter. + */ + WARN_ON((u32)hpet_readl(HPET_T0_CMP) !=3D cnt); + return (s32)((u32)hpet_readl(HPET_COUNTER) - cnt) >=3D 0 ? -ETIME = : 0; } =20