virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: tony@bakeyournoodle.com (Tony Breeds)
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Matt Mackall <mpm@selenic.com>,
	virtualization <virtualization@lists.linux-foundation.org>
Subject: Re: [PATCH 2/2] lguest: handle dodgy/non-existent TSC. Guest code.
Date: Wed, 4 Jul 2007 16:44:02 +1000	[thread overview]
Message-ID: <20070704064402.GB10345@bakeyournoodle.com> (raw)
In-Reply-To: <1183530033.6005.3.camel@localhost.localdomain>

On Wed, Jul 04, 2007 at 04:20:33PM +1000, Rusty Russell wrote:
> We create an "lguest_clock" which the guest uses: either TSC or
> jiffies, depending on whether the host tells us the TSC frequency.
> 
> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
> ---
>  drivers/lguest/lguest.c |   51 +++++++++++++++++++++++------------------------
>  1 file changed, 26 insertions(+), 25 deletions(-)
> 
> ===================================================================

Hi Rusty,

<snip>

> +static cycle_t lguest_clock_read(void)
> +{
> +	if (lguest_data.tsc_khz)
> +		return native_read_tsc();
> +	else
> +		return jiffies;
> +}
> +
> +/* This is what we tell the kernel is our clocksource.  */

<snip>

> +	/* We use the TSC if the Host tells us we can, otherwise a dumb
> +	 * jiffies-based clock. */
> +	if (lguest_data.tsc_khz) {
> +		lguest_clock.shift = 22;
> +		lguest_clock.mult = clocksource_khz2mult(lguest_data.tsc_khz,
> +							 lguest_clock.shift);
> +		lguest_clock.mask = CLOCKSOURCE_MASK(64);
> +		lguest_clock.flags = CLOCK_SOURCE_IS_CONTINUOUS;
> +	} else {
> +		/* To understand this, start at kernel/time/jiffies.c... */
> +		lguest_clock.shift = 8;
> +		lguest_clock.mult = (((u64)NSEC_PER_SEC<<8)/ACTHZ) << 8;
> +		lguest_clock.mask = CLOCKSOURCE_MASK(32);
> +	}
>  	clocksource_register(&lguest_clock);

Why bother installing an lguest_clock which is the same as jiffies?
Wouldn't it be better to just use the system provided jiffies
clocksource in the case where you haven't been provided with
lguest_data.tsc_khz ?

Yours Tony

  linux.conf.au        http://linux.conf.au/ || http://lca2008.linux.org.au/
  Jan 28 - Feb 02 2008 The Australian Linux Technical Conference!

  reply	other threads:[~2007-07-04  6:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-04  6:19 [PATCH 1/2] lguest: handle dodgy/non-existent TSC. Host code Rusty Russell
2007-07-04  6:20 ` [PATCH 2/2] lguest: handle dodgy/non-existent TSC. Guest code Rusty Russell
2007-07-04  6:44   ` Tony Breeds [this message]
2007-07-04  8:10     ` Rusty Russell
2007-07-05 15:37       ` john stultz
2007-07-05 17:56       ` Jeremy Fitzhardinge
2007-07-04 13:20 ` [PATCH 1/2] lguest: handle dodgy/non-existent TSC. Host code Matt Mackall
2007-07-05  1:38   ` Rusty Russell
2007-07-05  6:41     ` Matt Mackall

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=20070704064402.GB10345@bakeyournoodle.com \
    --to=tony@bakeyournoodle.com \
    --cc=akpm@linux-foundation.org \
    --cc=mpm@selenic.com \
    --cc=rusty@rustcorp.com.au \
    --cc=virtualization@lists.linux-foundation.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;
as well as URLs for NNTP newsgroup(s).