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

Re: [PATCH v2 2/2][4.15] x86/AMD: expose HWCR.TscFreqSel to guests


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Mon, 8 Mar 2021 12:37:37 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vqRbU6BlIqaSzOEclvGQ11l9rYi7gl+ROTirI7UOxfI=; b=OBy33utGN/6Z9u+Nu5kcpJfaJpc0kUGjVYkSJmN/ghuG5QqK+oSQQ1N+Z6rA/BFFSu+B/8bBJ7fQn7rXJd+Ui/9oFIxMA+3VvO3EenTvvlkupFWqFPpEO05/tRAH9v8PgzUXPcS8tHg1N//xKKTaAVDJKxHwgO8wCI2HuJ6UDkRHEBU9a/WCDSdvUq2hWxaF9I9pa1P9vL6izD3nh/qLI1jy+/TT0qKStxW0U+zvTWEZkYcRcIa0aMV+vPRc2eG5N9OOqcYupjDccuzkTss/h/tcfvEEsVRnBcSvdVH7AedmOfh5p81HK91JBPdFUUgCMsGTPyRjwdBxQbbIhecWQA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iNUtPuc4HUMihEjGW1/wAz/TjeVbNmIG7/ebQoytcjxKSypPWGdzmduby2CUON5llxcsHKjD8pLYcFWfxejlTPIKOMFb5n0XWYS4yNfZxQ7hPQUUJi4c1kXT0+6Z8NkM2K9veJfi9r7ws8pTTsYeT4nXtgLEib1G/jcBFuk6gkfW3ksP2EmcbgjHRYaiNE8W2jTaSP25VYsV4JmFvrjM6gdsYp2GU0I5TXkZeAjR1MZhSiH1C1QZKEZ4mk6JMI0zQS2qLeUqXdsOr0Dnc/pnVXIH2TYW3qB2RNj6esItsvWQeVXL2Jiohx71qsZYh4FOG5uKp1Swhv6GU3AyKFyBcA==
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "Andrew Cooper" <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>
  • Delivery-date: Mon, 08 Mar 2021 11:38:09 +0000
  • Ironport-sdr: ZawCvNDIHC6aUOfblvYyke+0VyMEb1leck/Oq3FZlNLSvXUoKTg4HtKxwkIQ2KPQeRkUmesemC SACSud5uGau3DgxAiOsZJVCBuHD/ErIgZiAZNwlxbKsdbA46N8uvrPKrYwkzXu2p+xolOwZiW5 hxUqjrZwsW8WvIPF0xUvaEwznWK9+R5CPvRIG32RAkDxCWpPawIG6VUjQLBxv9mcjf1FnExfkF wNpPzOZmygRRCSQucSmNd5vYljEmd6ZTdNXHPrxTpl0+X2aFTdTlqlVDyAaxzhXAMk5g0Nco2F OAE=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Fri, Mar 05, 2021 at 10:50:54AM +0100, Jan Beulich wrote:
> Linux has been warning ("firmware bug") about this bit being clear for a
> long time. While writable in older hardware it has been readonly on more
> than just most recent hardware. For simplicitly report it always set (if
> anything we may want to log the issue ourselves if it turns out to be
> clear on older hardware).
> 
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

One question below.

> ---
> v2: New.
> ---
> There are likely more bits worthwhile to expose, but for about every one
> of them there would be the risk of a lengthy discussion, as there are
> clear downsides to exposing such information, the more that it would be
> tbd whether the hardware values should be surfaced, and if so what
> should happen when the guest gets migrated.
> 
> The main risk with making the read not fault here is that guests might
> imply they can also write this MSR then.
> 
> --- a/xen/arch/x86/msr.c
> +++ b/xen/arch/x86/msr.c
> @@ -315,6 +315,12 @@ int guest_rdmsr(struct vcpu *v, uint32_t
>          *val = msrs->tsc_aux;
>          break;
>  
> +    case MSR_K8_HWCR:
> +        if ( !(cp->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) )
> +            goto gp_fault;
> +        *val = K8_HWCR_TSC_FREQ_SEL;

I've been only able to find information about this MSR up to family
10h, but I think in theory Xen might also run on family 0Fh, do you
know if the MSR is present there, and the bit has the same meaning?

> +        break;
> +
>      case MSR_AMD64_DE_CFG:
>          if ( !(cp->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON)) )
>              goto gp_fault;
> --- a/xen/include/asm-x86/msr-index.h
> +++ b/xen/include/asm-x86/msr-index.h
> @@ -287,6 +287,8 @@
>  
>  #define MSR_K7_HWCR                  0xc0010015

We could likely drop the K7 define here, as Xen won't be able to run
on K7 hardware anymore AFAICT.

Thanks, Roger.



 


Rackspace

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