All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dan Magenheimer" <dan.magenheimer@oracle.com>
To: "Zhang, Li" <li.zhang@intel.com>,
	"Xen-Devel (E-mail)" <xen-devel@lists.xensource.com>
Cc: "Tian, Kevin" <kevin.tian@intel.com>
Subject: RE: Guest TSC and Xen (Intel and AMD feedback please)
Date: Tue, 8 Jul 2008 18:29:49 -0600	[thread overview]
Message-ID: <20080708182949500.00000003744@djm-pc> (raw)
In-Reply-To: <14B8575781A1414FA0D4F6649C4D7190018C3FE1@pdsmsx415.ccr.corp.intel.com>

[-- Attachment #1: Type: text/plain, Size: 7042 bytes --]

Looks great!  I am continuing to code and test.  Some preliminary results:

1) Substituting hvm_get_guest_time() for hvm_get_guest_tsc() seems to just work!  The hvm
    guest believes it is running on a 1000.185 MHz clock.

2) On my test box, a guest rdtsc without softtsc takes about 30ns.  With softtsc,
    rdtsc takes about 1us.

3) On my user-land test program, I am seeing rare "Time goes backwards", even with
   hvm_get_guest_time().  I'm trying to track this down.

Dan

> -----Original Message-----
> From: Zhang, Li [mailto:li.zhang@intel.com]
> Sent: Tuesday, July 08, 2008 3:47 AM
> To: Zhang, Li; dan.magenheimer@oracle.com; Xen-Devel (E-mail)
> Cc: Tian, Kevin
> Subject: RE: [Xen-devel] Guest TSC and Xen (Intel and AMD 
> feedback please)
> 
> 
> Hi, Dan
> Please ignore previous comments. The above attachment is OK. 
> Sorry for that. :(
> 
> >  -----Original Message-----
> >  From: xen-devel-bounces@lists.xensource.com
> >  [mailto:xen-devel-bounces@lists.xensource.com] On Behalf 
> Of Zhang, Li
> >  Sent: Tuesday, July 08, 2008 2:58 PM
> >  To: dan.magenheimer@oracle.com; Xen-Devel (E-mail)
> >  Cc: Tian, Kevin
> >  Subject: RE: [Xen-devel] Guest TSC and Xen (Intel and AMD 
> feedback please)
> >
> >  In fact, the issue is from guest. In the guest's terminal, 
> it shows that "your
> >  time source seems to be instable..."
> >
> >  >  -----Original Message-----
> >  >  From: xen-devel-bounces@lists.xensource.com
> >  >  [mailto:xen-devel-bounces@lists.xensource.com] On 
> Behalf Of Zhang, Li
> >  >  Sent: Tuesday, July 08, 2008 2:49 PM
> >  >  To: dan.magenheimer@oracle.com; Xen-Devel (E-mail)
> >  >  Cc: Tian, Kevin
> >  >  Subject: RE: [Xen-devel] Guest TSC and Xen (Intel and 
> AMD feedback please)
> >  >
> >  >  Hi, Dan
> >  >
> >  >  This is the patch which I think it has been completed 
> VT. But there is an
> >  >  instable issue. The reason may be from that this 
> interception is not bound
> >  >  to timer mode yet.
> >  >
> >  >  Thanks
> >  >  --Li
> >  >
> >  >  >  -----Original Message-----
> >  >  >  From: Dan Magenheimer [mailto:dan.magenheimer@oracle.com]
> >  >  >  Sent: Tuesday, July 08, 2008 11:34 AM
> >  >  >  To: Zhang, Li; Xen-Devel (E-mail)
> >  >  >  Cc: Tian, Kevin; dan.magenheimer@oracle.com
> >  >  >  Subject: RE: [Xen-devel] Guest TSC and Xen (Intel 
> and AMD feedback
> >  please)
> >  >  >
> >  >  >  Thanks Kevin and Li --
> >  >  >
> >  >  >  A couple of questions:
> >  >  >
> >  >  >  1) If the EXITING flag to be set in vmcs.c is to be 
> controlled by a xen
> >  >  boot
> >  >  >  option, would this work:
> >  >  >
> >  >  >  static int opt_softtsc = 0;
> >  >  >  boolean_param("softtsc", opt_softtsc);
> >  >  >    :
> >  >  >  min = /* original code */
> >  >  >  if (opt_softtsc) min |= CPU_BASED_RDTSC_EXITING;
> >  >  >
> >  >  >  2) In vmx_rdtsc_intercept(/* need regs as param*/) 
> if we change the
> >  >  >  rdtscll(tsc) to be tmptsc = hvm_get_guest_tsc() and 
> then set regs->edx
> >  amd
> >  >  >  regs->eax from tmptsc, are we almost done?
> >  >  >
> >  >  >  3) Des Linux or Windows use the CR4.TSD flag and, if 
> so, what code gets
> >  >  called
> >  >  >  to force the trap?
> >  >  >
> >  >  >  4) Does Linux or Windows use RDMSR/WRMSR of tsc?  Is 
> there already code
> >  >  >  somewhere to emulate WRMSR of tsc?
> >  >  >
> >  >  >  Sorry I am not very familar with the details of the 
> ia32 instruction
> >  set.
> >  >  >
> >  >  >  Thanks,
> >  >  >  Dan
> >  >  >
> >  >  >  > -----Original Message-----
> >  >  >  > From: Zhang, Li [mailto:li.zhang@intel.com]
> >  >  >  > Sent: Monday, July 07, 2008 9:00 PM
> >  >  >  > To: dan.magenheimer@oracle.com; Xen-Devel (E-mail)
> >  >  >  > Cc: Tian, Kevin
> >  >  >  > Subject: RE: [Xen-devel] Guest TSC and Xen (Intel and AMD
> >  >  >  > feedback please)
> >  >  >  >
> >  >  >  >
> >  >  >  > Hi, Dan
> >  >  >  > This seems not to be enough. I will cook another patch.
> >  >  >  >
> >  >  >  > >  -----Original Message-----
> >  >  >  > >  From: Zhang, Li
> >  >  >  > >  Sent: Tuesday, July 08, 2008 10:28 AM
> >  >  >  > >  To: Tian, Kevin; 'dan.magenheimer@oracle.com'; 
> 'Xen-Devel
> >  (E-mail)'
> >  >  >  > >  Subject: RE: [Xen-devel] Guest TSC and Xen 
> (Intel and AMD
> >  >  >  > feedback please)
> >  >  >  > >
> >  >  >  > >  Hi, Dan
> >  >  >  > >
> >  >  >  > >  I just add some code to produce vmexit. The function
> >  >  >  > vmx_rdtsc_intercept()
> >  >  >  > >  is not completed. It is needed to add some code 
> to get the
> >  >  >  > guest tsc.
> >  >  >  > >
> >  >  >  > >  Thanks
> >  >  >  > >  --Li
> >  >  >  > >
> >  >  >  > >  >  -----Original Message-----
> >  >  >  > >  >  From: Tian, Kevin
> >  >  >  > >  >  Sent: Tuesday, July 08, 2008 9:39 AM
> >  >  >  > >  >  To: 'dan.magenheimer@oracle.com'; Xen-Devel (E-mail)
> >  >  >  > >  >  Cc: Zhang, Li
> >  >  >  > >  >  Subject: RE: [Xen-devel] Guest TSC and Xen (Intel and
> >  >  >  > AMD feedback please)
> >  >  >  > >  >
> >  >  >  > >  >  >From: Dan Magenheimer 
> [mailto:dan.magenheimer@oracle.com]
> >  >  >  > >  >  >Sent: 2008年7月5日 1:32
> >  >  >  > >  >  >
> >  >  >  > >  >  >> >Is this something that you (or Intel in general)
> >  >  >  > could look at?
> >  >  >  > >  >  >> >I would be happy to participate but I 
> don't think I
> >  >  >  > understand
> >  >  >  > >  >  >> >VT well enough.  Once the trap occurs, I suppose
> >  >  >  > Xen system time
> >  >  >  > >  >  >> >could be used as the virtual TSC, 
> possibly scaled up.
> >  >  >  > >  >  >> >
> >  >  >  > >  >  >>
> >  >  >  > >  >  >> There should be tiny related to VT, as 
> only turning
> >  >  >  > on some bit to
> >  >  >  > >  >  >> allow RDTSC trapping and then the rest 
> stuff should be common
> >  >  >  > >  >  >> how to handle it. We'll take a look, but can't
> >  >  >  > commit the time due
> >  >  >  > >  >  >> to other scheduled bandwidth. But if you'd like to
> >  >  >  > jump in early
> >  >  >  > >  >  >> we definitely can help with VT side.
> >  >  >  > >  >  >
> >  >  >  > >  >  >If you can post a patch with code that:
> >  >  >  > >  >  >
> >  >  >  > >  >  >1) declares a boolean global variable: softtsc = 0
> >  >  >  > >  >  >2) if the variable is set, a rdtsc 
> instruction in any hvm
> >  >  >  > >  >  >   domain causes a trap
> >  >  >  > >  >  >3) the trap handler just does a physical 
> rdtsc and returns
> >  >  >  > >  >  >
> >  >  >  > >  >  >then I could probably take it from there.
> >  >  >  > >  >
> >  >  >  > >  >  OK, and Li in CC will take a look and bake a 
> patch for you.
> >  >  >  > >  >
> >  >  >  > >  >  Thanks,
> >  >  >  > >  >  Kevin
> >  >  >  >
> >
> >  _______________________________________________
> >  Xen-devel mailing list
> >  Xen-devel@lists.xensource.com
> >  http://lists.xensource.com/xen-devel
> 
> 

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

  parent reply	other threads:[~2008-07-09  0:29 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-01 17:33 Guest TSC and Xen (Intel and AMD feedback please) Dan Magenheimer
2008-07-01 17:40 ` Keir Fraser
2008-07-02  2:52 ` Tian, Kevin
2008-07-03  1:21   ` Dan Magenheimer
2008-07-04  0:56     ` Tian, Kevin
2008-07-04 17:31       ` Dan Magenheimer
2008-07-08  1:38         ` Tian, Kevin
2008-07-08  2:28           ` Zhang, Li
2008-07-08  2:59           ` Zhang, Li
2008-07-08  3:34             ` Dan Magenheimer
2008-07-08  4:21               ` Tian, Kevin
2008-07-08  6:49               ` Zhang, Li
2008-07-08  6:58                 ` Zhang, Li
2008-07-08  9:46                   ` Zhang, Li
2008-07-08 14:48                     ` Dave Winchell
2008-07-08 14:56                       ` Keir Fraser
2008-07-09  0:29                     ` Dan Magenheimer [this message]
2008-07-09 21:32                       ` [PATCH] softtsc (was RE: Guest TSC and Xen (Intel and AMD feedback please)) Dan Magenheimer
2008-07-10  1:48                         ` Zhang, Li
2008-07-10  9:18                         ` Keir Fraser
2008-07-10 14:19                           ` Dan Magenheimer
2008-07-10 14:29                             ` Keir Fraser
     [not found] <878wwltk01.fsf@basil.nowhere.org>
2008-07-01 21:43 ` Guest TSC and Xen (Intel and AMD feedback please) Dan Magenheimer

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=20080708182949500.00000003744@djm-pc \
    --to=dan.magenheimer@oracle.com \
    --cc=kevin.tian@intel.com \
    --cc=li.zhang@intel.com \
    --cc=xen-devel@lists.xensource.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.