From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754257AbcA2WVj (ORCPT ); Fri, 29 Jan 2016 17:21:39 -0500 Received: from mx2.parallels.com ([199.115.105.18]:33388 "EHLO mx2.parallels.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753506AbcA2WVh (ORCPT ); Fri, 29 Jan 2016 17:21:37 -0500 Date: Fri, 29 Jan 2016 14:21:30 -0800 From: Andrew Vagin To: Andrey Wagin CC: Paolo Bonzini , , Oleg Nesterov , LKML , "criu@openvz.org" , Cyrill Gorcunov Subject: Re: [CRIU] x86: Hardware breakpoints are not always triggered Message-ID: <20160129222130.GC10798@odin.com> References: <56AA8928.50507@redhat.com> <20160128224224.GA10028@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Disposition: inline In-Reply-To: <20160128224224.GA10028@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-ClientProxiedBy: US-EXCH2.sw.swsoft.com (10.255.249.46) To US-EXCH.sw.swsoft.com (10.255.249.47) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 28, 2016 at 02:42:25PM -0800, Andrey Wagin wrote: > On Thu, Jan 28, 2016 at 10:33:28PM +0100, Paolo Bonzini wrote: > > > > > > On 28/01/2016 09:31, Andrey Wagin wrote: > > > I tried to print drX registers after a break-point. Looks like they > > > are set correctly. > > > > Can you try this KVM patch? > > Looks like it fixes a case when reproducers are running only in VM. Actually Oleg's reproducer detects the bug with this patch when they are rinning only in VM. > > If I execute the reproducer a few times on the host and then execute it > in VM, it exits very fast. > > Thanks, > Andrew > > > > > diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c > > index c13a64b7d789..32bae1c70a50 100644 > > --- a/arch/x86/kvm/svm.c > > +++ b/arch/x86/kvm/svm.c > > @@ -1612,6 +1612,7 @@ static void svm_sync_dirty_debug_regs(struct kvm_vcpu *vcpu) > > vcpu->arch.dr7 = svm->vmcb->save.dr7; > > > > vcpu->arch.switch_db_regs &= ~KVM_DEBUGREG_WONT_EXIT; > > + vcpu->arch.switch_db_regs |= KVM_DEBUGREG_RELOAD; > > set_dr_intercepts(svm); > > } > > > > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > > index e2951b6edbbc..505a4663b9f4 100644 > > --- a/arch/x86/kvm/vmx.c > > +++ b/arch/x86/kvm/vmx.c > > @@ -5659,6 +5659,7 @@ static void vmx_sync_dirty_debug_regs(struct kvm_vcpu *vcpu) > > vcpu->arch.dr7 = vmcs_readl(GUEST_DR7); > > > > vcpu->arch.switch_db_regs &= ~KVM_DEBUGREG_WONT_EXIT; > > + vcpu->arch.switch_db_regs |= KVM_DEBUGREG_RELOAD; > > > > cpu_based_vm_exec_control = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL); > > cpu_based_vm_exec_control |= CPU_BASED_MOV_DR_EXITING; > > > > Paolo > _______________________________________________ > CRIU mailing list > CRIU@openvz.org > https://lists.openvz.org/mailman/listinfo/criu