From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933543AbcBCXcy (ORCPT ); Wed, 3 Feb 2016 18:32:54 -0500 Received: from mail-pf0-f169.google.com ([209.85.192.169]:34662 "EHLO mail-pf0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932671AbcBCXct convert rfc822-to-8bit (ORCPT ); Wed, 3 Feb 2016 18:32:49 -0500 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.2 \(3112\)) Subject: Re: [CRIU] x86: Hardware breakpoints are not always triggered From: Nadav Amit In-Reply-To: Date: Wed, 3 Feb 2016 15:32:46 -0800 Cc: Andrew Vagin , Andrey Wagin , kvm@vger.kernel.org, Oleg Nesterov , LKML , "criu@openvz.org" , Cyrill Gorcunov Content-Transfer-Encoding: 8BIT Message-Id: References: <56AA8928.50507@redhat.com> <20160128224224.GA10028@gmail.com> <20160129222130.GC10798@odin.com> <56ADE9A1.4080309@redhat.com> To: Paolo Bonzini X-Mailer: Apple Mail (2.3112) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Sorry for spamming. The correct fix appears to reload the DRs (set KVM_DEBUGREG_RELOAD) in kvm_arch_vcpu_load . (for me it works) Regards, Nadav Nadav Amit wrote: > I think the problem lies here: > > /* > * If the guest has used debug registers, at least dr7 > * will be disabled while returning to the host. > * If we don't have active breakpoints in the host, we don't > * care about the messed up debug address registers. But if > * we have some of them active, restore the old state. > */ > if (hw_breakpoint_active()) { > hw_breakpoint_restore(); > } > > First we need to reload the DRs after we do hw_breakpoint_restore(), no? > vcpu->arch.switch_db_regs |= KVM_DEBUGREG_RELOAD; > > Second, I am unsure whether hw_breakpoint_active() is the correct condition. > > In my defense note that my tests did not his this case since I set affinity > of the VCPUs to physical cores, and prevented other processes from running. > > Regards, > Nadav > > Paolo Bonzini wrote: > >> On 29/01/2016 23:21, Andrew Vagin wrote: >>> 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. >> >> That's actually a good thing, because the patch was a long shot and I >> had no clue _why_ it would have fixed the bug. Oleg's reproducer >> spanning host and a VM actually gives me an idea of what is going on, >> I'll try to reproduce this week. >> >> Paolo >> -- >> To unsubscribe from this list: send the line "unsubscribe kvm" in >> the body of a message to majordomo@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html