public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH qemu-server] Fix: cpu hotplug feature can't be changed online
@ 2023-10-10 15:37 Alexandre Derumier
  2023-10-11 12:30 ` Fiona Ebner
  2023-10-24  9:47 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 2 replies; 4+ messages in thread
From: Alexandre Derumier @ 2023-10-10 15:37 UTC (permalink / raw)
  To: pve-devel

The cpus are passed as devices with specific id only when cpu hotplug is enable
at start.
We can't enable/disable it online or vcpu hotplug api will thrown errors
not finding core id.

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
---
 PVE/QemuServer.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 2895675..22d1c71 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -4961,7 +4961,7 @@ sub vmconfig_hotplug_pending {
 	my $force = $pending_delete_hash->{$opt}->{force};
 	eval {
 	    if ($opt eq 'hotplug') {
-		die "skip\n" if ($conf->{hotplug} =~ /memory/);
+		die "skip\n" if ($conf->{hotplug} =~ /(cpu|memory)/);
 	    } elsif ($opt eq 'tablet') {
 		die "skip\n" if !$hotplug_features->{usb};
 		if ($defaults->{tablet}) {
@@ -5022,6 +5022,7 @@ sub vmconfig_hotplug_pending {
 	eval {
 	    if ($opt eq 'hotplug') {
 		die "skip\n" if ($value =~ /memory/) || ($value !~ /memory/ && $conf->{hotplug} =~ /memory/);
+		die "skip\n" if ($value =~ /cpu/) || ($value !~ /cpu/ && $conf->{hotplug} =~ /cpu/);
 	    } elsif ($opt eq 'tablet') {
 		die "skip\n" if !$hotplug_features->{usb};
 		if ($value == 1) {
-- 
2.39.2




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [pve-devel] [PATCH qemu-server] Fix: cpu hotplug feature can't be changed online
  2023-10-10 15:37 [pve-devel] [PATCH qemu-server] Fix: cpu hotplug feature can't be changed online Alexandre Derumier
@ 2023-10-11 12:30 ` Fiona Ebner
  2023-10-23 21:51   ` DERUMIER, Alexandre
  2023-10-24  9:47 ` [pve-devel] applied: " Thomas Lamprecht
  1 sibling, 1 reply; 4+ messages in thread
From: Fiona Ebner @ 2023-10-11 12:30 UTC (permalink / raw)
  To: Proxmox VE development discussion, Alexandre Derumier

Am 10.10.23 um 17:37 schrieb Alexandre Derumier:
> The cpus are passed as devices with specific id only when cpu hotplug is enable
> at start.
> We can't enable/disable it online or vcpu hotplug api will thrown errors
> not finding core id.

When removing cores after enabling the option this is true, but I can
1. start a VM without CPU hotplug and fewer than max vCPUs
2. enable CPU hotplug
3. add more cores

And doing the disable of the option online also doesn't seem problematic
at a first glance. So I thought this would technically be a breaking change.

But actually, the change is completely justified, because of migration.
Because the QEMU commandline changes based on the hotplug setting, so
the source and target VM will not agree and loading the state on the
target will get confused and crash:

> Oct 11 14:08:23 pve8a2 QEMU[160882]: kvm: get_pci_config_device: Bad config data: i=0x9a read: 8 device: 3 cmask: ff wmask: 0 w1cmask:0
> Oct 11 14:08:23 pve8a2 QEMU[160882]: kvm: Failed to load PCIDevice:config
> Oct 11 14:08:23 pve8a2 QEMU[160882]: kvm: Failed to load virtio-scsi:virtio
> Oct 11 14:08:23 pve8a2 QEMU[160882]: kvm: error while loading state for instance 0x0 of device '0000:00:05.0/virtio-scsi'
> Oct 11 14:08:23 pve8a2 QEMU[160882]: kvm: load of migration failed: Invalid argument

Therefore,
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [pve-devel] [PATCH qemu-server] Fix: cpu hotplug feature can't be changed online
  2023-10-11 12:30 ` Fiona Ebner
@ 2023-10-23 21:51   ` DERUMIER, Alexandre
  0 siblings, 0 replies; 4+ messages in thread
From: DERUMIER, Alexandre @ 2023-10-23 21:51 UTC (permalink / raw)
  To: pve-devel, aderumier, f.ebner

Am 10.10.23 um 17:37 schrieb Alexandre Derumier:
> The cpus are passed as devices with specific id only when cpu hotplug
> is enable
> at start.
> We can't enable/disable it online or vcpu hotplug api will thrown
> errors
> not finding core id.

>>When removing cores after enabling the option this is true, but I can
>>1. start a VM without CPU hotplug and fewer than max vCPUs
>>2. enable CPU hotplug
>>3. add more cores

>>And doing the disable of the option online also doesn't seem
>>problematic
>>at a first glance. So I thought this would technically be a breaking
>>change.

Note that is also breaking unplug of cores present before enable
hotplug

>>1. start a VM without CPU hotplug and fewer than max vCPUs
>>2. enable CPU hotplug
>>3. remove cores



(But yes, the more important is migration breaking)





^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] applied: [PATCH qemu-server] Fix: cpu hotplug feature can't be changed online
  2023-10-10 15:37 [pve-devel] [PATCH qemu-server] Fix: cpu hotplug feature can't be changed online Alexandre Derumier
  2023-10-11 12:30 ` Fiona Ebner
@ 2023-10-24  9:47 ` Thomas Lamprecht
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Lamprecht @ 2023-10-24  9:47 UTC (permalink / raw)
  To: Proxmox VE development discussion, Alexandre Derumier

Am 10/10/2023 um 17:37 schrieb Alexandre Derumier:
> The cpus are passed as devices with specific id only when cpu hotplug is enable
> at start.
> We can't enable/disable it online or vcpu hotplug api will thrown errors
> not finding core id.
> 
> Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
> ---
>  PVE/QemuServer.pm | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-10-24  9:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-10 15:37 [pve-devel] [PATCH qemu-server] Fix: cpu hotplug feature can't be changed online Alexandre Derumier
2023-10-11 12:30 ` Fiona Ebner
2023-10-23 21:51   ` DERUMIER, Alexandre
2023-10-24  9:47 ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal