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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 15 May 2007 00:05:14 +0200
From:	Thomas Gleixner <tglx@...utronix.de>
To:	Alistair John Strachan <s0348365@....ed.ac.uk>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Venkatesh Pallipadi <venkatesh.pallipadi@...el.com>,
	john stultz <johnstul@...ibm.com>, Ingo Molnar <mingo@...e.hu>,
	Chris Wright <chrisw@...s-sol.org>,
	Arjan van de Ven <arjan@...radead.org>,
	Steven Rostedt <rostedt@...dmis.org>, Andi Kleen <ak@...e.de>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] x86-64 highres/dyntick support 2.6.22-rc1-v1

On Mon, 2007-05-14 at 22:15 +0100, Alistair John Strachan wrote:
> On Monday 14 May 2007 11:26:08 Thomas Gleixner wrote:
> > I'm pleased to announce an updated version of the x86_64 highres/dyntick
> > support patches against 2.6.22-rc1:
> [snip]
> > - Various fixups from Chris Wright
> > - TSC calibration fix (pointed out by Alistair John Strachan)
> >
> > Comments, bugreports, patches are welcome as ususal
> 
> Neither of the bugs I reported appear to be fixed.
> 
> I took a clean git tree from the 2.6.22-rc1 tag and patched with this version; 
> my CPU MHz and dmesg counter still appear to be broken (v3 was used).

Sigh. /me feels stupid.

Can you please apply the following patch on top and check, whether it
fixes the problem ? Please provide the debug output, when it fails.

Thanks,

	tglx

Index: linux-2.6.21/arch/x86_64/kernel/tsc.c
===================================================================
--- linux-2.6.21.orig/arch/x86_64/kernel/tsc.c
+++ linux-2.6.21/arch/x86_64/kernel/tsc.c
@@ -135,7 +135,7 @@ static unsigned long __init tsc_read_ref
 	for (i = 0; i < MAX_RETRIES; i++) {
 		t1 = get_cycles_sync();
 		if (hpet)
-			*hpet = hpet_readl(HPET_COUNTER);
+			*hpet = hpet_readl(HPET_COUNTER) & 0xFFFFFFFF;
 		else
 			*pm = acpi_pm_read_early();
 		t2 = get_cycles_sync();
@@ -177,8 +177,10 @@ void __init tsc_calibrate(void)
 	tsc_khz = (tr2 - tr1) / 50;
 
 	/* hpet or pmtimer available ? */
-	if (!hpet && !pm1 && !pm2)
+	if (!hpet && !pm1 && !pm2) {
+		printk(KERN_INFO "TSC calibrated against tick interrupt\n");
 		return;
+	}
 
 	/* Check, whether the sampling was disturbed by an SMI */
 	if (tsc1 == ULONG_MAX || tsc2 == ULONG_MAX) {
@@ -190,14 +192,25 @@ void __init tsc_calibrate(void)
 	tsc2 = (tsc2 - tsc1) * 1000000000L;
 
 	if (hpet) {
-		hpet2 = (hpet2 - hpet1) & 0xFFFFFFFF;
+		printk(KERN_INFO "TSC calibrated against hpet %ld %ld",
+		       hpet1, hpet2);
+		if (hpet2 < hpet1)
+			hpet2 += 0x100000000;
+		hpet2 -= hpet1;
 		tsc1 = (hpet2 * hpet_readl(HPET_PERIOD)) / 1000;
+		printk(" %lu %lu\n", hpet2, tsc1);
 	} else {
-		pm2 = (pm2 -pm1) & ACPI_PM_MASK;
+		printk(KERN_INFO "TSC calibrated against pm_timer %ld %ld",
+		       pm1, pm2);
+		if (pm2 < pm1)
+			pm2 += ACPI_PM_OVRRUN;
+		pm2 -= pm1;
 		tsc1 = (pm2 * PMTMR_TICKS_PER_SEC) / 1000;
+		printk(" %lu %lu\n", pm2, tsc1);
 	}
 
 	tsc_khz = tsc2 / tsc1;
+	printk(KERN_INFO "tsckhz: %lu %lu %u\n", tsc2, tsc1, tsc_khz);
 }
 
 /*


-
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