From: Andi Kleen <ak@suse.de>
To: john stultz <johnstul@us.ibm.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [RFC][PATCH 5/6] x86_64: Clocksources for x86-64
Date: Wed, 9 Aug 2006 04:41:09 +0200 [thread overview]
Message-ID: <200608090441.09224.ak@suse.de> (raw)
In-Reply-To: <20060809021739.23103.98698.sendpatchset@cog.beaverton.ibm.com>
On Wednesday 09 August 2006 04:17, john stultz wrote:
> Re-add TSC and HPET support to x86_64 via clocksource infrastructure.
The actual review needed is in the existing clock source drivers
I guess.
I definitely don't want the "read three times" pmtimer code that
is in the generic clock source on 64bit. You would need at least an ifdef
there or better detect the case where it is needed at runtime.
> -unsigned int cpu_khz; /* TSC clocks / usec, not used here */
> +unsigned int cpu_khz; /* CPU clocks / usec, not used here */
The previous comment was more correct. It is really TSC clocks.
> EXPORT_SYMBOL(cpu_khz);
> +unsigned int tsc_khz; /* TSC clocks / usec, not used here */
And that comment can't have the same unit as the earlier one?
> +/* clock source code: */
> +
> +static unsigned long current_tsc_khz = 0;
Another one? Don't we have already too many of these variables?
> +
> +static int tsc_update_callback(void);
> +
> +static cycle_t read_tsc(void)
> +{
> + cycle_t ret;
> + rdtscll(ret);
It would need to be _sync
> +
> + /* only update if tsc_khz has changed: */
> + if (current_tsc_khz != tsc_khz){
> + current_tsc_khz = tsc_khz;
> + clocksource_tsc.mult = clocksource_khz2mult(current_tsc_khz,
> + clocksource_tsc.shift);
> + change = 1;
> + }
Are you sure this handles p-state invariant TSC correctly?
And I hope there is a printk somewhere when this happens?
> + return change;
> +}
> +
> +static int __init init_tsc_clocksource(void)
> +{
> + if (!notsc && tsc_khz) {
How can tsc_khz be 0 ?
> + current_tsc_khz = tsc_khz;
> + clocksource_tsc.mult = clocksource_khz2mult(current_tsc_khz,
> + clocksource_tsc.shift);
> + return clocksource_register(&clocksource_tsc);
> + }
> + return 0;
> +}
> +
> +module_init(init_tsc_clocksource);
So what clocksource does it use before?
BTW I guess i would be ok with putting tsc and hpet into their own files.
And is there a reason HPET can't be generic in drivers/clocksource now?
> +
> +
> +#define HPET_MASK 0xFFFFFFFF
> +#define HPET_SHIFT 22
> +
> +/* FSEC = 10^-15 NSEC = 10^-9 */
> +#define FSEC_PER_NSEC 1000000
> +
> +static void *hpet_ptr;
> +
> +static cycle_t read_hpet(void)
> +{
> + return (cycle_t)readl(hpet_ptr);
No 64bit HPET support?
> +}
> +
> +struct clocksource clocksource_hpet = {
> + .name = "hpet",
> + .rating = 250,
> + .read = read_hpet,
> + .mask = (cycle_t)HPET_MASK,
> + .mult = 0, /* set below */
> + .shift = HPET_SHIFT,
> + .is_continuous = 1,
> +};
How is priority of the different time sources established in this?
e.g. is the old fallback selection logic still fully functional?
-Andi
next prev parent reply other threads:[~2006-08-09 2:45 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-09 2:17 [RFC][PATCH 0/6] x86_64: Generic timekeeping for x86_64 john stultz
2006-08-09 2:17 ` [RFC][PATCH 1/6] x86_64: Enable arch-generic vsyscall support john stultz
2006-08-09 2:29 ` Andi Kleen
2006-08-09 2:56 ` john stultz
2006-08-09 2:59 ` Andi Kleen
2006-08-09 2:17 ` [RFC][PATCH 2/6] x86_64: hpet_address cleanup john stultz
2006-08-09 2:31 ` Andi Kleen
2006-08-09 3:08 ` john stultz
2006-08-09 2:17 ` [RFC][PATCH 3/6] x86_64: Remove apic_runs_main_timer john stultz
2006-08-09 2:31 ` Andi Kleen
2006-08-09 2:17 ` [RFC][PATCH 4/6] x86_64: Enable CONFIG_GENERIC_TIME john stultz
2006-08-09 2:17 ` [RFC][PATCH 5/6] x86_64: Clocksources for x86-64 john stultz
2006-08-09 2:41 ` Andi Kleen [this message]
2006-08-09 3:41 ` john stultz
2006-08-09 2:17 ` [RFC][PATCH 6/6] x86_64: GENERIC_TIME based vsyscall code john stultz
2006-08-09 2:45 ` Andi Kleen
2006-08-09 2:41 ` [RFC][PATCH 0/6] x86_64: Generic timekeeping for x86_64 Andi Kleen
2006-08-09 2:48 ` john stultz
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=200608090441.09224.ak@suse.de \
--to=ak@suse.de \
--cc=johnstul@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox