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

x86/PV: (lack of) MTRR exposure


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 28 Apr 2022 17:53:17 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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=Ld1CduOnWj6XqXB/pFD5zwrf4+DheELc0rJWhZpFBgQ=; b=jBP8zeR9MRXysRpQwJIBukw5ctpczJh/wF02N0qsK65nPm0TR3ijsG+53Mwsf6pOiWxrIRY21/nXca2L1OfENAnzrhgvZlnqV7b5EH+jsCMcpntSYB96j+p1rIYNcHawadBm52+NoTWL2DP4VF0JOacMgk2P3v9uN6Rfb+u0aBL2lzoFGGxTXXLCv1tuwHq89f0k4EQ61HZpXpZn/lT4MlCsHoA8M5K72SS7vwkLF3Y2ke3mIz6Q9cYReodsNVlTyzWwGPeMrEBoRNqEqTE2CEP9Zqvbbqt3YiHEGVeQ695hPkDyrMPIQA5vwdcu7/BJ5hZw+ztvjNjt9XAgj0yZSw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YhllZctf+heGjrAj0aK1pnUN04a1iNzGbYBmMHnDS8+ekKIpUxvXbjrXgVESvTMbS9hxygV3CRmI3HvVG210VjHwfyQogkmNYbp0BQ8oINAH3vqt4XcnBDROqAyqfUdpcTZJ9oXldEq3ImvB9QFxEHCz/N3wc9EMWITlEr32f+VwPOiJxEH2CZ3hBWJ5+A82Uy8K4wqBRQOQbl64tHPahTlN1xXhQ6wzEaf4602rAdLbMLA+9Bs7H0tfO0MoTCEne3gpOeIw5fBTgIAcL+9k9d4I3n77S+j2WDe3BIWY50EBfi8nWWet7/l5K6zuLO3HjwnQuZq5EzB2JdTWVPQ+mA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
  • Delivery-date: Thu, 28 Apr 2022 15:53:34 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hello,

in the course of analyzing the i915 driver causing boot to fail in
Linux 5.18 I found that Linux, for all the years, has been running
in PV mode as if PAT was (mostly) disabled. This is a result of
them tying PAT initialization to MTRR initialization, while we
offer PAT but not MTRR in CPUID output. This was different before
our moving to CPU featuresets, and as such one could view this
behavior as a regression from that change.

The first question here is whether not exposing MTRR as a feature
was really intended, in particular also for PV Dom0. The XenoLinux
kernel and its forward ports did make use of XENPF_*_memtype to
deal with MTRRs. That's functionality which (maybe for a good
reason) never made it into the pvops kernel. Note that PVH Dom0
does have access to the original settings, as the host values are
used as initial state there.

The next question would be how we could go about improving the
situation. For the particular issue in 5.18 I've found a relatively
simple solution [1] (which also looks to help graphics performance
on other systems, according to my initial observations with using
the change), albeit its simplicity likely means it either is wrong
in some way, or might not be liked for looking hacky and/or abusive.
We can't, for example, simply turn on the MTRR bit in CPUID, as that
would implicitly lead to the kernel trying to write the PAT MSR (if,
see below, it didn't itself zap the bit). We also can't simply
ignore PAT MSR writes, as the kernel won't check whether writes
actually took effect. (All of that did work on top of old Xen
apparently only because xen_init_capabilities() itself also forces
the MTRR feature to off.)

Jan

[1] https://lists.xen.org/archives/html/xen-devel/2022-04/msg02392.html




 


Rackspace

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