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]
Message-Id: <1219822736-18628-2-git-send-email-yhlu.kernel@gmail.com>
Date:	Wed, 27 Aug 2008 00:38:56 -0700
From:	Yinghai Lu <yhlu.kernel@...il.com>
To:	Ingo Molnar <mingo@...e.hu>, Thomas Gleixner <tglx@...utronix.de>,
	"H. Peter Anvin" <hpa@...or.com>,
	Andrew Morton <akpm@...ux-foundation.org>
Cc:	linux-kernel@...r.kernel.org, Yinghai Lu <yhlu.kernel@...il.com>
Subject: [PATCH] x86: printk_time to use tsc before cpu_clock is ready

so can get tsc value on printk at first.

for debug delay with big system with a lot of memory.

need to apply after
	[PATCH] printk_time: prepare stub for using other than cpu_clock

Signed-off-by: Yinghai Lu <yhlu.kernel@...il.com>

---
 arch/x86/kernel/cpu/common.c    |   11 +++++++++++
 arch/x86/kernel/cpu/common_64.c |   12 ++++++++++++
 2 files changed, 23 insertions(+)

Index: linux-2.6/arch/x86/kernel/cpu/common.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/cpu/common.c
+++ linux-2.6/arch/x86/kernel/cpu/common.c
@@ -647,6 +647,15 @@ __setup("clearcpuid=", setup_disablecpui
 
 cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE;
 
+static unsigned long long tsc_clock(int cpu)
+{
+	unsigned long long t;
+
+	rdtscll(t);
+
+	return t;
+}
+
 void __init early_cpu_init(void)
 {
 	struct cpu_vendor_dev *cvdev;
@@ -657,6 +666,8 @@ void __init early_cpu_init(void)
 		cpu_devs[cvdev->vendor] = cvdev->cpu_dev;
 
 	early_cpu_detect();
+	if (cpu_has_tsc)
+		set_printk_time_clock(tsc_clock);
 	validate_pat_support(&boot_cpu_data);
 }
 
Index: linux-2.6/arch/x86/kernel/cpu/common_64.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/cpu/common_64.c
+++ linux-2.6/arch/x86/kernel/cpu/common_64.c
@@ -249,6 +249,15 @@ static void __cpuinit detect_nopl(struct
 	}
 }
 
+static unsigned long long tsc_clock(int cpu)
+{
+	unsigned long long t;
+
+	rdtscll(t);
+
+	return t;
+}
+
 static void __cpuinit early_identify_cpu(struct cpuinfo_x86 *c);
 
 void __init early_cpu_init(void)
@@ -261,6 +270,9 @@ void __init early_cpu_init(void)
                 cpu_devs[cvdev->vendor] = cvdev->cpu_dev;
 	early_cpu_support_print();
 	early_identify_cpu(&boot_cpu_data);
+
+	if (cpu_has_tsc)
+		set_printk_time_clock(tsc_clock);
 }
 
 /* Do some early cpuid on the boot CPU to get some parameter that are
--
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