all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH qemu-server v4 8/9] hotplug: fix hot unplugging tablet on aarch64
Date: Fri, 23 Oct 2026 15:01:11 +0200	[thread overview]
Message-ID: <20261023130324.451252-9-d.csapak@proxmox.com> (raw)
In-Reply-To: <20261023130324.451252-1-d.csapak@proxmox.com>

On aarch64 guests, a keyboard device is added in addition to a tablet
device for `tablet: 1`. In contrast to the tablet device, this does not
show up in the `query-mice` qmp call and neither in `query-pci`.

It does show up in the `qom-list` call, but only usb(redirdev) devices
are extracted there.

This means that hot-unplugging a tablet device from an aarch64 vm leaves
the keyboard device plugged in, resulting in a mismatch between such a
running vm and a newly started one. This lets the live migration fail
for such guests.

To fix this, also extract `keyboard` devices out of `qom-list` and add a
test case for this, which would have failed without the fix.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/PVE/QemuServer.pm                         | 36 +++++++++++++++----
 src/test/hotplug/aarch64/tablet-disable.conf  | 20 +++++++++++
 .../aarch64/tablet-disable.conf.expected      |  2 ++
 src/test/hotplug/aarch64/tablet-enable.conf   |  2 --
 .../aarch64/tablet-enable.conf.expected       |  3 +-
 5 files changed, 53 insertions(+), 10 deletions(-)
 create mode 100644 src/test/hotplug/aarch64/tablet-disable.conf
 create mode 100644 src/test/hotplug/aarch64/tablet-disable.conf.expected

diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index 1efeeb66..5be49090 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -3871,7 +3871,7 @@ sub vm_devices_list {
     # qom-list path=/machine/peripheral
     my $resperipheral = mon_cmd($vmid, 'qom-list', path => '/machine/peripheral');
     foreach my $per (@$resperipheral) {
-        if ($per->{name} =~ m/^usb(?:redirdev)?\d+$/) {
+        if ($per->{name} =~ m/^(?:usb(?:redirdev)?\d+|keyboard)$/) {
             $devices->{ $per->{name} } = 1;
         }
     }
@@ -4566,9 +4566,20 @@ sub vmconfig_hotplug_pending {
             } elsif ($opt eq 'tablet') {
                 die "skip\n" if !$hotplug_features->{usb};
                 if ($defaults->{tablet}) {
-                    vm_deviceplug($storecfg, $conf, $vmid, 'tablet', $arch, $machine_type->());
-                    vm_deviceplug($storecfg, $conf, $vmid, 'keyboard', $arch, $machine_type->())
-                        if $arch eq 'aarch64';
+                    vm_deviceplug(
+                        $storecfg, $conf, $vmid, 'tablet', undef, $arch, $machine_type->(),
+                    );
+                    if ($arch eq 'aarch64') {
+                        vm_deviceplug(
+                            $storecfg,
+                            $conf,
+                            $vmid,
+                            'keyboard',
+                            undef,
+                            $arch,
+                            $machine_type->(),
+                        );
+                    }
                 } else {
                     vm_deviceunplug($vmid, $conf, 'tablet');
                     vm_deviceunplug($vmid, $conf, 'keyboard') if $arch eq 'aarch64';
@@ -4637,9 +4648,20 @@ sub vmconfig_hotplug_pending {
             } elsif ($opt eq 'tablet') {
                 die "skip\n" if !$hotplug_features->{usb};
                 if ($value == 1) {
-                    vm_deviceplug($storecfg, $conf, $vmid, 'tablet', $arch, $machine_type->());
-                    vm_deviceplug($storecfg, $conf, $vmid, 'keyboard', $arch, $machine_type->())
-                        if $arch eq 'aarch64';
+                    vm_deviceplug(
+                        $storecfg, $conf, $vmid, 'tablet', undef, $arch, $machine_type->(),
+                    );
+                    if ($arch eq 'aarch64') {
+                        vm_deviceplug(
+                            $storecfg,
+                            $conf,
+                            $vmid,
+                            'keyboard',
+                            undef,
+                            $arch,
+                            $machine_type->(),
+                        );
+                    }
                 } elsif ($value == 0) {
                     vm_deviceunplug($vmid, $conf, 'tablet');
                     vm_deviceunplug($vmid, $conf, 'keyboard') if $arch eq 'aarch64';
diff --git a/src/test/hotplug/aarch64/tablet-disable.conf b/src/test/hotplug/aarch64/tablet-disable.conf
new file mode 100644
index 00000000..5dccd220
--- /dev/null
+++ b/src/test/hotplug/aarch64/tablet-disable.conf
@@ -0,0 +1,20 @@
+# TEST: disabling the tablet device on aarch64 also hot-unplugs the keyboard
+# HOST_ARCH: aarch64
+arch: aarch64
+bios: ovmf
+bootdisk: scsi0
+cores: 2
+efidisk0: local:8006/vm-8006-disk-2.qcow2,efitype=4m
+machine: virt-10.1
+memory: 2048
+name: hotplug
+net0: virtio=A2:C0:43:77:08:A0,bridge=vmbr0
+ostype: l26
+scsi0: local:8006/vm-8006-disk-0.qcow2,size=32G
+scsihw: virtio-scsi-pci
+smbios1: uuid=7b10d7af-b932-4c66-b2c3-3996152ec465
+sockets: 1
+vmgenid: c773c261-d800-4348-9f5d-167fadd53cf8
+
+[PENDING]
+tablet: 0
diff --git a/src/test/hotplug/aarch64/tablet-disable.conf.expected b/src/test/hotplug/aarch64/tablet-disable.conf.expected
new file mode 100644
index 00000000..fc5a5751
--- /dev/null
+++ b/src/test/hotplug/aarch64/tablet-disable.conf.expected
@@ -0,0 +1,2 @@
+hmp device_del tablet
+hmp device_del keyboard
diff --git a/src/test/hotplug/aarch64/tablet-enable.conf b/src/test/hotplug/aarch64/tablet-enable.conf
index a07300e9..bb523819 100644
--- a/src/test/hotplug/aarch64/tablet-enable.conf
+++ b/src/test/hotplug/aarch64/tablet-enable.conf
@@ -1,7 +1,5 @@
 # TEST: enabling the tablet device on aarch64 hotplugs tablet and keyboard
 # HOST_ARCH: aarch64
-# EXPECTED_ERROR: tablet: hotplug problem - Too few arguments for subroutine 'PVE::QemuServer::QMPHelpers::qemu_deviceadd' (got 1; expected 2) at X line Y
-# STAYS_PENDING: 1
 arch: aarch64
 bios: ovmf
 bootdisk: scsi0
diff --git a/src/test/hotplug/aarch64/tablet-enable.conf.expected b/src/test/hotplug/aarch64/tablet-enable.conf.expected
index 800f9296..7200f76b 100644
--- a/src/test/hotplug/aarch64/tablet-enable.conf.expected
+++ b/src/test/hotplug/aarch64/tablet-enable.conf.expected
@@ -1 +1,2 @@
-hmp device_add driver=usb-tablet,id=tablet,bus=uhci.0,port=1
+hmp device_add driver=usb-tablet,id=tablet,bus=ehci.0,port=1
+hmp device_add driver=usb-kbd,id=keyboard,bus=ehci.0,port=2
-- 
2.47.3





  parent reply	other threads:[~2026-10-23 13:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-23 13:01 [PATCH qemu-server v4 0/9] add hotplug tests and fix uncovered bugs Dominik Csapak
2026-10-23 13:01 ` [PATCH qemu-server v4 1/9] tests: factor out useful commandline mocks for reuse Dominik Csapak
2026-10-23 13:01 ` [PATCH qemu-server v4 2/9] tests: factor out the diff generation Dominik Csapak
2026-10-23 13:01 ` [PATCH qemu-server v4 3/9] machine: factor out machine expanding Dominik Csapak
2026-10-23 13:01 ` [PATCH qemu-server v4 4/9] tests: hotplug: add initial hotplug test harness Dominik Csapak
2026-10-23 13:01 ` [PATCH qemu-server v4 5/9] tests: hotplug: add some test cases Dominik Csapak
2026-10-23 13:01 ` [PATCH qemu-server v4 6/9] tests: hotplug: add test case for adding scsi14 on qemu 11.1 Dominik Csapak
2026-10-23 13:01 ` [PATCH qemu-server v4 7/9] tests: hotplug: add cases for known defects Dominik Csapak
2026-10-23 13:01 ` Dominik Csapak [this message]
2026-10-23 13:01 ` [PATCH qemu-server v4 9/9] hotplug: remove iothread if adding drive device failed Dominik Csapak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261023130324.451252-9-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal