[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH linux-next] x86/xen/time: prefer tsc as clocksource when it is invariant


  • To: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
  • From: Krister Johansen <kjlx@xxxxxxxxxxxxxxxxxx>
  • Date: Mon, 12 Dec 2022 07:57:30 -0800
  • Arc-authentication-results: i=1; rspamd-85f95c7974-lnmpm; auth=pass smtp.auth=dreamhost smtp.mailfrom=kjlx@xxxxxxxxxxxxxxxxxx
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1670860653; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references:dkim-signature; bh=4T/zjG3plJ8sYfo5jMTvgYHcxH66poUD8cr6GG0LDRs=; b=ncpLvPS2no8tViamLPErH9Noqu+S3jTZGO5DsE8WJ+JuEgd/nL8GNaRHZ4CjTyL0Elo7cu lCc6UU9xpiTExlm9u6clpurfvrpp0D564LSjBmYUUVu0DR+eeJ1b2tk09NsNc6UsaXMo+g G5+0FHLO1UBuPoCGq7FuTSi900Hxkhhzuh/cnLU5UuX8ydIQ627xDWbfFXryh6kmHhlf5q 1/rI/8qUdBzoTxuzMZ0K9gimvw4IsaIMOlXLtxp3mCJwRsRQyjDsXYHoF1nD5hGA9d9zrD ewR19A43F/m5XFkPRovRPMTVe+uw3JaUcDRrmLu43Bdez4Gxi3nbt97kc5w78Q==
  • Arc-seal: i=1; s=arc-2022; d=mailchannels.net; t=1670860653; a=rsa-sha256; cv=none; b=tWoS8cOiby/UrMpJ4a0xfDZdsZm38Mx+ox2Ckus5yY4J+OgyBKWGEbjs+Hl0i5NCQP3vcv wJZUO+5YjWW3khYxh6/BlBYhFuOYFR+h1VMNxb1e0h/Z2SsHYHG2ufd4PmrsmRBZBnndX0 bIksv3fa5s4ePLXcpCFoCO18dvWfoM/U/5T0YANAWpgveaBBP7Af8BoozhGYMopXjIfz0y 7/Ig+HObZQK34Lhx/hogsSFrQPBUzQR8PWLH9nOhdXQl8e72p1j+b1kLyCGQ2lKO+Fjjry 2TM+1a2bOaTGsVkoGY4HvLW7SVk71cDkz6e/WC6R7hTclNui/hx//rt5xuIKUw==
  • Cc: Krister Johansen <kjlx@xxxxxxxxxxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>, Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, x86@xxxxxxxxxx, "H. Peter Anvin" <hpa@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, Marcelo Tosatti <mtosatti@xxxxxxxxxx>, Anthony Liguori <aliguori@xxxxxxxxxx>, David Reaver <me@xxxxxxxxxxxxxxx>, Brendan Gregg <brendan@xxxxxxxxx>
  • Delivery-date: Mon, 12 Dec 2022 15:57:41 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Fri, Dec 09, 2022 at 02:32:15PM -0500, Boris Ostrovsky wrote:
> 
> On 12/8/22 11:36 AM, Krister Johansen wrote:
> > +   /*
> > +    * As Dom0 is never moved, no penalty on using TSC there.
> > +    *
> > +    * If the guest has invariant tsc, then set xen_clocksource rating
> > +    * below that of the tsc so that the system prefers tsc instead.  This
> > +    * check excludes PV domains, because PV is unable to guarantee that the
> > +    * guest's cpuid call has been intercepted by the hypervisor.
> > +    */
> > +   if (xen_initial_domain()) {
> >             xen_clocksource.rating = 275;
> > +   } else if ((xen_hvm_domain() || xen_pvh_domain()) &&
> > +       boot_cpu_has(X86_FEATURE_CONSTANT_TSC) &&
> > +       boot_cpu_has(X86_FEATURE_NONSTOP_TSC) &&
> > +       !check_tsc_unstable()) {
> > +           xen_clocksource.rating = 299;
> > +   }
> 
> 
> What if RDTSC is intercepted?

Right, thanks.  I'll send out an updated patch here shortly that
attempts to address this by examining the cpuid information to determine
if the tsc is being emulated.

-K



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.