mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tim Deegan <tim@xen.org>
To: Sheng Yang <sheng@yasker.org>
Cc: Dan Magenheimer <dan.magenheimer@oracle.com>,
	David Vrabel <david.vrabel@citrix.com>,
	Jan Beulich <JBeulich@suse.com>,
	Konrad Wilk <konrad.wilk@oracle.com>,
	linux-kernel@vger.kernel.org, xen-devel <xen-devel@lists.xen.org>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [Xen-devel] [PATCH] xen: always set the sched clock as unstable
Date: Tue, 17 Apr 2012 09:19:28 +0100	[thread overview]
Message-ID: <20120417081928.GA29964@ocelot.phlegethon.org> (raw)
In-Reply-To: <CA+2rt41pCFV1haMAHo63rY9kx88VgiV419pf8Y=u2cXrdmGOBA@mail.gmail.com>

At 16:01 -0700 on 16 Apr (1334592096), Sheng Yang wrote:
> So I think there are maybe *two* bugs in this issue, one caused time
> jump(detail below), the other in the kernel triggered by the first bug
> sometime, thus result in migration fail.
> 
> I've spent some time to identify the timestamp jump issue, and finally
> found it's due to Invarient TSC (CPUID Leaf 0x80000007 EDX:8, also
> called non-stop TSC). The present of the feature would enable a
> parameter in the kernel named: sched_clock_stable. Seems this
> parameter is unable to work with Xen's pvclock. If
> sched_clock_stable() is set, value returned by xen_clocksource_read()
> would be returned as sched_clock_cpu() directly(rather than calculated
> through sched_clock_local()), but CMIIW the value returned by
> xen_clocksource_read() is based on host(vcpu) uptime rather than this
> VM's uptime, then result in the timestamp jump.

OK - that seems like a kernel bug.  Linux should not be modifying how it
treats the PV clocksource based on the 'Invariant TSC' bit.
(Conversely, the patch to pretend the TSC is not invariant just because
the PV clocksource is present also seems wrong, and the earlier patch
that just enforces sched_clock_stable=0 would be better.)

> I've compiled a kernel, force sched_clock_stable=0, then it solved the
> timestamp jump issue as expected. Luckily, seems it also solved the
> call trace and guest hang issue as well.
> 
> I've posted a patch to mask the CPUID leaf 0x80000007 in Xen.

Well, as Dan says, if Xen is emulating RDTSC to provide a 'stable' TSC, 
we shouldn't _also_ tell the guest that it's not stable. :)  

OTOH, grepping for CONSTANT_TSC, NONSTOP_TSC, and TSC_RELIABLE, I don't
see anywhere even in xen-unstable where these bits are ever hidden from
the guest.  I think it would be reasonable to mask this from PV guests
at least for tsc_mode == 2, and on older Xens.

Tim.

      parent reply	other threads:[~2012-04-17  8:19 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-13 18:20 David Vrabel
2012-04-13 18:33 ` Sheng Yang
     [not found] ` <CA+2rt41ctpU-vhR7=u_r45=o8djpq0-5YE5jcj_4FR2bWYu5pQ@mail.gmail.com>
2012-04-13 18:39   ` David Vrabel
2012-04-16 11:32 ` Jan Beulich
2012-04-16 14:59   ` David Vrabel
2012-04-16 15:16     ` Tim Deegan
2012-04-16 15:17     ` Konrad Rzeszutek Wilk
2012-04-16 16:20       ` [Xen-devel] " Dan Magenheimer
2012-04-16 16:05     ` Dan Magenheimer
2012-04-16 16:14       ` Jan Beulich
2012-04-16 17:22         ` Dan Magenheimer
2012-04-17  7:27           ` Jan Beulich
2012-04-17 15:36             ` Dan Magenheimer
2012-04-16 16:26       ` David Vrabel
2012-04-16 17:30         ` Dan Magenheimer
2012-04-17  7:47           ` Jan Beulich
2012-04-17 15:42             ` Dan Magenheimer
2012-04-16 17:08       ` Tim Deegan
2012-04-16 17:52         ` Dan Magenheimer
2012-04-16 18:17           ` Tim Deegan
2012-04-16 23:01             ` Sheng Yang
2012-04-17  0:29               ` Dan Magenheimer
2012-04-17  8:19               ` Tim Deegan [this message]

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=20120417081928.GA29964@ocelot.phlegethon.org \
    --to=tim@xen.org \
    --cc=JBeulich@suse.com \
    --cc=dan.magenheimer@oracle.com \
    --cc=david.vrabel@citrix.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sheng@yasker.org \
    --cc=tglx@linutronix.de \
    --cc=xen-devel@lists.xen.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

Powered by JetHome