From patchwork Fri Apr 13 01:32:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 152243 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 55BD4B6FDF for ; Fri, 13 Apr 2012 11:59:16 +1000 (EST) Received: from localhost ([::1]:58787 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SIVSW-0000t4-2h for incoming@patchwork.ozlabs.org; Thu, 12 Apr 2012 21:37:56 -0400 Received: from eggs.gnu.org ([208.118.235.92]:39101) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SIVRX-0006dO-ER for qemu-devel@nongnu.org; Thu, 12 Apr 2012 21:36:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SIVRV-0002FV-Kb for qemu-devel@nongnu.org; Thu, 12 Apr 2012 21:36:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:6727) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SIVRV-0002F6-Bd for qemu-devel@nongnu.org; Thu, 12 Apr 2012 21:36:53 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q3D1amDZ029619 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 12 Apr 2012 21:36:48 -0400 Received: from amt.cnet (vpn-8-174.rdu.redhat.com [10.11.8.174]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q3D1alG1013822; Thu, 12 Apr 2012 21:36:47 -0400 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 684FC7A35B; Thu, 12 Apr 2012 22:33:01 -0300 (BRT) Received: (from marcelo@localhost) by amt.cnet (8.14.5/8.14.5/Submit) id q3D1Wwnx014008; Thu, 12 Apr 2012 22:32:58 -0300 From: Marcelo Tosatti To: Anthony Liguori Date: Thu, 12 Apr 2012 22:32:42 -0300 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-MIME-Autoconverted: from 8bit to quoted-printable by mx1.redhat.com id q3D1amDZ029619 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Marcelo Tosatti , Raghavendra K T , qemu-devel@nongnu.org, kvm@vger.kernel.org, Eric B Munson Subject: [Qemu-devel] [PATCH 7/7] kvmclock: 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 From: Eric B Munson 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 Signed-off-by: Raghavendra K T Reviewed-by: Andreas Färber Signed-off-by: Marcelo Tosatti --- hw/kvm/clock.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/hw/kvm/clock.c b/hw/kvm/clock.c index 446bd62..824b978 100644 --- a/hw/kvm/clock.c +++ b/hw/kvm/clock.c @@ -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; + } + } } }