Fix virtio-blk-pci detect-zeroes=unmap (RHBZ#2173357)

This commit is contained in:
Richard W.M. Jones 2023-02-27 11:47:44 +00:00
parent 650c8272f6
commit fb1517ca3f
6 changed files with 70 additions and 17 deletions

View File

@ -1,10 +1,10 @@
From e54512fe75f85640c0c73e53e6f8bd0b9d193529 Mon Sep 17 00:00:00 2001
From: Paolo Bonzini <pbonzini@redhat.com>
Date: Tue, 1 Feb 2022 20:09:37 +0100
Subject: [PATCH] target/i386: the sgx_epc_get_section stub is reachable
Subject: [PATCH 1/5] target/i386: the sgx_epc_get_section stub is reachable
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-type: text/plain
The sgx_epc_get_section stub is reachable from cpu_x86_cpuid. It
should not assert, instead it should just return true just like
@ -28,3 +28,6 @@ index 26833eb233..16b1dfd90b 100644
- g_assert_not_reached();
+ return true;
}
--
2.37.3

View File

@ -1,7 +1,7 @@
From f6d5fd60f54fb9dcdc3733154637a3a214f5d5af Mon Sep 17 00:00:00 2001
From 2f0a0afbf915d36c39c5cfac1e31c6edc7f47bef Mon Sep 17 00:00:00 2001
From: "Eduardo Lima (Etrunko)" <etrunko@redhat.com>
Date: Thu, 1 Sep 2022 12:43:49 -0300
Subject: [PATCH] tests: Disable pci_virtio_vga for ppc64
Subject: [PATCH 2/5] tests: Disable pci_virtio_vga for ppc64
starting QEMU: exec ./qemu-system-ppc64 -qtest unix:/tmp/qtest-2378197.sock -qtest-log /dev/null -chardev socket,path=/tmp/qtest-2378197.qmp,id=char0 -mon chardev=char0,mode=control -display none -vga none -device virtio-vga -accel qtest
stderr:
@ -28,5 +28,5 @@ index ace3bb28e0..628dad4cf2 100644
}
--
2.37.2
2.37.3

View File

@ -1,7 +1,7 @@
From ebff02a43374c1138d4f8b2c07d2088a3921c288 Mon Sep 17 00:00:00 2001
From 5c1d2f920c14d6e8f4ac7abc62714eadaa60f228 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Date: Tue, 10 Jan 2023 12:37:14 -0500
Subject: [PATCH 1/2] Revert "linux-user: add more compat ioctl definitions"
Subject: [PATCH 3/5] Revert "linux-user: add more compat ioctl definitions"
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
@ -27,7 +27,7 @@ Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
1 file changed, 25 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 1f8c10f8ef..9c1e9555e1 100644
index 24b25759be..10af5e0d8e 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -111,31 +111,6 @@
@ -63,5 +63,5 @@ index 1f8c10f8ef..9c1e9555e1 100644
#include <linux/fs.h>
#endif
--
2.38.1
2.37.3

View File

@ -1,7 +1,7 @@
From f0f11a1435802b5c8ee8337a7b0c0f337d8f9936 Mon Sep 17 00:00:00 2001
From b40cf0a490c28d5b79e05382d061983b92a7b2b3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Date: Tue, 10 Jan 2023 12:37:25 -0500
Subject: [PATCH 2/2] Revert "linux-user: fix compat with glibc >= 2.36
Subject: [PATCH 4/5] Revert "linux-user: fix compat with glibc >= 2.36
sys/mount.h"
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
@ -29,7 +29,7 @@ Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2 files changed, 20 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 9c1e9555e1..f2b7634f5e 100644
index 10af5e0d8e..d974c76b60 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -95,25 +95,7 @@
@ -59,10 +59,10 @@ index 9c1e9555e1..f2b7634f5e 100644
#if defined(CONFIG_FIEMAP)
#include <linux/fiemap.h>
diff --git a/meson.build b/meson.build
index 175517eafd..32fed7ea6e 100644
index 5c6b5a1c75..3172b01089 100644
--- a/meson.build
+++ b/meson.build
@@ -2039,8 +2039,6 @@ config_host_data.set('HAVE_OPTRESET',
@@ -2032,8 +2032,6 @@ config_host_data.set('HAVE_OPTRESET',
cc.has_header_symbol('getopt.h', 'optreset'))
config_host_data.set('HAVE_IPPROTO_MPTCP',
cc.has_header_symbol('netinet/in.h', 'IPPROTO_MPTCP'))
@ -72,5 +72,5 @@ index 175517eafd..32fed7ea6e 100644
# has_member
config_host_data.set('HAVE_SIGEV_NOTIFY_THREAD_ID',
--
2.38.1
2.37.3

View File

@ -0,0 +1,45 @@
From db788c896eb1378ebc1f20dcc4954616a7631919 Mon Sep 17 00:00:00 2001
From: Stefan Hajnoczi <stefanha@redhat.com>
Date: Tue, 7 Feb 2023 15:37:16 -0500
Subject: [PATCH 5/5] block: fix detect-zeroes= with BDRV_REQ_REGISTERED_BUF
When a write request is converted into a write zeroes request by the
detect-zeroes= feature, it is no longer associated with an I/O buffer.
The BDRV_REQ_REGISTERED_BUF flag doesn't make sense without an I/O
buffer and must be cleared because bdrv_co_do_pwrite_zeroes() fails with
-EINVAL when it's set.
Fiona Ebner <f.ebner@proxmox.com> bisected and diagnosed this QEMU 7.2
regression where writes containing zeroes to a blockdev with
discard=unmap,detect-zeroes=unmap fail.
Buglink: https://gitlab.com/qemu-project/qemu/-/issues/1404
Fixes: e8b6535533be ("block: add BDRV_REQ_REGISTERED_BUF request flag")
Tested-by: Fiona Ebner <f.ebner@proxmox.com>
Cc: qemu-stable@nongnu.org
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Hanna Czenczek <hreitz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20230207203719.242926-2-stefanha@redhat.com>
(cherry picked from commit 3c5867156eb81c7c71611d078b2c5c2c863f884a)
---
block/io.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/block/io.c b/block/io.c
index b9424024f9..bbaa0d1b2d 100644
--- a/block/io.c
+++ b/block/io.c
@@ -2087,6 +2087,9 @@ static int coroutine_fn bdrv_aligned_pwritev(BdrvChild *child,
if (bs->detect_zeroes == BLOCKDEV_DETECT_ZEROES_OPTIONS_UNMAP) {
flags |= BDRV_REQ_MAY_UNMAP;
}
+
+ /* Can't use optimization hint with bufferless zero write */
+ flags &= ~BDRV_REQ_REGISTERED_BUF;
}
if (ret < 0) {
--
2.37.3

View File

@ -321,7 +321,7 @@ Obsoletes: %{name}-system-unicore32-core <= %{epoch}:%{version}-%{release}
%endif
# To prevent rpmdev-bumpspec breakage
%global baserelease 6
%global baserelease 7
Summary: QEMU is a FAST! processor emulator
Name: qemu
@ -346,10 +346,12 @@ Source36: README.tests
# Fix SGX assert
Patch: 0001-target-i386-the-sgx_epc_get_section-stub-is-reachabl.patch
Patch: 0001-tests-Disable-pci_virtio_vga-for-ppc64.patch
Patch: 0002-tests-Disable-pci_virtio_vga-for-ppc64.patch
# Fix compat with kernel-headers >= 6.1
Patch: 0003-Revert-linux-user-add-more-compat-ioctl-definitions.patch
Patch: 0004-Revert-linux-user-fix-compat-with-glibc-2.36-sys-mou.patch
# Fix virtio-blk-pci detect-zeroes=unmap (RHBZ#2173357)
Patch: 0005-block-fix-detect-zeroes-with-BDRV_REQ_REGISTERED_BUF.patch
BuildRequires: meson >= %{meson_version}
BuildRequires: zlib-devel
@ -2779,6 +2781,9 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \
%changelog
* Mon Feb 27 2023 Richard W.M. Jones <rjones@redhat.com> - 7.2.0-7
- Fix virtio-blk-pci detect-zeroes=unmap (RHBZ#2173357)
* Tue Jan 31 2023 Stefan Hajnoczi <stefanha@redhat.com> - 7.2.0-6
- Enable libblkio