Merge ~sergiodj/ubuntu/+source/qemu:allow-repeating-hot-unplug-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: cb2451d8ad3372465500f89b472fc2e4741f9ccd
Proposed branch: ~sergiodj/ubuntu/+source/qemu:allow-repeating-hot-unplug-jammy
Merge into: ubuntu/+source/qemu:ubuntu/jammy-devel
Diff against target: 105 lines (+83/-0)
3 files modified
debian/changelog (+8/-0)
debian/patches/series (+1/-0)
debian/patches/ubuntu/allow-repeating-hot-unplug-requests.patch (+74/-0)
Reviewer Review Type Date Requested Status
git-ubuntu bot Approve
Lena Voytek (community) Approve
Canonical Server Reporter Pending
Review via email: mp+443753@code.launchpad.net

Description of the change

This MP is the Jammy version of https://code.launchpad.net/~sergiodj/ubuntu/+source/qemu/+git/qemu/+merge/443231.

The backported patch is exactly the same.

PPA: https://launchpad.net/~sergiodj/+archive/ubuntu/qemu

dep8 results:

Results: (from http://autopkgtest.ubuntu.com/results/autopkgtest-jammy-sergiodj-qemu/?format=plain)
  qemu @ amd64:
    27.05.23 19:29:31 Log 🗒️ ✅ Triggers: qemu/1:6.2+dfsg-2ubuntu6.10~ppa1
  qemu @ armhf:
    28.05.23 13:30:31 Log 🗒️ ✅ Triggers: qemu/1:6.2+dfsg-2ubuntu6.10~ppa1
  qemu @ ppc64el:
    29.05.23 09:14:46 Log 🗒️ ✅ Triggers: qemu/1:6.2+dfsg-2ubuntu6.10~ppa1

I'll post results for s390x and arm64 when I have them.

To post a comment you must log in.
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Forgot to mention that I also reproduced the issue and verified the fix locally. Let me know if you'd like detailed instructions on how to do the same.

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

I'd like to verify a few more things, so I'm marking this as WIP.

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

OK, I modified the Test Plan to better explain how to reproduce the issue. This MP is ready to be reviewed.

Revision history for this message
Lena Voytek (lvoytek) wrote :

LGTM, patch matches up with mantic. Added an additional optional request in the comments. The SRU report on the bug also looks good

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

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

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

Thanks for the review, Lena.

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

Uploaded:

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

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 30759b6..5ce8296 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,11 @@
6+qemu (1:6.2+dfsg-2ubuntu6.10) jammy; urgency=medium
7+
8+ * d/p/u/allow-repeating-hot-unplug-requests.patch: Allow repeating
9+ hot-unplug requests by making ACPI PCI able to requeue them.
10+ (LP: #2018733)
11+
12+ -- Sergio Durigan Junior <sergio.durigan@canonical.com> Fri, 26 May 2023 17:40:31 -0400
13+
14 qemu (1:6.2+dfsg-2ubuntu6.9) jammy; urgency=medium
15
16 * d/p/u/lp-2019766-target-arm-kvm-Retry-KVM_CREATE_VM-call-if-it-fails-.patch:
17diff --git a/debian/patches/series b/debian/patches/series
18index 63a907e..20ff7f6 100644
19--- a/debian/patches/series
20+++ b/debian/patches/series
21@@ -57,3 +57,4 @@ ubuntu/lp-2011832-target-ppc-Fix-xs-max-min-cj-dp-to-use-VSX-registers.patch
22 ubuntu/lp-2011832-target-mips-Fix-df_extract_val-and-df_extract_df-dfe.patch
23 ubuntu/lp-2011832-target-mips-Fix-FTRUNC_S-and-FTRUNC_U-trans-helper.patch
24 ubuntu/lp-2019766-target-arm-kvm-Retry-KVM_CREATE_VM-call-if-it-fails-.patch
25+ubuntu/allow-repeating-hot-unplug-requests.patch
26diff --git a/debian/patches/ubuntu/allow-repeating-hot-unplug-requests.patch b/debian/patches/ubuntu/allow-repeating-hot-unplug-requests.patch
27new file mode 100644
28index 0000000..8128c0b
29--- /dev/null
30+++ b/debian/patches/ubuntu/allow-repeating-hot-unplug-requests.patch
31@@ -0,0 +1,74 @@
32+From 0f689cf5ada4d5df5ab95c7f7aa9fc221afa855d Mon Sep 17 00:00:00 2001
33+From: Igor Mammedov <imammedo@redhat.com>
34+Date: Tue, 18 Apr 2023 11:04:49 +0200
35+Subject: [PATCH] acpi: pcihp: allow repeating hot-unplug requests
36+
37+with Q35 using ACPI PCI hotplug by default, user's request to unplug
38+device is ignored when it's issued before guest OS has been booted.
39+And any additional attempt to request device hot-unplug afterwards
40+results in following error:
41+
42+ "Device XYZ is already in the process of unplug"
43+
44+arguably it can be considered as a regression introduced by [2],
45+before which it was possible to issue unplug request multiple
46+times.
47+
48+Accept new uplug requests after timeout (1ms). This brings ACPI PCI
49+hotplug on par with native PCIe unplug behavior [1] and allows user
50+to repeat unplug requests at propper times.
51+Set expire timeout to arbitrary 1msec so user won't be able to
52+flood guest with SCI interrupts by calling device_del in tight loop.
53+
54+PS:
55+ACPI spec doesn't mandate what OSPM can do with GPEx.status
56+bits set before it's booted => it's impl. depended.
57+Status bits may be retained (I tested with one Windows version)
58+or cleared (Linux since 2.6 kernel times) during guest's ACPI
59+subsystem initialization.
60+Clearing status bits (though not wrong per se) hides the unplug
61+event from guest, and it's upto user to repeat device_del later
62+when guest is able to handle unplug requests.
63+
64+1) 18416c62e3 ("pcie: expire pending delete")
65+2)
66+Fixes: cce8944cc9ef ("qdev-monitor: Forbid repeated device_del")
67+Signed-off-by: Igor Mammedov <imammedo@redhat.com>
68+Acked-by: Gerd Hoffmann <kraxel@redhat.com>
69+CC: mst@redhat.com
70+CC: anisinha@redhat.com
71+CC: jusual@redhat.com
72+CC: kraxel@redhat.com
73+Message-Id: <20230418090449.2155757-1-imammedo@redhat.com>
74+Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
75+Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
76+Reviewed-by: Ani Sinha <anisinha@redhat.com>
77+
78+Origin: upstream, https://gitlab.com/qemu-project/qemu/-/commit/0f689cf5ada4
79+Bug: https://gitlab.com/libvirt/libvirt/-/issues/309
80+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/2018733
81+---
82+ hw/acpi/pcihp.c | 10 ++++++++++
83+ 1 file changed, 10 insertions(+)
84+
85+Index: qemu/hw/acpi/pcihp.c
86+===================================================================
87+--- a/hw/acpi/pcihp.c 2023-05-26 16:00:52.488394876 -0400
88++++ b/hw/acpi/pcihp.c 2023-05-26 16:00:52.488394876 -0400
89+@@ -420,6 +420,16 @@
90+ * acpi_pcihp_eject_slot() when the operation is completed.
91+ */
92+ pdev->qdev.pending_deleted_event = true;
93++ /* if unplug was requested before OSPM is initialized,
94++ * linux kernel will clear GPE0.sts[] bits during boot, which effectively
95++ * hides unplug event. And than followup qmp_device_del() calls remain
96++ * blocked by above flag permanently.
97++ * Unblock qmp_device_del() by setting expire limit, so user can
98++ * repeat unplug request later when OSPM has been booted.
99++ */
100++ pdev->qdev.pending_deleted_expires_ms =
101++ qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL); /* 1 msec */
102++
103+ s->acpi_pcihp_pci_status[bsel].down |= (1U << slot);
104+ acpi_send_event(DEVICE(hotplug_dev), ACPI_PCI_HOTPLUG_STATUS);
105+ }

Subscribers

People subscribed via source and target branches