From: Anthony Liguori <aliguori@linux.vnet.ibm.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
qemu-devel@nongnu.org, kvm@vger.kernel.org,
Avi Kivity <avi@redhat.com>
Subject: [Qemu-devel] Re: [PATCH 09/10] Add savevm/loadvm support for MCE
Date: Wed, 20 Oct 2010 14:54:28 -0500 [thread overview]
Message-ID: <4CBF48F4.50109@linux.vnet.ibm.com> (raw)
In-Reply-To: <2d7082283bc5cc2ed45e0bef33d66abc3a96c7fd.1287596626.git.mtosatti@redhat.com>
On 10/20/2010 12:43 PM, Marcelo Tosatti wrote:
> Port qemu-kvm's
>
> commit 1bab5d11545d8de5facf46c28630085a2f9651ae
> Author: Huang Ying<ying.huang@intel.com>
> Date: Wed Mar 3 16:52:46 2010 +0800
>
> Add savevm/loadvm support for MCE
>
> MCE registers are saved/load into/from CPUState in
> kvm_arch_save/load_regs. To simulate the MCG_STATUS clearing upon
> reset, MSR_MCG_STATUS is set to 0 for KVM_PUT_RESET_STATE.
>
> Signed-off-by: Marcelo Tosatti<mtosatti@redhat.com>
> Signed-off-by: Avi Kivity<avi@redhat.com>
> ---
> target-i386/kvm.c | 39 ++++++++++++++++++++++++++++++++++++++-
> 1 files changed, 38 insertions(+), 1 deletions(-)
>
> diff --git a/target-i386/kvm.c b/target-i386/kvm.c
> index 8e26bc4..1701cb9 100644
> --- a/target-i386/kvm.c
> +++ b/target-i386/kvm.c
> @@ -777,7 +777,7 @@ static int kvm_put_msrs(CPUState *env, int level)
> struct kvm_msr_entry entries[100];
> } msr_data;
> struct kvm_msr_entry *msrs = msr_data.entries;
> - int n = 0;
> + int i, n = 0;
>
> kvm_msr_entry_set(&msrs[n++], MSR_IA32_SYSENTER_CS, env->sysenter_cs);
> kvm_msr_entry_set(&msrs[n++], MSR_IA32_SYSENTER_ESP, env->sysenter_esp);
> @@ -797,6 +797,18 @@ static int kvm_put_msrs(CPUState *env, int level)
> env->system_time_msr);
> kvm_msr_entry_set(&msrs[n++], MSR_KVM_WALL_CLOCK, env->wall_clock_msr);
> }
> +#ifdef KVM_CAP_MCE
> + if (env->mcg_cap) {
> + if (level == KVM_PUT_RESET_STATE)
> + kvm_msr_entry_set(&msrs[n++], MSR_MCG_STATUS, env->mcg_status);
> + else if (level == KVM_PUT_FULL_STATE) {
> + kvm_msr_entry_set(&msrs[n++], MSR_MCG_STATUS, env->mcg_status);
> + kvm_msr_entry_set(&msrs[n++], MSR_MCG_CTL, env->mcg_ctl);
> + for (i = 0; i< (env->mcg_cap& 0xff) * 4; i++)
> + kvm_msr_entry_set(&msrs[n++], MSR_MC0_CTL + i, env->mce_banks[i]);
> + }
> + }
> +#endif
>
What happens if we live migration from a kernel with KVM_CAP_MCE to a
kernel without KVM_CAP_MCE. Don't we need to bump a version somewhere?
> msr_data.info.nmsrs = n;
>
> @@ -1004,6 +1016,15 @@ static int kvm_get_msrs(CPUState *env)
> msrs[n++].index = MSR_KVM_SYSTEM_TIME;
> msrs[n++].index = MSR_KVM_WALL_CLOCK;
>
> +#ifdef KVM_CAP_MCE
> + if (env->mcg_cap) {
> + msrs[n++].index = MSR_MCG_STATUS;
> + msrs[n++].index = MSR_MCG_CTL;
> + for (i = 0; i< (env->mcg_cap& 0xff) * 4; i++)
> + msrs[n++].index = MSR_MC0_CTL + i;
> + }
> +#endif
> +
>
This patch does not respect CODING_STYLE with respect to single line ifs
at all.
Regards,
Anthony Liguori
> msr_data.info.nmsrs = n;
> ret = kvm_vcpu_ioctl(env, KVM_GET_MSRS,&msr_data);
> if (ret< 0)
> @@ -1046,6 +1067,22 @@ static int kvm_get_msrs(CPUState *env)
> case MSR_KVM_WALL_CLOCK:
> env->wall_clock_msr = msrs[i].data;
> break;
> +#ifdef KVM_CAP_MCE
> + case MSR_MCG_STATUS:
> + env->mcg_status = msrs[i].data;
> + break;
> + case MSR_MCG_CTL:
> + env->mcg_ctl = msrs[i].data;
> + break;
> +#endif
> + default:
> +#ifdef KVM_CAP_MCE
> + if (msrs[i].index>= MSR_MC0_CTL&&
> + msrs[i].index< MSR_MC0_CTL + (env->mcg_cap& 0xff) * 4) {
> + env->mce_banks[msrs[i].index - MSR_MC0_CTL] = msrs[i].data;
> + break;
> + }
> +#endif
> }
> }
>
>
next prev parent reply other threads:[~2010-10-20 19:54 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-20 17:43 [Qemu-devel] [PATCH 00/10] [PULL] qemu-kvm.git uq/master queue Marcelo Tosatti
2010-10-20 17:43 ` [Qemu-devel] [PATCH 01/10] Set cpuid definition to 0 before initializing it Marcelo Tosatti
2010-10-20 17:43 ` [Qemu-devel] [PATCH 02/10] Add svm cpuid features Marcelo Tosatti
2010-10-20 17:43 ` [Qemu-devel] [PATCH 03/10] signalfd compatibility Marcelo Tosatti
2010-10-20 17:43 ` [Qemu-devel] [PATCH 04/10] iothread: use signalfd Marcelo Tosatti
2010-10-20 17:43 ` [Qemu-devel] [PATCH 05/10] kvm: x86: add mce support Marcelo Tosatti
2010-10-20 19:58 ` [Qemu-devel] " Anthony Liguori
2010-10-20 17:43 ` [Qemu-devel] [PATCH 06/10] Export qemu_ram_addr_from_host Marcelo Tosatti
2010-10-20 17:43 ` [Qemu-devel] [PATCH 07/10] Add RAM -> physical addr mapping in MCE simulation Marcelo Tosatti
2010-10-20 19:56 ` [Qemu-devel] " Anthony Liguori
2010-10-20 17:43 ` [Qemu-devel] [PATCH 08/10] MCE: Relay UCR MCE to guest Marcelo Tosatti
2010-10-20 19:51 ` [Qemu-devel] " Anthony Liguori
2010-10-20 20:59 ` Anthony Liguori
2010-10-20 21:33 ` Marcelo Tosatti
2010-10-20 21:28 ` Marcelo Tosatti
2010-10-20 21:56 ` Paolo Bonzini
2010-10-20 22:03 ` Anthony Liguori
2010-10-21 7:41 ` Paolo Bonzini
2010-10-20 17:43 ` [Qemu-devel] [PATCH 09/10] Add savevm/loadvm support for MCE Marcelo Tosatti
2010-10-20 19:54 ` Anthony Liguori [this message]
2010-10-20 17:43 ` [Qemu-devel] [PATCH 10/10] Fix memory leak in register save load due to xsave support Marcelo Tosatti
2010-10-20 19:01 ` [Qemu-devel] Re: [PATCH 00/10] [PULL] qemu-kvm.git uq/master queue Anthony Liguori
2010-10-20 19:05 ` Marcelo Tosatti
2010-10-20 19:15 ` Anthony Liguori
2010-10-20 19:52 ` Anthony Liguori
2010-10-20 21:59 ` Anthony Liguori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4CBF48F4.50109@linux.vnet.ibm.com \
--to=aliguori@linux.vnet.ibm.com \
--cc=aliguori@us.ibm.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).