From patchwork Mon Dec 5 20:18:34 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric B Munson X-Patchwork-Id: 129416 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 946261007D5 for ; Tue, 6 Dec 2011 07:18:48 +1100 (EST) Received: from localhost ([::1]:45835 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RXezt-0001yR-7y for incoming@patchwork.ozlabs.org; Mon, 05 Dec 2011 15:18:45 -0500 Received: from eggs.gnu.org ([140.186.70.92]:44231) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RXezn-0001yJ-VF for qemu-devel@nongnu.org; Mon, 05 Dec 2011 15:18:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RXezm-0001bI-Ie for qemu-devel@nongnu.org; Mon, 05 Dec 2011 15:18:39 -0500 Received: from oz.csail.mit.edu ([128.30.30.239]:36706 helo=mail.mgebm.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RXezm-0001b9-DQ for qemu-devel@nongnu.org; Mon, 05 Dec 2011 15:18:38 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.mgebm.net (Postfix) with ESMTP id 327C514B8A5; Mon, 5 Dec 2011 15:17:36 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at smtp.mgebm.net Received: from mail.mgebm.net ([127.0.0.1]) by localhost (ozymandias.mgebm.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id b3KK3VD6cGSr; Mon, 5 Dec 2011 15:17:35 -0500 (EST) Received: from bert.mgebm.net (EASTGATE-FORTY-NINE.MIT.EDU [18.97.5.49]) by mail.mgebm.net (Postfix) with ESMTPSA id 4F08F14B848; Mon, 5 Dec 2011 15:17:35 -0500 (EST) Received: by bert.mgebm.net (Postfix, from userid 1000) id 8D68C15C12B2; Mon, 5 Dec 2011 15:18:36 -0500 (EST) From: Eric B Munson To: qemu-devel@nongnu.org Date: Mon, 5 Dec 2011 15:18:34 -0500 Message-Id: <1323116314-17843-1-git-send-email-emunson@mgebm.net> X-Mailer: git-send-email 1.7.5.4 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 128.30.30.239 Cc: ryanh@linux.vnet.ibm.com, aliguori@us.ibm.com, kvm@vger.kernel.org, Jan Kiszka , Marcelo Tosatti , Eric B Munson , Avi Kivity Subject: [Qemu-devel] [PATCH V4] Guest stop notification X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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. Signed-off-by: Eric B Munson Cc: Avi Kivity Cc: Marcelo Tosatti Cc: Jan Kiszka Cc: ryanh@linux.vnet.ibm.com Cc: aliguori@us.ibm.com Cc: kvm@vger.kernel.org --- 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 hw/kvmclock.c | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/hw/kvmclock.c b/hw/kvmclock.c index 5388bc4..fa11dd7 100644 --- a/hw/kvmclock.c +++ b/hw/kvmclock.c @@ -16,6 +16,7 @@ #include "sysbus.h" #include "kvm.h" #include "kvmclock.h" +#include "cpu-all.h" #include #include @@ -62,10 +63,24 @@ static int kvmclock_post_load(void *opaque, int version_id) static void kvmclock_vm_state_change(void *opaque, int running, RunState state) { + int ret; + CPUState *penv = first_cpu; KVMClockState *s = opaque; if (running) { s->clock_valid = false; + + for (penv = first_cpu; penv != NULL; penv = penv->next_cpu) { + ret = kvm_vcpu_ioctl(penv, KVMCLOCK_GUEST_PAUSED, 0); + if (ret) { + if (ret != -EINVAL) { + fprintf(stderr, + "kvmclock_vm_state_change: %s\n", + strerror(-ret)); + } + return; + } + } } }