mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-14 04:41:26 +00:00
x86/hw-breakpoints: Don't lose GE flag while disabling a breakpoint
When we schedule out a breakpoint from the cpu, we also incidentally remove the "Global exact breakpoint" flag from the breakpoint control register. It makes us losing the fine grained precision about the origin of the instructions that may trigger breakpoint exceptions for the other breakpoints running in this cpu. Reported-by: Prasad <prasad@linux.vnet.ibm.com> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> LKML-Reference: <1259211878-6013-1-git-send-regression-fweisbec@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
605bfaee90
commit
2c31b7958f
@ -59,19 +59,25 @@ static DEFINE_PER_CPU(unsigned long, cpu_debugreg[HBP_NUM]);
|
||||
static DEFINE_PER_CPU(struct perf_event *, bp_per_reg[HBP_NUM]);
|
||||
|
||||
|
||||
static inline unsigned long
|
||||
__encode_dr7(int drnum, unsigned int len, unsigned int type)
|
||||
{
|
||||
unsigned long bp_info;
|
||||
|
||||
bp_info = (len | type) & 0xf;
|
||||
bp_info <<= (DR_CONTROL_SHIFT + drnum * DR_CONTROL_SIZE);
|
||||
bp_info |= (DR_GLOBAL_ENABLE << (drnum * DR_ENABLE_SIZE));
|
||||
|
||||
return bp_info;
|
||||
}
|
||||
|
||||
/*
|
||||
* Encode the length, type, Exact, and Enable bits for a particular breakpoint
|
||||
* as stored in debug register 7.
|
||||
*/
|
||||
unsigned long encode_dr7(int drnum, unsigned int len, unsigned int type)
|
||||
{
|
||||
unsigned long bp_info;
|
||||
|
||||
bp_info = (len | type) & 0xf;
|
||||
bp_info <<= (DR_CONTROL_SHIFT + drnum * DR_CONTROL_SIZE);
|
||||
bp_info |= (DR_GLOBAL_ENABLE << (drnum * DR_ENABLE_SIZE)) |
|
||||
DR_GLOBAL_SLOWDOWN;
|
||||
return bp_info;
|
||||
return __encode_dr7(drnum, len, type) | DR_GLOBAL_SLOWDOWN;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -154,7 +160,7 @@ void arch_uninstall_hw_breakpoint(struct perf_event *bp)
|
||||
return;
|
||||
|
||||
dr7 = &__get_cpu_var(cpu_dr7);
|
||||
*dr7 &= ~encode_dr7(i, info->len, info->type);
|
||||
*dr7 &= ~__encode_dr7(i, info->len, info->type);
|
||||
|
||||
set_debugreg(*dr7, 7);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user