From patchwork Wed Jan 5 09:06:22 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 77579 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A84BDB7111 for ; Wed, 5 Jan 2011 20:07:56 +1100 (EST) Received: from localhost ([127.0.0.1]:47834 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PaPLR-0003Wt-6Z for incoming@patchwork.ozlabs.org; Wed, 05 Jan 2011 04:07:49 -0500 Received: from [140.186.70.92] (port=40892 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PaPK8-0003N3-35 for qemu-devel@nongnu.org; Wed, 05 Jan 2011 04:06:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PaPK6-0008DB-VZ for qemu-devel@nongnu.org; Wed, 05 Jan 2011 04:06:28 -0500 Received: from fmmailgate01.web.de ([217.72.192.221]:47899) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PaPK6-0008Cm-JM for qemu-devel@nongnu.org; Wed, 05 Jan 2011 04:06:26 -0500 Received: from smtp01.web.de ( [172.20.0.243]) by fmmailgate01.web.de (Postfix) with ESMTP id 0F1FE184CBB5D; Wed, 5 Jan 2011 10:06:24 +0100 (CET) Received: from [88.65.255.1] (helo=mchn199C.mchp.siemens.de) by smtp01.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.110 #2) id 1PaPK3-0007bu-00; Wed, 05 Jan 2011 10:06:24 +0100 Message-ID: <4D24348E.8050109@web.de> Date: Wed, 05 Jan 2011 10:06:22 +0100 From: Jan Kiszka User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 To: Huang Ying References: <2c5efab40d7088353c5147c41fb13b44a944679c.1294129949.git.jan.kiszka@web.de> <1294209751.22308.337.camel@yhuang-dev> <4D2426C8.6080402@web.de> <1294216431.22308.372.camel@yhuang-dev> In-Reply-To: <1294216431.22308.372.camel@yhuang-dev> X-Enigmail-Version: 1.1.2 X-Sender: jan.kiszka@web.de X-Provags-ID: V01U2FsdGVkX18YRhwaEUBA642k79zy/7N7OWTI44WwDikDoa// k1JSJAAl4RUj7IFHlR5ahWiJ7m/jt4Tm9NqD7by02ZI73oi9Wt +J+jMwVLM= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 Cc: Marcelo Tosatti , Avi Kivity , "kvm@vger.kernel.org" , "qemu-devel@nongnu.org" Subject: [Qemu-devel] Re: [PATCH v3 12/21] kvm: x86: Drop MCE MSRs write back restrictions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Am 05.01.2011 09:33, Huang Ying wrote: > On Wed, 2011-01-05 at 16:07 +0800, Jan Kiszka wrote: >> Am 05.01.2011 07:42, Huang Ying wrote: >>> On Tue, 2011-01-04 at 16:32 +0800, Jan Kiszka wrote: >>>> From: Jan Kiszka >>>> >>>> There is no need to restrict writing back MCE MSRs to reset or full >>>> state updates as setting their values has no side effects. >>> >>> Sorry for late. >> >> Don't worry. >> >>> >>> The MCE MSRs contents is sticky for warm reset except MCG_STATUS, so >>> their content should be kept. And the following sequence may set >>> uncorrected value in MCE registers. >>> >>> savevm -> loadvm -> (OS clear MCE registers) -> reset -> (MCE registers >>> has new (uncorrected) value) >> >> Sorry, I can't follow. Unless I miss some subtle detail, the question is >> not when we transfer the mcg_* CPUState fields to the kernel, but when >> and how we manipulate them in user space, e.g. on reset. Where are those >> fields touched incorrectly between get and put msrs so that we cannot >> write them back? > > If my understanding is correct, MSRs are not saved to user space > (env->mce_banks) during reset in current code. So if all MCE MSRs are > restored to kernel, their user space contents from previous loadvm may > be put into kernel after reset. Ah, good point! We need and corresponding (sigh...) qemu-kvm patch. Will post them. Jan diff --git a/vl.c b/vl.c index 1958e01..23d4169 100644 --- a/vl.c +++ b/vl.c @@ -1353,6 +1353,7 @@ static void main_loop(void) } if (qemu_reset_requested()) { pause_all_vcpus(); + cpu_synchronize_all_states(); qemu_system_reset(); resume_all_vcpus(); }