From: Peter Zijlstra <peterz@infradead.org>
To: Yinghai Lu <yhlu.kernel@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86: printk_time to use tsc before cpu_clock is ready
Date: Tue, 29 Jul 2008 12:13:07 +0200 [thread overview]
Message-ID: <1217326387.7563.6.camel@twins> (raw)
In-Reply-To: <200807290309.44869.yhlu.kernel@gmail.com>
On Tue, 2008-07-29 at 03:09 -0700, Yinghai Lu wrote:
> so can get tsc value on printk
>
> need to apply after
> [PATCH] printk_time: prepare stub for using other than cpu_clock
You failed to mention why we want this... ;-)
> Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.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
> @@ -617,6 +617,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;
> @@ -627,6 +636,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
> @@ -215,6 +215,15 @@ static void __init early_cpu_support_pri
> }
> }
>
> +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)
> @@ -227,6 +236,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@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2008-07-29 10:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-29 10:08 [PATCH] printk_time: prepare stub for using other than cpu_clock Yinghai Lu
2008-07-29 10:09 ` [PATCH] x86: printk_time to use tsc before cpu_clock is ready Yinghai Lu
2008-07-29 10:13 ` Peter Zijlstra [this message]
2008-07-29 10:18 ` Yinghai Lu
-- strict thread matches above, loose matches on Subject: below --
2008-08-27 7:38 [PATCH] printk_time: prepare stub for using other than cpu_clock Yinghai Lu
2008-08-27 7:38 ` [PATCH] x86: printk_time to use tsc before cpu_clock is ready Yinghai Lu
2008-08-27 7:42 ` Ingo Molnar
2008-08-27 7:47 ` Peter Zijlstra
2008-08-27 8:02 ` Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1217326387.7563.6.camel@twins \
--to=peterz@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--cc=yhlu.kernel@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.