Skip to contentSkip to conversation

hw/intc/arm_gicv3_its: Fix the VM termination in vm_change_state_handler()

PATCH In review Shanker Donthineni 2 participants 3 messages Nov 3, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/intc/arm_gicv3_its: Fix the VM termination in vm_change_state_handler()

The commit cddafd8f353d ("hw/intc/arm_gicv3_its: Implement state save /restore") breaks the backward compatibility with the older kernels where vITS save/restore support is not available. The vmstate function vm_change_state_handler() should not be registered if the running kernel doesn't support ITS save/restore feature. Otherwise VM instance will be killed whenever vmstate callback function is invoked.

Observed a virtual machine shutdown with QEMU-2.10+linux-4.11 when testing the reboot command "virsh reboot <domain> --mode acpi" instead of reboot.

KVM Error: 'KVM_SET_DEVICE_ATTR failed: Group 4 attr 0x00000000000001'

---
 hw/intc/arm_gicv3_its_kvm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/intc/arm_gicv3_its_kvm.c +2 -2
index 39903d5..9b00ce5 100644
@@ -111,13 +111,13 @@ static void kvm_arm_its_realize(DeviceState *dev, Error **errp)
             error_free(s->migration_blocker);
             return;
         }
+    } else {
+        qemu_add_vm_change_state_handler(vm_change_state_handler, s);
     }
 
     kvm_msi_use_devid = true;
     kvm_gsi_direct_mapping = false;
     kvm_msi_via_irqfd_allowed = kvm_irqfds_enabled();
-
-    qemu_add_vm_change_state_handler(vm_change_state_handler, s);
 }
 
 /**
Signature · 8 lines
Qualcomm Datacenter Technologies, Inc. on behalf of the Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw

Hi Shanker,

I think you sent this patch to the wrong ML and people. This patch seem KVM specific.

Cheers,

Quoted 38 lines · Shanker Donthineni

The commit cddafd8f353d ("hw/intc/arm_gicv3_its: Implement state save /restore") breaks the backward compatibility with the older kernels where vITS save/restore support is not available. The vmstate function vm_change_state_handler() should not be registered if the running kernel doesn't support ITS save/restore feature. Otherwise VM instance will be killed whenever vmstate callback function is invoked.

Observed a virtual machine shutdown with QEMU-2.10+linux-4.11 when testing the reboot command "virsh reboot <domain> --mode acpi" instead of reboot.

KVM Error: 'KVM_SET_DEVICE_ATTR failed: Group 4 attr 0x00000000000001'

---
  hw/intc/arm_gicv3_its_kvm.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
hw/intc/arm_gicv3_its_kvm.c +2 -2
index 39903d5..9b00ce5 100644
@@ -111,13 +111,13 @@ static void kvm_arm_its_realize(DeviceState *dev, Error **errp)
              error_free(s->migration_blocker);
              return;
          }
+    } else {
+        qemu_add_vm_change_state_handler(vm_change_state_handler, s);
      }
 
      kvm_msi_use_devid = true;
      kvm_gsi_direct_mapping = false;
      kvm_msi_via_irqfd_allowed = kvm_irqfds_enabled();
-
-    qemu_add_vm_change_state_handler(vm_change_state_handler, s);
  }
 
  /**
Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#2 lore raw

Thanks Julien, sorry for sending to XEN mailing list and it was my mistake.

Thanks,
Shanker

-----Original Message-----
From: Xen-devel [mailto:[email protected]] On Behalf Of Julien Grall
Sent: Friday, November 3, 2017 6:51 AM
To: Shanker Donthineni <[email protected]>; xen-devel <[email protected]>; Julien Grall <[email protected]>; Stefano Stabellini <[email protected]>
Cc: Philip Elcan <[email protected]>; Vikram Sethi <[email protected]>
Subject: Re: [Xen-devel] [PATCH 1/1] hw/intc/arm_gicv3_its: Fix the VM termination in vm_change_state_handler()

Hi Shanker,

I think you sent this patch to the wrong ML and people. This patch seem KVM specific.

Cheers,

Quoted 28 lines · Shanker Donthineni

The commit cddafd8f353d ("hw/intc/arm_gicv3_its: Implement state save /restore") breaks the backward compatibility with the older kernels where vITS save/restore support is not available. The vmstate function vm_change_state_handler() should not be registered if the running kernel doesn't support ITS save/restore feature. Otherwise VM instance will be killed whenever vmstate callback function is invoked.

Observed a virtual machine shutdown with QEMU-2.10+linux-4.11 when testing the reboot command "virsh reboot <domain> --mode acpi" instead of reboot.

KVM Error: 'KVM_SET_DEVICE_ATTR failed: Group 4 attr 0x00000000000001'

---
  hw/intc/arm_gicv3_its_kvm.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
hw/intc/arm_gicv3_its_kvm.c +2 -0
index 39903d5..9b00ce5 100644
@@ -111,13 +111,13 @@ static void kvm_arm_its_realize(DeviceState *dev, Error **errp)
              error_free(s->migration_blocker);
              return;
          }
+    } else {
+        qemu_add_vm_change_state_handler(vm_change_state_handler, s);

hw/intc/arm_gicv3_its_kvm.c static void kvm_arm_its_realize(DeviceState *dev, Error **errp) · line 123

Quoted 10 lines
hw/intc/arm_gicv3_its_kvm.c +0 -2
      }
 
      kvm_msi_use_devid = true;
      kvm_gsi_direct_mapping = false;
      kvm_msi_via_irqfd_allowed = kvm_irqfds_enabled();
-
-    qemu_add_vm_change_state_handler(vm_change_state_handler, s);
  }
 
  /**

--
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel