From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH] release kvmclock page on reset Date: Sat, 29 Jan 2011 09:56:56 +0100 Message-ID: <4D43D658.7080605@web.de> References: <1296244086-15081-1-git-send-email-glommer@redhat.com> <4D433088.10308@web.de> <1296266847.3591.41.camel@mothafucka.localdomain> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigFC56573D8C99F116402EC9FF" Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, aliguori@us.ibm.com To: Glauber Costa Return-path: In-Reply-To: <1296266847.3591.41.camel@mothafucka.localdomain> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigFC56573D8C99F116402EC9FF Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 2011-01-29 03:07, Glauber Costa wrote: > On Fri, 2011-01-28 at 22:09 +0100, Jan Kiszka wrote: >> On 2011-01-28 20:48, Glauber Costa wrote: >>> Up to know, we were relying on guest cooperation to turn off kvmclock= =2E >>> I just realized that even though this is fine and nice, a more robust= >>> method is to (also) turn it off on vcpu_reset on the hypervisor side.= >>> This will protect us against reboots, and we don't expect the guest >>> to reset its cpu during normal operation anyway. >>> >>> Signed-off-by: Glauber Costa >>> --- >>> arch/x86/kvm/x86.c | 5 +++++ >>> 1 files changed, 5 insertions(+), 0 deletions(-) >>> >>> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c >>> index bcc0efc..38b55b3 100644 >>> --- a/arch/x86/kvm/x86.c >>> +++ b/arch/x86/kvm/x86.c >>> @@ -5878,6 +5878,11 @@ int kvm_arch_vcpu_reset(struct kvm_vcpu *vcpu)= >>> kvm_make_request(KVM_REQ_EVENT, vcpu); >>> vcpu->arch.apf.msr_val =3D 0; >>> =20 >>> + if (vcpu->arch.time_page) { >>> + kvm_release_page_dirty(vcpu->arch.time_page); >>> + vcpu->arch.time_page =3D NULL; >>> + } >>> + >> >> kvm_arch_vcpu_reset is only called on vcpu setup and when it receives = a >> sipi (provided in-kernel irqchip is in use). If you want this page to = be >> consistently reset on guest reboot, you have to trigger this from user= >> space. But I thought we are doing this already in qemu, don't we? >=20 > Humm, you might as well be right regarding reboots. > But in the end, it doesn't affect correctness here. If we're resetting > the vcpu, we should not let that kind of data live. >=20 Right, just checked that we reset other states like nmi_pending or async_pf here as well. So doing the same for the time_page looks appropriate. But I think you should encapsulate the pattern above in a function and substitute other occurrences at this chance. Also, the changelog should clarify in which cases the code matters. Jan --------------enigFC56573D8C99F116402EC9FF 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/ iEYEARECAAYFAk1D1lwACgkQitSsb3rl5xS2oQCfaU7MAY6IUOPR7XLa6qyiw0lI /hEAoL099J7L0FJQeUwmydxTXGCY+sOL =YWMh -----END PGP SIGNATURE----- --------------enigFC56573D8C99F116402EC9FF--