From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH v3 12/21] kvm: x86: Drop MCE MSRs write back restrictions Date: Wed, 05 Jan 2011 10:06:22 +0100 Message-ID: <4D24348E.8050109@web.de> References: <2c5efab40d7088353c5147c41fb13b44a944679c.1294129949.git.jan.kiszka@web.de> <1294209751.22308.337.camel@yhuang-dev> <4D2426C8.6080402@web.de> <1294216431.22308.372.camel@yhuang-dev> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigE3C849DDEA9F3526FF31C321" Cc: Avi Kivity , Marcelo Tosatti , "kvm@vger.kernel.org" , "qemu-devel@nongnu.org" To: Huang Ying Return-path: Received: from fmmailgate01.web.de ([217.72.192.221]:47894 "EHLO fmmailgate01.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751170Ab1AEJGZ (ORCPT ); Wed, 5 Jan 2011 04:06:25 -0500 In-Reply-To: <1294216431.22308.372.camel@yhuang-dev> Sender: kvm-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigE3C849DDEA9F3526FF31C321 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 registe= rs >>> 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 tho= se >> fields touched incorrectly between get and put msrs so that we cannot >> write them back? >=20 > 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 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(); } and corresponding (sigh...) qemu-kvm patch. Will post them. Jan --------------enigE3C849DDEA9F3526FF31C321 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.15 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/ iEYEARECAAYFAk0kNI4ACgkQitSsb3rl5xR8AQCeKktPPfiAGjREK8qDcURONx7w 7yQAn2fGhCwjCtFyXWtWqX/yjqFSA1+K =pAXh -----END PGP SIGNATURE----- --------------enigE3C849DDEA9F3526FF31C321--