[seabios/f19] Fix kvm migration with empty virtio-scsi controller (bz #1032208)
Cole Robinson
crobinso at fedoraproject.org
Thu Mar 13 21:05:33 UTC 2014
commit 9567b9e334ff0bd20c637f5fdf41cbcb87066771
Author: Cole Robinson <crobinso at redhat.com>
Date: Thu Mar 13 17:05:27 2014 -0400
Fix kvm migration with empty virtio-scsi controller (bz #1032208)
..._scsi-reset-the-HBA-before-freeing-its-vi.patch | 54 ++++++++++++++++++++
seabios.spec | 11 ++++-
2 files changed, 64 insertions(+), 1 deletions(-)
---
diff --git a/0001-init_virtio_scsi-reset-the-HBA-before-freeing-its-vi.patch b/0001-init_virtio_scsi-reset-the-HBA-before-freeing-its-vi.patch
new file mode 100644
index 0000000..bf874b9
--- /dev/null
+++ b/0001-init_virtio_scsi-reset-the-HBA-before-freeing-its-vi.patch
@@ -0,0 +1,54 @@
+From 5f2d17d35b2339526f3b3d580b279ea78e406a25 Mon Sep 17 00:00:00 2001
+Message-Id: <5f2d17d35b2339526f3b3d580b279ea78e406a25.1394734933.git.crobinso at redhat.com>
+From: Laszlo Ersek <lersek at redhat.com>
+Date: Wed, 15 Jan 2014 02:48:40 +0100
+Subject: [PATCH] init_virtio_scsi(): reset the HBA before freeing its virtio
+ ring
+
+When init_virtio_scsi() finds no SCSI targets connected to the HBA, it
+frees the virtio ring. Other code in SeaBIOS proceeds to overwrite the
+area. However, the ring is in use by qemu at that point -- not only did we
+report the (ACK|DRIVER|DRIVER_OK) status earlier, we even communicated
+over the ring.
+
+Of course SeaBIOS doesn't "kick" the HBA ever again, hence qemu has no
+reason to look at the ring. However, when qemu uses KVM acceleration, and
+ioeventfd is enabled for the HBA, then a vmstate change to "running"
+(including stop->cont monitor commands and incoming migration) "forces" a
+kick (see qemu commit 25db9ebe). Qemu then tries to interpret whatever
+unrelated guest data is in the HBA's original ring area, as virtio
+protocol. Qemu exits upon seeing the garbage.
+
+init_virtio_scsi() should reset the HBA before allowing the virtio ring
+memory to be reused. Device reset causes the hypervisor to drop its
+references.
+
+This change is justified / underpinned by pure virtio-spec compliance as
+well.
+
+Related RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1013418
+
+Signed-off-by: Laszlo Ersek <lersek at redhat.com>
+---
+ src/virtio-scsi.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/hw/virtio-scsi.c b/src/hw/virtio-scsi.c
+index 4b4ec7b..48fb3e1 100644
+--- a/src/virtio-scsi.c
++++ b/src/virtio-scsi.c
+@@ -158,8 +158,10 @@ init_virtio_scsi(struct pci_device *pci)
+ for (tot = 0, i = 0; i < 256; i++)
+ tot += virtio_scsi_scan_target(pci, ioaddr, vq, i);
+
+- if (!tot)
++ if (!tot) {
++ vp_reset(ioaddr);
+ goto fail;
++ }
+
+ return;
+
+--
+1.8.5.3
+
diff --git a/seabios.spec b/seabios.spec
index 3ff7d12..8237645 100644
--- a/seabios.spec
+++ b/seabios.spec
@@ -1,6 +1,6 @@
Name: seabios
Version: 1.7.2.2
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: Open-source legacy BIOS implementation
Group: Applications/Emulators
@@ -19,6 +19,9 @@ Source12: config.vga.qxl
Source13: config.vga.stdvga
Source14: config.vga.vmware
+# Fix kvm migration with empty virtio-scsi controller (bz #1032208)
+Patch0001: 0001-init_virtio_scsi-reset-the-HBA-before-freeing-its-vi.patch
+
BuildRequires: python iasl
BuildRequires: binutils-x86_64-linux-gnu gcc-x86_64-linux-gnu
@@ -68,6 +71,9 @@ SeaVGABIOS is an open-source VGABIOS implementation.
%prep
%setup -q
+# Fix kvm migration with empty virtio-scsi controller (bz #1032208)
+%patch0001 -p1
+
# Makefile changes version to include date and buildhost
sed -i 's,VERSION=%{version}.*,VERSION=%{version},g' Makefile
@@ -131,6 +137,9 @@ install -m 0644 binaries/vgabios*.bin $RPM_BUILD_ROOT%{_datadir}/seavgabios
%changelog
+* Thu Mar 13 2014 Cole Robinson <crobinso at redhat.com> - 1.7.2.2-3
+- Fix kvm migration with empty virtio-scsi controller (bz #1032208)
+
* Tue Jul 09 2013 Cole Robinson <crobinso at redhat.com> - 1.7.2.2-2
- Again fix vgabios obsoletes (bz #981147)
More information about the scm-commits
mailing list