From patchwork Tue Jan 17 18:27:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric B Munson X-Patchwork-Id: 136514 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 CE056B6EEB for ; Wed, 18 Jan 2012 05:27:51 +1100 (EST) Received: from localhost ([::1]:53259 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RnDl7-0005Ma-Od for incoming@patchwork.ozlabs.org; Tue, 17 Jan 2012 13:27:49 -0500 Received: from eggs.gnu.org ([140.186.70.92]:39890) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RnDl2-0005MJ-Fh for qemu-devel@nongnu.org; Tue, 17 Jan 2012 13:27:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RnDkz-0006Lx-FI for qemu-devel@nongnu.org; Tue, 17 Jan 2012 13:27:44 -0500 Received: from oz.csail.mit.edu ([128.30.30.239]:36626 helo=mail.mgebm.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RnDkz-0006Lp-AG for qemu-devel@nongnu.org; Tue, 17 Jan 2012 13:27:41 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.mgebm.net (Postfix) with ESMTP id 66C9D14FCF8; Tue, 17 Jan 2012 13:25:43 -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 QGli4cBUbAzk; Tue, 17 Jan 2012 13:25:42 -0500 (EST) Received: from bert.mgebm.net (EASTGATE-FORTY-NINE.MIT.EDU [18.97.5.49]) by mail.mgebm.net (Postfix) with ESMTPSA id 5574814FCD4; Tue, 17 Jan 2012 13:25:42 -0500 (EST) Received: by bert.mgebm.net (Postfix, from userid 1000) id 82FA715C08AD; Tue, 17 Jan 2012 13:27:39 -0500 (EST) From: Eric B Munson To: qemu-devel@nongnu.org Date: Tue, 17 Jan 2012 13:27:36 -0500 Message-Id: <1326824856-15041-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 V7] 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 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 hw/kvmclock.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/hw/kvmclock.c b/hw/kvmclock.c index 3b9fb20..ad79f52 100644 --- a/hw/kvmclock.c +++ b/hw/kvmclock.c @@ -64,10 +64,21 @@ static int kvmclock_post_load(void *opaque, int version_id) static void kvmclock_vm_state_change(void *opaque, int running, RunState state) { + int ret; KVMClockState *s = opaque; + int cap_guest_paused = kvm_check_extension(kvm_state, KVM_CAP_GUEST_PAUSED); if (running) { s->clock_valid = false; + + if (!cap_guest_paused) { + return; + } + + ret = kvm_vm_ioctl(kvm_state, KVMCLOCK_GUEST_PAUSED, 0); + if (ret) { + fprintf(stderr, "kvmclock_vm_state_change: %s\n", strerror(-ret)); + } } }