Merge ~sergiodj/ubuntu/+source/qemu:bug1970737-stale-io-sysbench-jammy into ubuntu/+source/qemu:ubuntu/jammy-devel

Proposed by Sergio Durigan Junior
Status: Merged
Approved by: git-ubuntu bot
Approved revision: not available
Merged at revision: dd89634342d3c025201431addf0989074a1dbcca
Proposed branch: ~sergiodj/ubuntu/+source/qemu:bug1970737-stale-io-sysbench-jammy
Merge into: ubuntu/+source/qemu:ubuntu/jammy-devel
Diff against target: 118 lines (+90/-0)
4 files modified
debian/changelog (+7/-0)
debian/patches/series (+2/-0)
debian/patches/ubuntu/lp1970737-linux-aio-explain-why-max-batch-is-checked-in-laio_i.patch (+37/-0)
debian/patches/ubuntu/lp1970737-linux-aio-fix-unbalanced-plugged-counter-in-laio_io_.patch (+44/-0)
Reviewer Review Type Date Requested Status
git-ubuntu bot Approve
Christian Ehrhardt  (community) Approve
Canonical Server Reporter Pending
Canonical Server Reporter Pending
Canonical Server Reporter Pending
Canonical Server packageset reviewers Pending
Canonical Server Pending
Review via email: mp+425189@code.launchpad.net

Description of the change

This MP fixes bug #1970737, which reports an stalled I/O scenario on qemu when using an NMVe storage device.

This bug has been discussed and fixed upstream; this is the backport of the patches to Jammy. Note that qemu on Kinetic hasn't been fixed yet, because there are some security fixes that need to be uploaded there first.

I've discussed this with Christian and he's OK with the changes. There's a PPA with the proposed package here:

https://launchpad.net/~sergiodj/+archive/ubuntu/qemu-bug1970737/+packages

qemu doesn't have autopkgtests, but Christian runs his own internal tests.

To post a comment you must log in.
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

LGTM just like what I've seen before.
Qemu has a few rough edges, but you are touching none of them - so that should really be fine.

I've pinged mdeslaur as there seems to be non security upload for Kinetic.
Depending on the answer you can upload both soon.

P.S. yes I'll run the tests once it is in jammy-proposed.

review: Approve
Revision history for this message
git-ubuntu bot (git-ubuntu-bot) wrote :

Approvers: sergiodj, paelzer
Uploaders: sergiodj, paelzer
MP auto-approved

review: Approve
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

On Wednesday, June 22 2022, Christian Ehrhardt  wrote:

> LGTM just like what I've seen before.
> Qemu has a few rough edges, but you are touching none of them - so that should really be fine.

Thanks, Christian.

> I've pinged mdeslaur as there seems to be non security upload for Kinetic.
> Depending on the answer you can upload both soon.

Yeah, I've seen the ping, thanks. I'm now waiting for mdeslaur to send
me the changes. Once he does, I will file the MP for Kinetic.

Cheers,

--
Sergio
GPG key ID: E92F D0B3 6B14 F1F4 D8E0 EB2F 106D A1C8 C3CB BF14

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

On Wednesday, June 22 2022, Sergio Durigan Junior wrote:

> On Wednesday, June 22 2022, Christian Ehrhardt  wrote:
>> I've pinged mdeslaur as there seems to be non security upload for Kinetic.
>> Depending on the answer you can upload both soon.
>
> Yeah, I've seen the ping, thanks. I'm now waiting for mdeslaur to send
> me the changes. Once he does, I will file the MP for Kinetic.

I've prepared and uploaded the changes to Kinetic. Therefore, this has
also been uploaded:

$ dput qemu_6.2+dfsg-2ubuntu6.3_source.changes
Trying to upload package to ubuntu
Checking signature on .changes
gpg: /home/sergio/work/qemu/qemu_6.2+dfsg-2ubuntu6.3_source.changes: Valid signature from 106DA1C8C3CBBF14
Checking signature on .dsc
gpg: /home/sergio/work/qemu/qemu_6.2+dfsg-2ubuntu6.3.dsc: Valid signature from 106DA1C8C3CBBF14
Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading qemu_6.2+dfsg-2ubuntu6.3.dsc: done.
  Uploading qemu_6.2+dfsg-2ubuntu6.3.debian.tar.xz: done.
  Uploading qemu_6.2+dfsg-2ubuntu6.3_source.buildinfo: done.
  Uploading qemu_6.2+dfsg-2ubuntu6.3_source.changes: done.
Successfully uploaded packages.

--
Sergio
GPG key ID: E92F D0B3 6B14 F1F4 D8E0 EB2F 106D A1C8 C3CB BF14

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 98f991c..d765eb3 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+qemu (1:6.2+dfsg-2ubuntu6.3) jammy; urgency=medium
7+
8+ * Fix unbalanced plugged counter in laio_io_unplug (LP: #1970737)
9+ - d/p/lp1970737-linux-aio-*.patch: Upstream patches.
10+
11+ -- Sergio Durigan Junior <sergio.durigan@canonical.com> Tue, 21 Jun 2022 17:07:50 -0400
12+
13 qemu (1:6.2+dfsg-2ubuntu6.2) jammy-security; urgency=medium
14
15 * SECURITY UPDATE: heap overflow in floppy disk emulator
16diff --git a/debian/patches/series b/debian/patches/series
17index 8d71725..a6da6ee 100644
18--- a/debian/patches/series
19+++ b/debian/patches/series
20@@ -37,3 +37,5 @@ CVE-2021-4207.patch
21 CVE-2022-0358.patch
22 CVE-2022-26353.patch
23 CVE-2022-26354.patch
24+ubuntu/lp1970737-linux-aio-fix-unbalanced-plugged-counter-in-laio_io_.patch
25+ubuntu/lp1970737-linux-aio-explain-why-max-batch-is-checked-in-laio_i.patch
26diff --git a/debian/patches/ubuntu/lp1970737-linux-aio-explain-why-max-batch-is-checked-in-laio_i.patch b/debian/patches/ubuntu/lp1970737-linux-aio-explain-why-max-batch-is-checked-in-laio_i.patch
27new file mode 100644
28index 0000000..187435c
29--- /dev/null
30+++ b/debian/patches/ubuntu/lp1970737-linux-aio-explain-why-max-batch-is-checked-in-laio_i.patch
31@@ -0,0 +1,37 @@
32+From: Stefan Hajnoczi <stefanha@redhat.com>
33+Date: Thu, 9 Jun 2022 17:47:12 +0100
34+Subject: linux-aio: explain why max batch is checked in laio_io_unplug()
35+
36+It may not be obvious why laio_io_unplug() checks max batch. I discussed
37+this with Stefano and have added a comment summarizing the reason.
38+
39+Cc: Stefano Garzarella <sgarzare@redhat.com>
40+Cc: Kevin Wolf <kwolf@redhat.com>
41+Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
42+Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
43+Message-id: 20220609164712.1539045-3-stefanha@redhat.com
44+Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
45+
46+Origin: upstream, https://gitlab.com/qemu-project/qemu/-/commit/99b969fbe105117f5af6060d3afef40ca39cc9c1
47+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1970737
48+---
49+ block/linux-aio.c | 6 ++++++
50+ 1 file changed, 6 insertions(+)
51+
52+diff --git a/block/linux-aio.c b/block/linux-aio.c
53+index 77f17ad..85650c4 100644
54+--- a/block/linux-aio.c
55++++ b/block/linux-aio.c
56+@@ -362,6 +362,12 @@ void laio_io_unplug(BlockDriverState *bs, LinuxAioState *s,
57+ assert(s->io_q.plugged);
58+ s->io_q.plugged--;
59+
60++ /*
61++ * Why max batch checking is performed here:
62++ * Another BDS may have queued requests with a higher dev_max_batch and
63++ * therefore in_queue could now exceed our dev_max_batch. Re-check the max
64++ * batch so we can honor our device's dev_max_batch.
65++ */
66+ if (s->io_q.in_queue >= laio_max_batch(s, dev_max_batch) ||
67+ (!s->io_q.plugged &&
68+ !s->io_q.blocked && !QSIMPLEQ_EMPTY(&s->io_q.pending))) {
69diff --git a/debian/patches/ubuntu/lp1970737-linux-aio-fix-unbalanced-plugged-counter-in-laio_io_.patch b/debian/patches/ubuntu/lp1970737-linux-aio-fix-unbalanced-plugged-counter-in-laio_io_.patch
70new file mode 100644
71index 0000000..c555b4d
72--- /dev/null
73+++ b/debian/patches/ubuntu/lp1970737-linux-aio-fix-unbalanced-plugged-counter-in-laio_io_.patch
74@@ -0,0 +1,44 @@
75+From: Stefan Hajnoczi <stefanha@redhat.com>
76+Date: Thu, 9 Jun 2022 17:47:11 +0100
77+Subject: linux-aio: fix unbalanced plugged counter in laio_io_unplug()
78+
79+Every laio_io_plug() call has a matching laio_io_unplug() call. There is
80+a plugged counter that tracks the number of levels of plugging and
81+allows for nesting.
82+
83+The plugged counter must reflect the balance between laio_io_plug() and
84+laio_io_unplug() calls accurately. Otherwise I/O stalls occur since
85+io_submit(2) calls are skipped while plugged.
86+
87+Reported-by: Nikolay Tenev <nt@storpool.com>
88+Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
89+Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
90+Message-id: 20220609164712.1539045-2-stefanha@redhat.com
91+Cc: Stefano Garzarella <sgarzare@redhat.com>
92+Fixes: 68d7946648 ("linux-aio: add `dev_max_batch` parameter to laio_io_unplug()")
93+[Stefano Garzarella suggested adding a Fixes tag.
94+--Stefan]
95+Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
96+
97+Origin: upstream, https://gitlab.com/qemu-project/qemu/-/commit/f387cac5af030a58ac5a0dacf64cab5e5a4fe5c7
98+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1970737
99+---
100+ block/linux-aio.c | 4 +++-
101+ 1 file changed, 3 insertions(+), 1 deletion(-)
102+
103+diff --git a/block/linux-aio.c b/block/linux-aio.c
104+index f53ae72..77f17ad 100644
105+--- a/block/linux-aio.c
106++++ b/block/linux-aio.c
107+@@ -360,8 +360,10 @@ void laio_io_unplug(BlockDriverState *bs, LinuxAioState *s,
108+ uint64_t dev_max_batch)
109+ {
110+ assert(s->io_q.plugged);
111++ s->io_q.plugged--;
112++
113+ if (s->io_q.in_queue >= laio_max_batch(s, dev_max_batch) ||
114+- (--s->io_q.plugged == 0 &&
115++ (!s->io_q.plugged &&
116+ !s->io_q.blocked && !QSIMPLEQ_EMPTY(&s->io_q.pending))) {
117+ ioq_submit(s);
118+ }

Subscribers

People subscribed via source and target branches