From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:58029) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SB4EU-0007kv-P6 for qemu-devel@nongnu.org; Fri, 23 Mar 2012 09:08:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SB4EM-0008HM-9S for qemu-devel@nongnu.org; Fri, 23 Mar 2012 09:08:42 -0400 Received: from e23smtp01.au.ibm.com ([202.81.31.143]:48360) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SB4EL-0008Gc-Nk for qemu-devel@nongnu.org; Fri, 23 Mar 2012 09:08:34 -0400 Received: from /spool/local by e23smtp01.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 23 Mar 2012 13:01:09 +1000 Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q2ND26jm3358824 for ; Sat, 24 Mar 2012 00:02:08 +1100 Received: from d23av04.au.ibm.com (loopback [127.0.0.1]) by d23av04.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q2ND85Ow019890 for ; Sat, 24 Mar 2012 00:08:06 +1100 Message-ID: <4F6C759E.8050004@linux.vnet.ibm.com> Date: Fri, 23 Mar 2012 18:37:42 +0530 From: Raghavendra K T MIME-Version: 1.0 References: <20120323082242.17193.16289.sendpatchset@codeblue> <20120323082353.17193.46145.sendpatchset@codeblue> <4F6C3AF8.5050802@siemens.com> In-Reply-To: <4F6C3AF8.5050802@siemens.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/2] QEMU kvm: Add support to get/set vcpu unhalt msr to aid migration List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: Anthony Liguori , KVM , Marcelo Tosatti , Qemu-devel , Alexander Graf , Avi Kivity , Srivatsa Vaddagiri On 03/23/2012 02:27 PM, Jan Kiszka wrote: > On 2012-03-23 09:23, Raghavendra K T wrote: >> From: Raghavendra K T >> >> MSR_KVM_PV_UNHALT tells whether vcpu is unhalted, which needs to be >> used during migration. > > Err, and where is it actually saved to/restored from the vmstate? You > are lacking an extension of the CPU vmstate, preferably via a substate. > See e.g. cpu/async_pf_msr. > Please let me know whether adding below patch make it complete. Or did I miss something else ? --- diff --git a/target-i386/machine.c b/target-i386/machine.c index a8be058..c51d8d1 100644 --- a/target-i386/machine.c +++ b/target-i386/machine.c @@ -279,6 +279,13 @@ static bool async_pf_msr_needed(void *opaque) return cpu->async_pf_en_msr != 0; } +static bool pv_unhalt_msr_needed(void *opaque) +{ + CPUX86State *cpu = opaque; + + return cpu->pv_unhalt_msr != 0; +} + static const VMStateDescription vmstate_async_pf_msr = { .name = "cpu/async_pf_msr", .version_id = 1, @@ -290,6 +297,17 @@ static const VMStateDescription vmstate_async_pf_msr = { } }; +static const VMStateDescription vmstate_pv_unhalt_msr = { + .name = "cpu/pv_unhalt_msr", + .version_id = 1, + .minimum_version_id = 1, + .minimum_version_id_old = 1, + .fields = (VMStateField []) { + VMSTATE_UINT64(pv_unhalt_msr, CPUX86State), + VMSTATE_END_OF_LIST() + } +}; + static bool fpop_ip_dp_needed(void *opaque) { CPUX86State *env = opaque; @@ -462,6 +480,9 @@ static const VMStateDescription vmstate_cpu = { }, { .vmsd = &vmstate_msr_ia32_misc_enable, .needed = misc_enable_needed, + }, { + .vmsd = &vmstate_pv_unhalt_msr, + .needed = pv_unhalt_msr_needed, } , { /* empty */ }