Skip to contentSkip to conversation

Guest stop notification

PATCH Applied Raghavendra K T 3 participants 3 messages Apr 7, 2012 – Apr 12, 2012 KVM

lore
Share & tools
lore
#0 lore raw

PATCH v9 1/1 Guest stop notification

From: Eric B Munson <[email protected]>

Often when a guest is stopped from the qemu console, it will report spurious soft lockup warnings on resume. There are kernel patches being discussed that will give the host the ability to tell the guest that it is being stopped and should ignore the soft lockup warning that generates. This patch uses the qemu Notifier system to tell the guest it is about to be stopped.

Cc Eric B Munson <[email protected]>
Cc Avi Kivity <[email protected]>
Cc Marcelo Tosatti <[email protected]>
Cc Anthony Liguori <[email protected]>
Cc Jan Kiszka <[email protected]>
Cc Andreas Färber <[email protected]>

---
Changes from V8:
incorporated Andrea's comments:
use __func__ in place of actual function name
change ret variable order
no whitespace before %s in fprintf

Changes from V7:
capabilty changed to KVM_CAP_KVMCLOCK_CTRL KVM_GUEST_PAUSED is pervcpu again
CPUState renamed to CPUArchState KVMCLOCK_GUEST_PAUSED changed to KVM_KVMCLOCK_CTRL

Changes from V6:
Remove unnecessary include

Changes from V5:
KVM_GUEST_PAUSED is now a per vm ioctl instead of per vcpu

Changes from V4:
Test if the guest paused capability is available before use

Changes from V3:
Collapse new state change notification function into existsing function. Correct whitespace issues
Change ioctl name to KVMCLOCK_GUEST_PAUSED
Use for loop to iterate vpcu's

Changes from V2:
Move ioctl into hw/kvmclock.c so as other arches can use it as it is
implemented

Changes from V1:
Remove unnecessary encapsulating function
---
not included Andreas's Reviewed by since used __func__ instead of __FUNCTION__ V8 of the patch was Reviewed-by: Andreas Färber <[email protected]>

hw/kvm/clock.c +16 -0
index 446bd62..824b978 100644
@@ -65,9 +65,25 @@ static void kvmclock_vm_state_change(void *opaque, int running,
                                      RunState state)
 {
     KVMClockState *s = opaque;
+    CPUArchState *penv = first_cpu;
+    int cap_clock_ctrl = kvm_check_extension(kvm_state, KVM_CAP_KVMCLOCK_CTRL);
+    int ret;
 
     if (running) {
         s->clock_valid = false;
+
+        if (!cap_clock_ctrl) {
+            return;
+        }
+        for (penv = first_cpu; penv != NULL; penv = penv->next_cpu) {
+            ret = kvm_vcpu_ioctl(penv, KVM_KVMCLOCK_CTRL, 0);
+            if (ret) {
+                if (ret != -EINVAL) {
+                    fprintf(stderr, "%s: %s\n", __func__, strerror(-ret));
+                }
+                return;
+            }
+        }
     }
 }
 
Reviewed-by on v9 1/1
#1 lore raw

Am 07.04.2012 02:47, schrieb Raghavendra K T:

Quoted 10 lines

From: Eric B Munson <[email protected]>

Often when a guest is stopped from the qemu console, it will report spurious soft lockup warnings on resume. There are kernel patches being discussed that will give the host the ability to tell the guest that it is being stopped and should ignore the soft lockup warning that generates. This patch uses the qemu Notifier system to tell the guest it is about to be stopped.

Thanks,
Andreas

P.S. No need to resend now, you'll either get more comments or someone will apply it to uq/master or master. Note that there's public holidays in Germany and Israel.

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#2 lore raw
In reply to Raghavendra K T
Quoted 10 lines · Raghavendra K T

From: Eric B Munson <[email protected]>

Often when a guest is stopped from the qemu console, it will report spurious soft lockup warnings on resume. There are kernel patches being discussed that will give the host the ability to tell the guest that it is being stopped and should ignore the soft lockup warning that generates. This patch uses the qemu Notifier system to tell the guest it is about to be stopped.

Applied, thanks.