Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1344188
| Path | csiph.com!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Paolo Bonzini <pbonzini@redhat.com> |
| Newsgroups | linux.kernel |
| Subject | [PATCH] KVM: x86: fix root cause for missed hardware breakpoints |
| Date | Fri, 26 Feb 2016 12:50:02 +0100 |
| Message-ID | <r6p4e-2AD-1@gated-at.bofh.it> (permalink) |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=t3sf5dv/KWn6SCPZHIj9vn2TuDsCwUfEfP10roOtYDw=; b=dFoSmLUPCXyCV0siwa0i+Cfz0wEBHf87hyVXJMUc2t/qu/MjAiXTnmhTfyL5dEjye2 2sfrGZ4uQVT8JCqZf8xpPvtjng29sP1tqWshiShLLEHPZMW8dWV/GVO2Jw25MsRhGnUh msSZ9GPsnWLH7gsqbth2CXAOYozwvKH/MwpVQ7k2ib4lrZrp9rGWOAVgT6ueXo2wlK9V J8CnUeIRhhdjdbLxjRefTBZtJbsB/ZXsY9lj80XZLiFM1+0zh8QqeYJXBI+U7dXjdyv2 hcThf+oJ0rXyGb8zHHEczVhf9Nx4l6qcyzGO8UehGIUAtpXVJaqirWMYRYH1boATkTl0 q1nA== |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=t3sf5dv/KWn6SCPZHIj9vn2TuDsCwUfEfP10roOtYDw=; b=GKaJ3tynlwLe/MuvU223+GAOMaujy7fbmJ5e8tWs/DkS5uQ5v/EwIdIif0sQKhI02z yYpYrp4/SsVxdtZDtEgG4UOFPANvKAZ3lvfo7GfRUWR9OWmcEfH/O7iSn5VYInzp5yrI Rv+1/U4Jr0/b6uNAFuDM8FkSHExuPfly8l8wlKPBXSKCddOgHo2DdxjLs/D9Rtfh9aOP aO21HRF/8d1GnEUY0RNKYyuJGGF7tpNG5YzkkjZ6krdhEhA/URf5WR8ULfhTi7I76s46 mV1Tw7DAIC1pAcAR0rKWJV6fYOAXdUncDcG/8aMpXtgz0w4rFHCLnSIYMS4Ru067eIaH fzPA== |
| X-Gm-Message-State | AD7BkJLbsWdaj6ckBkwShFZdZDzJjQcx0R1aSQoGIjAGFgCcmV/Klt/hmxq4VxTNT+Eg2Q== |
| X-Received | by 10.28.141.141 with SMTP id p135mr2752381wmd.30.1456487178326; Fri, 26 Feb 2016 03:46:18 -0800 (PST) |
| X-Mailer | git-send-email 1.8.3.1 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 53 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | stable@vger.kernel.org, Nadav Amit <namit@cs.technion.ac.il>, Andrey Wagin <avagin@gmail.com>, Xiao Guangrong <guangrong.xiao@linux.intel.com> |
| X-Original-Date | Fri, 26 Feb 2016 12:46:15 +0100 |
| X-Original-Message-ID | <1456487175-8648-1-git-send-email-pbonzini@redhat.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1344188 |
Show key headers only | View raw
Commit 172b2386ed16 ("KVM: x86: fix missed hardware breakpoints",
2016-02-10) worked around a case where the debug registers are not loaded
correctly on preemption and on the first entry to KVM_RUN.
However, Xiao Guangrong pointed out that the root cause must be that
KVM_DEBUGREG_BP_ENABLED is not being set correctly. This can indeed
happen due to the lazy debug exit mechanism, which does not call
kvm_update_dr7. Fix it by replacing the existing loop (more or less
equivalent to kvm_update_dr0123) with calls to all the kvm_update_dr*
functions.
The original patch is good enough for stable releases before 4.1, since
it does not have any dependencies such as commit ae561edeb421 ("KVM:
x86: DR0-DR3 are not clear on reset", 2015-04-02).
Cc: stable@vger.kernel.org # 4.1+
Fixes: 172b2386ed16a9143d9a456aae5ec87275c61489
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
arch/x86/kvm/x86.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index f4891f2ece23..eaf6ee8c28b8 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2752,7 +2752,6 @@ 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;
}
void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
@@ -6619,12 +6618,12 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
* KVM_DEBUGREG_WONT_EXIT again.
*/
if (unlikely(vcpu->arch.switch_db_regs & KVM_DEBUGREG_WONT_EXIT)) {
- int i;
-
WARN_ON(vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP);
kvm_x86_ops->sync_dirty_debug_regs(vcpu);
- for (i = 0; i < KVM_NR_DB_REGS; i++)
- vcpu->arch.eff_db[i] = vcpu->arch.db[i];
+ kvm_update_dr0123(vcpu);
+ kvm_update_dr6(vcpu);
+ kvm_update_dr7(vcpu);
+ vcpu->arch.switch_db_regs &= ~KVM_DEBUGREG_RELOAD;
}
/*
--
1.8.3.1
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] KVM: x86: fix root cause for missed hardware breakpoints Paolo Bonzini <pbonzini@redhat.com> - 2016-02-26 12:50 +0100
Re: [PATCH] KVM: x86: fix root cause for missed hardware breakpoints Xiao Guangrong <guangrong.xiao@linux.intel.com> - 2016-02-26 13:10 +0100
Re: [PATCH] KVM: x86: fix root cause for missed hardware breakpoints Nadav Amit <nadav.amit@gmail.com> - 2016-02-26 13:20 +0100
Re: [PATCH] KVM: x86: fix root cause for missed hardware breakpoints Paolo Bonzini <pbonzini@redhat.com> - 2016-02-26 13:50 +0100
csiph-web