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

Re: [PATCH v2] x86/amd: do not expose HWCR.TscFreqSel to guests


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Thu, 14 Sep 2023 14:57:31 +0200
  • 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3ihWNJDQyDekg/XPnJqApWkOSdQgu9311zR1/7EiOsc=; b=i+tOlcl4LFd2g9ISdZCzdOSBfFiBQairx0PPapNhIQmSIj5b98pExJ8nsQSyRRbo+achzo2/rEcQ1uRpcnasLDtMWNGCxb5ztBkB3xI0pqGEwMgdbgIPe1g4yCSdL/3566JyQuwvreZKSsjp6BwA4MtwbG9k/XrBy4Q0VIBBj0yzecu/rcjSe5ijUDfPsJRvTI1q3nKpZ++I0vVr4/bDomCTCBmhfZRsfcFyKfBn2FrVZ0Zo0TRRYHOmHcDJex+LFb6PBdQHwvQ3B+FKWY5N1paj7KbGnDHpdJ4m3ciTnkdIC3yLq9YGDMurzRB7zfNH8/InVankb8ExbbggWBwz6g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P0de2YSxcuREQqcmlQQG1N1xqoiEZmb4DH/KldW+1EEUFzvhwLhGRIUeMqywr8Fvs11U0OxmKb9dINDyhuEZyzOu9KI3iGOGwAIMPS//KbaEcxI0H0GTJbKSbgIZfX0VV+558iwxDDxwxsZPws5IiqZCen6D0eZaGX9g21xr+WTvU1HTPyELouL1UPlPo6T5hoUIDAD4lYYfEvu9gQryJHqCfAYSwd+4QnpLa6wRUYCFdm7w5TXMwznDkseG+kz+Qgopjv9BN8bJf0BYWZUFtOyYLCozJAH5xrDuLdOah/5fbDdS4UGm1b4rEcwjtDHg6zjpblTLhb2DSayZPXVE3g==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Solène Rapenne <solene@xxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 14 Sep 2023 12:57:51 +0000
  • Ironport-data: A9a23:Ta0eF6KuRrC1m1cEFE+R45QlxSXFcZb7ZxGr2PjKsXjdYENSgzIFx mIfCGrVOv6DYmHxf9Elb4mzoRsC7MSEytNhHARlqX01Q3x08seUXt7xwmUcnc+xBpaaEB84t ZV2hv3odp1coqr0/0/1WlTZhSAhk/nOHvylULKs1hlZHWdMUD0mhQ9oh9k3i4tphcnRKw6Ws Jb5rta31GWNglaYCUpKrfrZwP9TlK6q4mhA7wViPasjUGL2zBH5MrpOfcldEFOgKmVkNrbSb /rOyri/4lTY838FYj9yuu+mGqGiaue60Tmm0hK6aYD76vRxjnVaPpIAHOgdcS9qZwChxLid/ jnvWauYEm/FNoWU8AgUvoIx/ytWZcWq85efSZSzXFD6I+QrvBIAzt03ZHzaM7H09c4oOGpg5 8Y9Ags2TR29nvqOkY+UTttF05FLwMnDZOvzu1lG5BSAV7MMZ8CGRK/Ho9hFwD03m8ZCW+7EY NYUYiZuaxKGZABTPlAQC9Q1m+LAanvXKmUE7g7K4/dqpTGMlWSd05C0WDbRUsaNSshP2F6Ru 0rN/njjAwFcP9uaodaA2iv227SSwHimBer+EpW+raNL2VfNyVcUSx4meGvlueXh0USXDoc3x 0s8v3BGQbIJ3E6hQ8T5Xha4iGWZpRNaUN1Ve8Ul7Cmdx6yS5ByWbkAfSTpMbtEOs9c7QzYx2 hmOhdyBLSxitviZRGyQ8p+QrCiuIm4FIGkafygGQAAZpd75r+kOYgnnS99iFOu/iI3zEDSpm TSS9nFh3vMUkNIB0Li98RbfmTWwq5PVTwkzoALKQmai6QA/b4mgD2C11WXmAT97BN7xZjG8U LIswqByMMhm4UmxqRGw
  • Ironport-hdrordr: A9a23:pDnTtK07f9W6wlGINmPmXwqjBcZxeYIsimQD101hICG9Lfb5qy n+ppUmPEHP5gr5AEtQ5expOMG7MBThHO1OkPYs1NaZLUXbUQ6TR72KgrGSuwEIdxeOk9K1kJ 0QDpSWa+eAQmSS7/yKmzVQeuxIqLPrnM/Y5pa9854ud3ARV0gJ1XYhNu/xKDwReOAyP+tBKH Pz3LsimxOQPVAsKuirDHgMWObO4/fRkoj9XBIADxk7rCGTkDKB8tfBYlal9yZbdwkK7aYp8G DDnQC8zL6kqeuHxhjV0HKWx4hKmeHm1sBICKW3+4kow3TX+0aVjbZaKv+/VQMO0aSSAZER4Z 3xSiIbTodOArXqDyaISFXWqk/dOX0VmgHfIBej8AreSIrCNWoH4wAov/MDTvMbg3BQ5u2Vqs hwrj6kX8E8N2KeoMy4jOK4By2DUyKP0CcfeSp6tQ0AbWPYAIUh/LD3tXklYKsoDWb07psqH/ JpC9yZ7PFKcUmCZ3ScpWV3xsewN05DVStub3Jy8/B96QIm1ExR3g8d3ogSj30A/JUyR91N4P nFKL1hkPVLQtUNZaxwCe8dSY/vY1a9DC7kISaXOxDqBasHM3XCp9r+56g0/vijfNgNwIEpkJ rMXVtEvSo5el7oC8eJwJpXmyq9ClmVTHDo0IVT9pJ5srrzSP7iNjCCUkknl4+6r/AWEqTgKo CO0VJtcojexEfVaPN0NlfFKupvwFElIb8ok8d+REyAuIbRNojnrKjSae/XJLbheAxULl/CPg ==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Thu, Sep 14, 2023 at 02:49:45PM +0200, Jan Beulich wrote:
> On 14.09.2023 14:37, Roger Pau Monné wrote:
> > On Thu, Sep 14, 2023 at 07:52:33AM +0200, Jan Beulich wrote:
> >> On 13.09.2023 16:52, Roger Pau Monne wrote:
> >>> OpenBSD 7.3 will unconditionally access HWCR if the TSC is reported as
> >>> Invariant, and it will then attempt to also unconditionally access 
> >>> PSTATE0 if
> >>> HWCR.TscFreqSel is set (currently the case on Xen).
> >>>
> >>> The relation between HWCR.TscFreqSel and PSTATE0 is not clearly written 
> >>> down in
> >>> the PPR, but it's natural for OSes to attempt to fetch the P0 frequency 
> >>> if the
> >>> TSC increments at the P0 frequency.
> >>>
> >>> Exposing PSTATEn (PSTATE0 at least) with all zeroes is not a suitable 
> >>> solution
> >>> because the PstateEn bit is read-write, and OSes could legitimately 
> >>> attempt to
> >>> set PstateEn=1 which Xen couldn't handle.
> >>>
> >>> In order to fix expose an empty HWCR, which is an architectural MSR and 
> >>> so must
> >>> be accessible.
> >>>
> >>> Note it was not safe to expose the TscFreqSel bit because it is not
> >>> architectural, and could change meaning between models.
> >>
> >> This imo wants (or even needs) extending to address the aspect of then
> >> exposing, on newer families, a r/o bit with the wrong value.
> > 
> > We could always be exposing bits with the wrong values on newer
> > (unreleased?) families, I'm not sure why it needs explicit mentioning
> > here.
> 
> Hmm, yes, that's one way to look at things. Yet exposing plain zero is
> pretty clearly not within spec here,

As I understand it, the fact that HWCR.TscFreqSel is read-only doesn't
exclude the possibility of it changing using other means (iow: we
should consider that a write to a different register could have the
side effect of toggling the bit).

The PPR I'm reading doesn't mention that the bit must be 1, just that
it's 1 on reset and read-only.

Thanks, Roger.



 


Rackspace

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