Re: [PATCH] xen: always set the sched clock as unstable

From: Konrad Rzeszutek Wilk
Date: Mon Apr 16 2012 - 11:25:06 EST


On Mon, Apr 16, 2012 at 03:59:44PM +0100, David Vrabel wrote:
> On 16/04/12 12:32, Jan Beulich wrote:
> >>>> On 13.04.12 at 20:20, David Vrabel <david.vrabel@xxxxxxxxxx> wrote:
> >> From: David Vrabel <david.vrabel@xxxxxxxxxx>
> >>
> >> The sched clock was considered stable based on the capabilities of the
> >> underlying hardware. This does not make sense for Xen PV guests as:

In regards to PV dom0 is this still the case? Asking b/c your
patch will make dom0 be in the same category.

> >> a) the hardware TSC is not used directly as the clock source; and b)
> >> guests may migrate to hosts with different hardware capabilities.
> >>
> >> It is not clear to me whether the Xen clock source is supposed to be
> >> stable and whether it should be stable across migration. For a clock

I thought it was dependent on XEN_DOMCTL_settscinfo:
- whether it gets emulated, or the guest can do rdtsc or pvrdtsc?

Which I think is determined by some 'timer=X' option in the guest config?


> >> source to be stable it must be: a) monotonic; c) synchronized across
> >> CPUs; and c) constant rate.
>
> Tim, Thomas, can you comment on the above paragraph? Is it correct?
>
> >> There have also been reports of systems with apparently unstable
> >> clocks where clearing sched_clock_stable has fixed problems with
> >> migrated VMs hanging.
> >>
> >> So, always set the sched clock as unstable when using the Xen clock
> >> source.
> >>
> >> Signed-off-by: David Vrabel <david.vrabel@xxxxxxxxxx>
> >> ---
> >> arch/x86/xen/time.c | 1 +
> >> 1 files changed, 1 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
> >> index 0296a95..8469b5a 100644
> >> --- a/arch/x86/xen/time.c
> >> +++ b/arch/x86/xen/time.c
> >> @@ -473,6 +473,7 @@ static void __init xen_time_init(void)
> >> do_settimeofday(&tp);
> >>
> >> setup_force_cpu_cap(X86_FEATURE_TSC);
> >> + sched_clock_stable = 0;
> >
> > This, unfortunately, is not sufficient afaict: If a CPU gets brought up
> > post-boot, the variable may need to be cleared again. Instead you
> > ought to call mark_tsc_unstable().
>
> Yeah, mark_tsc_unstable() is the right thing to do.
>
> David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/