This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


RE: [Xen-devel] write_tsc in a PV domain?

To: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>, Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Subject: RE: [Xen-devel] write_tsc in a PV domain?
From: Dan Magenheimer <dan.magenheimer@xxxxxxxxxx>
Date: Wed, 26 Aug 2009 08:42:05 -0700 (PDT)
Cc: "Xen-Devel \(E-mail\)" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Wed, 26 Aug 2009 08:42:55 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <C6BA938A.12F37%keir.fraser@xxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
> >> arch/x86/traps.c:emulate_privileged_op(), case 0x30.  It looks like
> >> writing to 0x10 would be silently ignored.
> > 
> > Hmmm... maybe I am misreading the code but it looks like the
> > default case will end up with "goto fail" which will not
> > update IP and so will infinite loop trapping on that instruction.
> > 
> > It appears that write_tsc calls are made in linux-2.6.18 (though
> > apparently never get executed) but disappear somewhere before
> > 2.6.24 and don't exist in 2.6.30 either.  So perhaps write_tsc
> > has never been executed in a PV guest and just doesn't work.
> Jeremy is correct. The TSC MSR cannot be written. Most that 
> will happen is
> that Xen will print a warning message, but the WRMSR 
> instruction will always
> be skipped over.

OK, I see, wrmsr_hypervisor_regs(0x10) and mce_wrmsr(0x10) and
rdmsr_safe(0x10) all return 0, so the code at "invalid:" is
executed and a warning is printk'd.  So in the current
implementation, write_tsc is skipped over.

But ARCHITECTURALLY does Xen consider write_tsc to be a no-op
for PV domains, or is this just a case that's never been
encountered before?  In other words, if a future PV OS had a
good reason to write_tsc, would we implement it (and make
the necessary adjustments to Xen's usages of tsc) or just say,
sorry, not allowed?

Xen-devel mailing list