Skip to contentSkip to conversation

qemu-cpu-models: Convert to rST; document other MSR bits

PATCH In review Kashyap Chamarthy 2 participants 4 messages Feb 25, 2020 Kbuild

lore
Share & tools
lore
#0 lore raw

v4 cover qemu-cpu-models: Convert to rST; document other MSR bits

In v4:
- Correctly use the 'define-man-page' rule for qemu-cpu-models.7 [pm215]
- Fix author attribution as per the thread:
Message-ID:
<CAFEAcA8dTR6xkQnsf32HAo6aDXf5Z0UmkhL3+257KWLj1ES6Sw@mail.gmail.com> [danpb, pm215]
- Don't reverse the existing order of the list of CPU models [pm215]
- Use rST "definition lists" consistently throughout the document.
- Consistently capitalize the phrase: "The QEMU Project Developers"
- Update the year of copyright to 2020 in docs/conf.py
- Fix two minor rST-related things [pbonzini]

In v3:
- Address the comments from Peter Maydell, from here:
https://lists.nongnu.org/archive/html/qemu-devel/2020-02/msg05155.html

This small series does two things:

(1) Convert the original qemu-cpu-models.texi to rST

(2) In a separate patch, incorporate the additional new content from this:
https://lists.nongnu.org/archive/html/qemu-devel/2020-01/msg06455.html
([PATCH v3] qemu-cpu-models: Document -noTSX, mds-no, taa-no, and tsx-ctrl)

Sphinx rendering of v4:

https://kashyapc.fedorapeople.org/QEMU_v4.2.0-1858-gdb736e0437/system/qemu-cpu-models.html

- - -

(Note to self: The comma-separated list of CPU models are not terribly legible that they are all different CPU models. Wonder if we should do something about it...)

Kashyap Chamarthy (2):
docs: Convert qemu-cpu-models.texi to rST; related fixes qemu-cpu-models.rst: Document -noTSX, mds-no, taa-no, and tsx-ctrl

 MAINTAINERS                     |   2 +-
 Makefile                        |  12 +-
 docs/conf.py                    |   2 +-
 docs/qemu-cpu-models.texi       | 677 --------------------------------
 docs/system/conf.py             |   5 +-
 docs/system/index.rst           |   1 +
 docs/system/qemu-cpu-models.rst | 535 +++++++++++++++++++++++++
 qemu-doc.texi                   |   5 -
 8 files changed, 548 insertions(+), 691 deletions(-)
 delete mode 100644 docs/qemu-cpu-models.texi
 create mode 100644 docs/system/qemu-cpu-models.rst
Signature · 1 line
2.21.0
#2 lore raw

PATCH v4 2/2 qemu-cpu-models.rst: Document -noTSX, mds-no, taa-no, and tsx-ctrl

- Add the '-noTSX' variants for CascadeLake and SkyLake.

- Document the three MSR bits: 'mds-no', 'taa-no', and 'tsx-ctrl'

Two confusing things about 'mds-no' (and the first point applies to the other two MSRs too):

(1) The 'mds-no' bit will _not_ show up in the guest's /proc/cpuinfo. Rather it is used to fill in the guest's sysfs:

/sys/devices/system/cpu/vulnerabilities/mds:Not affected

Paolo confirmed on IRC as such.

(2) There are _three_ variants[+] of CascadeLake CPUs, with different stepping levels: 5, 6, and 7. To quote wikichip.org[*]:

"note that while steppings 6 & 7 are fully mitigated, earlier stepping 5 is not protected against MSBDS, MLPDS, nor MDSUM"

The above is also indicated in the Intel's document[+], as indicated by "No" under the three columns of MFBDS, MSBDS, and MLPDS.

I've expressed this in the docs without belabouring the details.

[+] https://software.intel.com/security-software-guidance/insights/processors-affected-microarchitectural-data-sampling
[*] https://en.wikichip.org/wiki/intel/microarchitectures/cascade_lake#Key_changes_from_Skylake

---
v4:
- Fix two minor rST-related things [pbonzini]

---
 docs/system/qemu-cpu-models.rst | 57 +++++++++++++++++++++++++++++++--
 1 file changed, 55 insertions(+), 2 deletions(-)
docs/system/qemu-cpu-models.rst +55 -2
index 2bf635ecab..6ad572c509 100644
@@ -61,10 +61,15 @@ mixture of host CPU models between machines, if live migration
 compatibility is required, use the newest CPU model that is compatible
 across all desired hosts.
 
-``Skylake-Server``, ``Skylake-Server-IBRS``
+``Cascadelake-Server``, ``Cascadelake-Server-noTSX``
+    Intel Xeon Processor (Cascade Lake, 2019), with "stepping" levels 6
+    or 7 only.  (The Cascade Lake Xeon processor with *stepping 5 is
+    vulnerable to MDS variants*.)
+
+``Skylake-Server``, ``Skylake-Server-IBRS``, ``Skylake-Server-IBRS-noTSX``
     Intel Xeon Processor (Skylake, 2016)
 
-``Skylake-Client``, ``Skylake-Client-IBRS``
+``Skylake-Client``, ``Skylake-Client-IBRS``, ``Skylake-Client-noTSX-IBRS}``
     Intel Core Processor (Skylake, 2015)
 
 ``Broadwell``, ``Broadwell-IBRS``, ``Broadwell-noTSX``, ``Broadwell-noTSX-IBRS``
@@ -160,6 +165,54 @@ features are included if using "Host passthrough" or "Host model".
   Requires the host CPU microcode to support this feature before it
   can be used for guest CPUs.
 
+``mds-no``
+  Recommended to inform the guest OS that the host is *not* vulnerable
+  to any of the MDS variants ([MFBDS] CVE-2018-12130, [MLPDS]
+  CVE-2018-12127, [MSBDS] CVE-2018-12126).
+
+  This is an MSR (Model-Specific Register) feature rather than a CPUID feature,
+  so it will not appear in the Linux ``/proc/cpuinfo`` in the host or
+  guest.  Instead, the host kernel uses it to populate the MDS
+  vulnerability file in ``sysfs``.
+
+  So it should only be enabled for VMs if the host reports @code{Not
+  affected} in the ``/sys/devices/system/cpu/vulnerabilities/mds`` file.
+
+``taa-no``
+  Recommended to inform that the guest that the host is ``not``
+  vulnerable to CVE-2019-11135, TSX Asynchronous Abort (TAA).
+
+  This too is an MSR feature, so it does not show up in the Linux
+  ``/proc/cpuinfo`` in the host or guest.
+
+  It should only be enabled for VMs if the host reports ``Not affected``
+  in the ``/sys/devices/system/cpu/vulnerabilities/tsx_async_abort``
+  file.
+
+``tsx-ctrl``
+  Recommended to inform the guest that it can disable the Intel TSX
+  (Transactional Synchronization Extensions) feature; or, if the
+  processor is vulnerable, use the Intel VERW instruction (a
+  processor-level instruction that performs checks on memory access) as
+  a mitigation for the TAA vulnerability.  (For details, refer to
+  Intel's `deep dive into MDS
+  <https://software.intel.com/security-software-guidance/insights/deep-dive-intel-analysis-microarchitectural-data-sampling>`_.)
+
+  Expose this to the guest OS if and only if: (a) the host has TSX
+  enabled; *and* (b) the guest has ``rtm`` CPU flag enabled.
+
+  By disabling TSX, KVM-based guests can avoid paying the price of
+  mitigating TSX-based attacks.
+
+  Note that ``tsx-ctrl`` too is an MSR feature, so it does not show
+  up in the Linux ``/proc/cpuinfo`` in the host or guest.
+
+  To validate that Intel TSX is indeed disabled for the guest, there are
+  two ways: (a) check for the *absence* of ``rtm`` in the guest's
+  ``/proc/cpuinfo``; or (b) the
+  ``/sys/devices/system/cpu/vulnerabilities/tsx_async_abort`` file in
+  the guest should report ``Mitigation: TSX disabled``.
+
 
 Preferred CPU models for AMD x86 hosts
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signature · 1 line
2.21.0
#1 lore raw

PATCH v4 1/2 docs: Convert qemu-cpu-models.texi to rST; related fixes

In reply to Kashyap Chamarthy

This doc was originally written by Daniel P. Berrangé <[email protected]>, introduced via commit[1]: 2544e9e4aa (docs: add guidance on configuring CPU models for x86, 2018-06-27).

In this patch:

- 1-1 conversion of Texinfo to rST, besides a couple of minor
tweaks that are too trivial to mention. (Thanks to Stephen
Finucane on IRC for the suggestion to use rST "definition lists" instead of bullets in some places.)

Further modifications will be done via a separate patch.

- rST and related infra changes: manual page generation, Makefile fixes, clean up references to qemu-cpu-models.texi, update year in the copyright notice, etc.

[1] https://git.qemu.org/?p=qemu.git;a=commit;h=2544e9e4aa

---
v4:
- Correctly use the 'define-man-page' rule for qemu-cpu-models.7 [pm215]
- Fix author attribution as per the thread:
Message-ID:
<CAFEAcA8dTR6xkQnsf32HAo6aDXf5Z0UmkhL3+257KWLj1ES6Sw@mail.gmail.com> [danpb, pm215]
- Don't reverse the existing order of the list of CPU models [pm215]
- Use rST "definition lists" consistently throughout the document.
- Consistently capitalize the phrase: "The QEMU Project Developers"
- Update the year of copyright to 2020 in docs/conf.py

---
 MAINTAINERS                     |   2 +-
 Makefile                        |  12 +-
 docs/conf.py                    |   2 +-
 docs/qemu-cpu-models.texi       | 677 --------------------------------
 docs/system/conf.py             |   5 +-
 docs/system/index.rst           |   1 +
 docs/system/qemu-cpu-models.rst | 482 +++++++++++++++++++++++
 qemu-doc.texi                   |   5 -
 8 files changed, 495 insertions(+), 691 deletions(-)
 delete mode 100644 docs/qemu-cpu-models.texi
 create mode 100644 docs/system/qemu-cpu-models.rst
MAINTAINERS +1 -1
index 36d94c17a6..3fa06de323 100644
@@ -319,7 +319,7 @@ F: tests/tcg/i386/
 F: tests/tcg/x86_64/
 F: hw/i386/
 F: disas/i386.c
-F: docs/qemu-cpu-models.texi
+F: docs/system/qemu-cpu-models.rst
 T: git https://github.com/ehabkost/qemu.git x86-next
 
 Xtensa TCG CPUs
Makefile +6 -6
index aa9cc0b584..fb18c7c7cb 100644
@@ -352,9 +352,9 @@ ifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyy)
 DOCS+=$(MANUAL_BUILDDIR)/tools/virtiofsd.1
 endif
 DOCS+=$(MANUAL_BUILDDIR)/system/qemu-block-drivers.7
+DOCS+=$(MANUAL_BUILDDIR)/system/qemu-cpu-models.7
 DOCS+=docs/interop/qemu-qmp-ref.html docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7
 DOCS+=docs/interop/qemu-ga-ref.html docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7
-DOCS+=docs/qemu-cpu-models.7
 DOCS+=$(MANUAL_BUILDDIR)/index.html
 ifdef CONFIG_VIRTFS
 DOCS+=$(MANUAL_BUILDDIR)/tools/virtfs-proxy-helper.1
@@ -780,7 +780,6 @@ distclean: clean
 	rm -f docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt
 	rm -f docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf
 	rm -f docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html
-	rm -f docs/qemu-cpu-models.7
 	rm -rf .doctrees
 	$(call clean-manual,devel)
 	$(call clean-manual,interop)
@@ -859,7 +858,7 @@ ifdef CONFIG_POSIX
 	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man7"
 	$(INSTALL_DATA) docs/interop/qemu-qmp-ref.7 "$(DESTDIR)$(mandir)/man7"
 	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/system/qemu-block-drivers.7 "$(DESTDIR)$(mandir)/man7"
-	$(INSTALL_DATA) docs/qemu-cpu-models.7 "$(DESTDIR)$(mandir)/man7"
+	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/system/qemu-cpu-models.7 "$(DESTDIR)$(mandir)/man7"
 ifeq ($(CONFIG_TOOLS),y)
 	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/qemu-img.1 "$(DESTDIR)$(mandir)/man1"
 	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
@@ -1076,7 +1075,9 @@ $(MANUAL_BUILDDIR)/tools/index.html: $(call manual-deps,tools) $(SRC_PATH)/qemu-
 
 $(call define-manpage-rule,interop,qemu-ga.8)
 
-$(call define-manpage-rule,system,qemu-block-drivers.7)
+$(call define-manpage-rule,system,qemu-block-drivers.7 qemu-cpu-models.7)
+
+$(call define-manpage-rule,system,qemu-cpu-models.7)
 
 $(call define-manpage-rule,tools,\
        qemu-img.1 qemu-nbd.8 qemu-trace-stap.1\
@@ -1105,7 +1106,6 @@ docs/interop/qemu-ga-qapi.texi: qga/qapi-generated/qga-qapi-doc.texi
 
 qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi qemu-monitor-info.texi
 qemu.1: qemu-option-trace.texi
-docs/qemu-cpu-models.7: docs/qemu-cpu-models.texi
 
 html: qemu-doc.html docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html sphinxdocs
 info: qemu-doc.info docs/interop/qemu-qmp-ref.info docs/interop/qemu-ga-ref.info
@@ -1117,7 +1117,7 @@ qemu-doc.html qemu-doc.info qemu-doc.pdf qemu-doc.txt: \
 	qemu-tech.texi qemu-option-trace.texi \
 	qemu-deprecated.texi qemu-monitor.texi \
 	qemu-monitor-info.texi \
-	docs/qemu-cpu-models.texi docs/security.texi
+	docs/security.texi
 
 docs/interop/qemu-ga-ref.dvi docs/interop/qemu-ga-ref.html \
     docs/interop/qemu-ga-ref.info docs/interop/qemu-ga-ref.pdf \
docs/conf.py +1 -1
index 7588bf192e..1650fc8698 100644
@@ -80,7 +80,7 @@ master_doc = 'index'
 
 # General information about the project.
 project = u'QEMU'
-copyright = u'2019, The QEMU Project Developers'
+copyright = u'2020, The QEMU Project Developers'
 author = u'The QEMU Project Developers'
 
 # The version info for the project you're documenting, acts as replacement for
docs/qemu-cpu-models.texi deleted +0 -677

677 lines not on this page · raw message

docs/system/conf.py +4 -1
index 7ca115f5e0..68d36d6fc6 100644
@@ -18,5 +18,8 @@ html_theme_options['description'] = u'System Emulation User''s Guide'
 man_pages = [
     ('qemu-block-drivers', 'qemu-block-drivers',
      u'QEMU block drivers reference',
-     ['Fabrice Bellard and the QEMU Project developers'], 7)
+     ['Fabrice Bellard and the QEMU Project Developers'], 7),
+    ('qemu-cpu-models', 'qemu-cpu-models',
+     u'QEMU CPU Models',
+     ['The QEMU Project Developers'], 7)
 ]
docs/system/index.rst +1 -0
index f66e6ea585..849dcd8cb8 100644
@@ -15,3 +15,4 @@ Contents:
    :maxdepth: 2
 
    qemu-block-drivers
+   qemu-cpu-models
docs/system/qemu-cpu-models.rst new file +482 -0

482 lines not on this page · raw message

qemu-doc.texi +0 -5
index 33b9597b1d..97eb08a2b8 100644
@@ -616,11 +616,6 @@ The monitor understands integers expressions for every integer
 argument. You can use register names to get the value of specifics
 CPU registers by prefixing them with @emph{$}.
 
-@node cpu_models
-@section CPU models
-
-@include docs/qemu-cpu-models.texi
-
 @node disk_images
 @section Disk Images
 
Signature · 1 line
2.21.0
#3 lore raw
In reply to Kashyap Chamarthy
Quoted 4 lines · Kashyap Chamarthy

In v4:
- Correctly use the 'define-man-page' rule for qemu-cpu-models.7 [pm215]
- Fix author attribution as per the thread:

Quoted 8 lines
   Message-ID:
   <CAFEAcA8dTR6xkQnsf32HAo6aDXf5Z0UmkhL3+257KWLj1ES6Sw@mail.gmail.com>
   [danpb, pm215]

- Don't reverse the existing order of the list of CPU models [pm215]
- Use rST "definition lists" consistently throughout the document.
- Consistently capitalize the phrase: "The QEMU Project Developers"
- Update the year of copyright to 2020 in docs/conf.py
- Fix two minor rST-related things [pbonzini]

Thanks, I queued this series. I'm not sure when it will be applied, as that depends on how the rest of the rST conversion will be done.

Paolo