Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Linux: Kernel

[PATCH 4/4] hw-breakpoints: Wrap in the KVM breakpoint active state check

 

 

Linux kernel RSS feed   Index | Next | Previous | View Threaded


fweisbec at gmail

Nov 10, 2009, 2:26 AM

Post #1 of 1 (31 views)
Permalink
[PATCH 4/4] hw-breakpoints: Wrap in the KVM breakpoint active state check

Wrap in the cpu dr7 check that tells if we have active
breakpoints that need to be restored in the cpu.

This wrapper makes the check more self-explainable and also
reusable for any further other uses.

Reported-by: Jan Kiszka <jan.kiszka [at] web>
Signed-off-by: Frederic Weisbecker <fweisbec [at] gmail>
Cc: Avi Kivity <avi [at] redhat>
Cc: "K. Prasad" <prasad [at] linux>
---
arch/x86/include/asm/debugreg.h | 5 +++++
arch/x86/kvm/x86.c | 2 +-
2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/arch/x86/include/asm/debugreg.h b/arch/x86/include/asm/debugreg.h
index f1b673f..0f6e92a 100644
--- a/arch/x86/include/asm/debugreg.h
+++ b/arch/x86/include/asm/debugreg.h
@@ -89,6 +89,11 @@ static inline void hw_breakpoint_disable(void)
set_debugreg(0UL, 3);
}

+static inline int hw_breakpoint_active(void)
+{
+ return __get_cpu_var(dr7) & DR_GLOBAL_ENABLE_MASK;
+}
+
extern void aout_dump_debugregs(struct user *dump);

#ifdef CONFIG_KVM
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 22dee7a..3817220 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -3651,7 +3651,7 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
* care about the messed up debug address registers. But if
* we have some of them active, restore the old state.
*/
- if (__get_cpu_var(dr7) & DR_GLOBAL_ENABLE_MASK)
+ if (hw_breakpoint_active())
hw_breakpoint_restore();

set_bit(KVM_REQ_KICK, &vcpu->requests);
--
1.6.2.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Linux kernel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.