From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH] KVM: x86: fix missed hardware breakpoints Date: Fri, 26 Feb 2016 12:53:24 +0100 Message-ID: <56D03CB4.3030100@redhat.com> References: <1455879402-23009-1-git-send-email-pbonzini@redhat.com> <56D02C01.2040400@linux.intel.com> <6DD9380A-1EF7-4226-9405-017D17859472@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: Linux Kernel Mailing List , kvm , oleg@redhat.com, Nadav Amit , avagin@gmail.com, stable@vger.kernel.org To: Nadav Amit , Xiao Guangrong Return-path: In-Reply-To: <6DD9380A-1EF7-4226-9405-017D17859472@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 26/02/2016 12:28, Nadav Amit wrote: > Xiao Guangrong wrote: > >> On 02/19/2016 06:56 PM, Paolo Bonzini wrote: >>> Sometimes when setting a breakpoint a process doesn't stop on it. >>> This is because the debug registers are not loaded correctly on >>> VCPU load. >>> >>> >>> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c >>> index 4244c2baf57d..f4891f2ece23 100644 >>> --- a/arch/x86/kvm/x86.c >>> +++ b/arch/x86/kvm/x86.c >>> @@ -2752,6 +2752,7 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) >>> } >>> >>> kvm_make_request(KVM_REQ_STEAL_UPDATE, vcpu); >>> + vcpu->arch.switch_db_regs |= KVM_DEBUGREG_RELOAD; >> >> Er, i do not understand how it works. The BP is enabled in this test case so >> the debug registers are always reloaded before entering guest as >> KVM_DEBUGREG_BP_ENABLED bit is always set on switch_db_regs. What did i miss? > > Note that KVM_DEBUGREG_BP_ENABLED does not have to be set, since > kvm_update_dr7() is not called once the guest has KVM_DEBUGREG_WONT_EXIT. Looks like our emails crossed; could you review the patch I have just sent? Paolo