From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH v2] KVM: SVM: Fix reading of DR6 Date: Thu, 02 Jan 2014 09:24:21 +0100 Message-ID: <52C52235.1040002@redhat.com> References: <52B2F3AB.9050101@siemens.com> <20131227172109.GA12552@amt.cnet> <52BDC423.4060404@web.de> <52C2E287.2050400@redhat.com> <52C2FEE8.1060001@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , Gleb Natapov , kvm To: Jan Kiszka Return-path: Received: from mail-ee0-f48.google.com ([74.125.83.48]:44936 "EHLO mail-ee0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750711AbaABIYW (ORCPT ); Thu, 2 Jan 2014 03:24:22 -0500 Received: by mail-ee0-f48.google.com with SMTP id e49so6057664eek.35 for ; Thu, 02 Jan 2014 00:24:21 -0800 (PST) In-Reply-To: <52C2FEE8.1060001@web.de> Sender: kvm-owner@vger.kernel.org List-ID: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Il 31/12/2013 18:29, Jan Kiszka ha scritto: >> Also, set_dr7 is only called when !(vcpu->guest_debug & >> KVM_GUESTDBG_USE_HW_BP). I think it makes sense to do the same >> for all the new hooks you need to introduce (get_dr6, set_dr6 and >> possibly get_dr7). > > We could make set_dr6 conditional, but it doesn't make a difference > in practice. No, it doesn't indeed. It's just a matter of consistency. > If guest debugging is enabled, we effectively only use DR6 when > leaving the guest, i.e. when the hardware defined DR6. > > Hmm, SVM is not updating kvm_run::debug.arch.dr6/7... There might > be more broken, need to check. But that would not be guest visible > then. > >> >> And finally, is it necessary to write to both vcpu->arch.dr6/7 >> and svm->vmcb->save.dr6/7, or is it simply okay to do that? > > arch.dr6/7 holds the guest visible state, save.dr6/7 the effective > one. > > Jan > > PS: I'll look into a kvm unit test for hardware debugging features > these days. Guest-side at least, no idea yet how to implement > host-side debugging with unit tests. It would be possible to do it with infrastructure like qtest or autotest. You could speak the gdbserver protocol yourself, or open a pty to gdb. But guest-side is already an improvement over nothing! Paolo -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBAgAGBQJSxSI0AAoJEBvWZb6bTYbyoiYP/REKgPL/dUwJoSA8AEm7h6Ip wkXlaxBcyBiKlIzfiN3abBXBOZvDy7dSzNfXUZ4bY6DitQIJZYSVc93XfvWYRToY ORC6qZej+P/bD/rNwATpvVhGG6RbRpmihmVgkoX5w5J3GWZ52QREcyoW7mZEhIoR fCMJmNCq2l9vxa5hhXLAuiLYtq7mto6hQpFE8TXG81PyzE+c3WWK1D5vy/2cpv48 qabaVsJs7aj0KV2rVDvyQkO+GSdm+8SDpf4GyJcLo1Y1yYjPW97xC0Ey4ZyEXXWf 37zb3oOoH9NPPXtt1oJhUFCFZ34v1MxW2j0IIGvtUfRPSjphW+T/nQ5y17GG+efQ TbKnSlibNP0L7fX/xa/sytaYcslIJVIKvvq0Wz9a3Ka1OHNufgtBIreUjtAPvSmy TLxTm2w2s0S/mD3yMDK62uAtQMV/FW7qV6WHTHHZzj8VJpgfAAO0j4gkN0PlLB91 XfuR8ANmYoAKm9yafOSlr6Xw4uzHh41ZODMIY9w/pwB6nGB8SMRVBUWAILkyiyoN btJdVCFdmxTlUmszAeHGTkd4VMtOMqva8MmgnV5isVEUy5A6gJZwNSZ8KJCdny+J N+jRLj/j3SUlxGFnsK4FPBlMQzK1DDYS3C2QKd+Z5No42kZg4w2g4n0zQamDi2XR 2lcuexvRePHTZglNkP82 =dDQc -----END PGP SIGNATURE-----