[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 13:29:47 +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=J16x54dZKc6ZSeGa4nuayG8cy78C5+Z71zHErQSR22M=; b=NFMQsMOx8PSXFUDifjupED6t98aZb2O+YiqtFZnkigaCHjPhW4Gpk2hhH7Qy3GQKnvpjjfHNXlcwuiGhjXmDsZAFuTUOfirWekZGpLv3NgNd9AkbtExxzL9vuj7o6ldToM7mypmqtolJAzkX5IMmsVEVAojo9qmH+rS3WrbRwk1DZCZ+7XuKUEgw8jc5f2fSr5f04q7095PyoUmMuxusjqqdQrkrJ1Y7sMZZKbyGc5i04J+uKFvzpAaOEhUpNYHit3D4wPgAez8tTs5pPW0noH/snJ81qVXyfr7EHAC5s5nQXO4N6xjijijn5Vq7sjUNAz3zbW5Mr17uzf9jVmfaIA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EN1zMsWWMZSGGILUzpjJwpOcI4TeyHbxYdt9zSE+tf5lyXQrw1lBxIbYtlsOrW1Tk4zqPkLGenqca3J3PwiM4AR+6nnL2i19UyOQVVcrZqsSPJK1oZr1MJrYA+KL4ki16VexX1wqSXhc9CP1eU8Sr86iORupHUNsNh7rM6wuIIytW33UKHzAx2S85jXcK7k6ufQiryS3TIMtWbdAwrWTE9NC8D9qsjB6AWsTpxOGlD1YHnRn88KdLzNv/gdtH6A4o/F2ua21NIuaQ3eRP4qMx662cTepLswJwmXhSz2IU3aG6DEoYkRj3Qg2NE7aDXiGfOkjWxG25eHoH3al+VFPLw==
  • 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 12:38:11 +0000
  • Ironport-sdr: ZF5Iyk1oXfvIbR+7liz3AQ6EtMgyTZmbc596MBcD9lEXwIHvc6AL6VluB3GrdxnN1KfdvLuNgR c5+Hd/9dPzsPMIp/bEk1J/At4Bnmxapp/E5R/GTg02lxq4roYjhPZWc1nxjSN1VX33mcAxdilO sQkZ3d8qlyEjJFr3FGrXqZqqGWKXIDZBOy/hcMdLIZXiz8/HWpOAm4CKGYplePlEZLwEZL8MrC +ho7MkXSulkJyfpLvIa8ocZOwo2XI0624kTRGb+QkrT40lJ57RnHcbaGJJWoneUm5FPOivEG+F rZM=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Mon, Mar 08, 2021 at 12:47:44PM +0100, Jan Beulich wrote:
> On 08.03.2021 12:37, Roger Pau Monné wrote:
> > 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>
> 
> Thanks.
> 
> > 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?
> 
> From its name (and its K7 alternative name) it's clear the register
> had been there at that point. And indeed the bit has a different
> meaning there (its the bottom bit of a 6-bit START_FID field if the
> BKDG I'm looking at can be trusted.

OK, I cannot seem to find the BKDG for family 0Fh. The oldest BKDG I
can find is for Family 10h [0].

> Since I don't think it matters
> much whether we expose a value of 0x00 or a value of 0x01 there,
> and since we likely don't want to make #GP raising dependent upon
> family when we don't _really_ need to, I would want to propose that
> the value used is good enough uniformly.

I would be fine with setting it to 0 if Fam < 10h if you think that's
acceptable. I think the chances of someone running Xen >= 4.15 on such
old hardware are quite dim.

Thanks, Roger.

[0] https://developer.amd.com/resources/developer-guides-manuals/



 


Rackspace

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