From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752816AbcBZLkl (ORCPT ); Fri, 26 Feb 2016 06:40:41 -0500 Received: from mail-wm0-f50.google.com ([74.125.82.50]:36431 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752198AbcBZLki (ORCPT ); Fri, 26 Feb 2016 06:40:38 -0500 Subject: Re: [PATCH] KVM: x86: fix missed hardware breakpoints To: Xiao Guangrong , linux-kernel@vger.kernel.org, kvm@vger.kernel.org References: <1455879402-23009-1-git-send-email-pbonzini@redhat.com> <56D02C01.2040400@linux.intel.com> Cc: oleg@redhat.com, namit@cs.technion.ac.il, avagin@gmail.com, stable@vger.kernel.org From: Paolo Bonzini Message-ID: <56D039B1.2030309@redhat.com> Date: Fri, 26 Feb 2016 12:40:33 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <56D02C01.2040400@linux.intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 26/02/2016 11:42, Xiao Guangrong wrote: >> >> + 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? > > Another impact of this fix is when vcpu is rescheduled we need to always > reload debug registers even if guest does not enable it, it is really needed? Hi, I have looked further at the bug and the issue is that the lazy debug register optimization doesn't call kvm_update_dr7 and thus does not set KVM_DEBUGREG_BP_ENABLED. I will post a better patch shortly. However, I still think this one is simpler to have in stable kernel releases, because it doesn't have any dependencies. Paolo