Blob Blame History Raw
From 332f7a6f8dd4ee6fae95c87e717d4527ca9344a7 Mon Sep 17 00:00:00 2001
From: Alex Williamson <alex.williamson@redhat.com>
Date: Tue, 13 Feb 2018 19:04:56 +0100
Subject: [PATCH 15/15] Disable GeForce quirks in vfio-pci for RHEL machines

RH-Author: Alex Williamson <alex.williamson@redhat.com>
Message-id: <20180213190456.27565.18217.stgit@gimli.home>
Patchwork-id: 78999
O-Subject: [RHEL-7.5 qemu-kvm-rhev PATCH v2 2/2] [RHEL] Disable GeForce quirks in vfio-pci for RHEL machines
Bugzilla: 1508330
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
RH-Acked-by: Auger Eric <eric.auger@redhat.com>
RH-Acked-by: Marcel Apfelbaum <marcel@redhat.com>

RHEL-ONLY - The GeForce quirks are primarily used to virtualize the
various ways the driver and VGA BIOS has available to access PCI
config space using alternate memory regions, ex. MMIO and I/O port.
Generally these quirks are benign and even where not required, do not
interfere with operation.  However, NVIDIA has a strange MSI behavior
where the MSI interrupt will not re-trigger until the driver writes
back to specifc addresses in config space via the MMIO mirror.  Since
we virtualize the mirror for GeForce, every MSI interrupt requires an
exit to QEMU to handle this MSI-ACK behavior.  For very high interrupt
rate applications, such as NVIDIA's DolphinVS test program, this
virtualization causes enough overhead to degrade the performance.

RHEL does not support GeForce assignment and supported configurations
using Quadro, GRID, or Tesla assignment, including NVIDIA vGPU, do not
require these quirks.  We can therefore disable these quirks by
default, removing this overhead for supported configurations while
still allowing unsupported configurations access to re-enable them
via (equally unsupported) <qemu:args> options.

Upstream development is underway to mitigate this performance overhead
even for GeForce, but preliminary results show that we can only
achieve 95% of the performance of disabling the quirk entirely via an
ioeventfd approach.  Obviously detecting GeForce vs Quadro would also
be a useful approach, but there's no clear way to do this aside from
scraping device descriptions from libpci.  Therefore, disabling
GeForce quirks, with unsupported mechanisms to re-enable unsupported
configurations, seems like the best approach for RHEL/RHV.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
 include/hw/i386/pc.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index d1b1320..2b35ed8 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -1002,6 +1002,11 @@ extern void igd_passthrough_isa_bridge_create(PCIBus *bus, uint16_t gpu_dev_id);
             .driver = TYPE_X86_CPU,\
             .property = "host-phys-bits",\
             .value = "on",\
+        },\
+        { /* PC_RHEL_COMPAT bz 1508330 */ \
+            .driver = "vfio-pci",\
+            .property = "x-no-geforce-quirks",\
+            .value = "on",\
         },
 
 #define PC_RHEL7_4_COMPAT \
-- 
1.8.3.1