From patchwork Fri Apr 6 13:01:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Raghavendra K T X-Patchwork-Id: 151183 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 DE7D5B7035 for ; Fri, 6 Apr 2012 23:03:09 +1000 (EST) Received: from localhost ([::1]:45513 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SG8of-0001JV-LQ for incoming@patchwork.ozlabs.org; Fri, 06 Apr 2012 09:03:01 -0400 Received: from eggs.gnu.org ([208.118.235.92]:34985) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SG8oX-0001Hl-0I for qemu-devel@nongnu.org; Fri, 06 Apr 2012 09:02:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SG8oQ-0001i0-Ev for qemu-devel@nongnu.org; Fri, 06 Apr 2012 09:02:52 -0400 Received: from e28smtp01.in.ibm.com ([122.248.162.1]:46720) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SG8oP-0001gL-Pv for qemu-devel@nongnu.org; Fri, 06 Apr 2012 09:02:46 -0400 Received: from /spool/local by e28smtp01.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 6 Apr 2012 18:32:22 +0530 Received: from d28relay03.in.ibm.com (9.184.220.60) by e28smtp01.in.ibm.com (192.168.1.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 6 Apr 2012 18:32:07 +0530 Received: from d28av04.in.ibm.com (d28av04.in.ibm.com [9.184.220.66]) by d28relay03.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q36D25qW4005938 for ; Fri, 6 Apr 2012 18:32:06 +0530 Received: from d28av04.in.ibm.com (loopback [127.0.0.1]) by d28av04.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q36IVrPF003669 for ; Sat, 7 Apr 2012 04:31:54 +1000 Received: from [9.79.195.200] ([9.79.195.200]) by d28av04.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q36IVmY5003454; Sat, 7 Apr 2012 04:31:49 +1000 Message-ID: <4F7EE91A.9020204@linux.vnet.ibm.com> Date: Fri, 06 Apr 2012 18:31:14 +0530 From: Raghavendra K T Organization: IBM User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120216 Thunderbird/10.0.1 MIME-Version: 1.0 To: =?ISO-8859-15?Q?Andreas_F=E4rber?= References: <20120406072057.28181.31911.sendpatchset@codeblue> <4F7EB056.4080104@suse.de> <4F7EBC1F.5030300@linux.vnet.ibm.com> In-Reply-To: <4F7EBC1F.5030300@linux.vnet.ibm.com> x-cbid: 12040613-4790-0000-0000-00000219D9F3 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 122.248.162.1 Cc: Anthony Liguori , KVM , Jan Kiszka , Marcelo Tosatti , Qemu-devel , Srivatsa Vaddagiri , "Michael J. Wolf" , Avi Kivity , Eric B Munson Subject: Re: [Qemu-devel] [PATCH V8 1/1] Guest stop notificationorry for rduplicate mail 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 On 04/06/2012 03:19 PM, Raghavendra K T wrote: > On 04/06/2012 02:29 PM, Andreas Färber wrote: >> Am 06.04.2012 09:21, schrieb Raghavendra K T: >>> 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 >>> >>> Cc: Eric B Munson >>> Cc: Avi Kivity >>> Cc: Marcelo Tosatti >>> Cc: Anthony Liguori >>> Cc: Jan Kiszka >>> Cc: "Andreas FÀrber" >>> --- >>> Changes from V7: >>> capabilty changed to KVM_CAP_KVMCLOCK_CTRL >>> KVM_GUEST_PAUSED is pervcpu again >>> CPUState renamed to CPUArchState >> >> Thanks, change looks right to me. I think I should have added Acked-by and resent full patch. So here is it. sorry for duplicate mail. Reviewed-by: Andreas Färber --- 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. Acked-by: "Andreas Färber" Signed-off-by: Eric B Munson Signed-off-by: Raghavendra K T Cc: Eric B Munson Cc: Avi Kivity Cc: Marcelo Tosatti Cc: Anthony Liguori Cc: Jan Kiszka Cc: "Andreas Färber" --- 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 incorporated Andrea's comments (__FUNCTION__) etc 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 --- } diff --git a/hw/kvm/clock.c b/hw/kvm/clock.c index 446bd62..a6aa6e4 100644 --- a/hw/kvm/clock.c +++ b/hw/kvm/clock.c @@ -65,9 +65,27 @@ 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", __FUNCTION__, + strerror(-ret)); + } + return; + } + } }