HW-BKPT: Allow per-cpu kernel-space Hardware Breakpoint requests
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 HW-BKPT: Allow per-cpu kernel-space Hardware Breakpoint requests
Allow kernel-space hw-breakpoints to be restricted only for a subset of CPUs using a cpumask field in 'struct hw_breakpoint'.
Signed-off-by K.Prasad <[email protected]>
--- arch/x86/include/asm/hw_breakpoint.h | 2 arch/x86/kernel/hw_breakpoint.c | 8 +- include/asm-generic/hw_breakpoint.h | 2 kernel/hw_breakpoint.c | 121 ++++++++++++++++++++++++----------- 4 files changed, 95 insertions(+), 38 deletions(-)
arch/x86/kernel/hw_breakpoint.c +6 -2
@@ -68,7 +68,7 @@ static unsigned long encode_dr7(int drnureturn bp_info; } -void arch_update_kernel_hw_breakpoint (void *unused) +void arch_update_kernel_hw_breakpoint (void ) {struct hw_breakpoint *bp;int i, cpu =get_cpu ();
@@ -78,7 +78,7 @@ void arch_update_kernel_hw_breakpoint(voset_debugreg (0UL ,7 );for (i = hbp_kernel_pos; i <HBP_NUM ; i++) { -per_cpu (this_hbp_kernel[i], cpu) = bp = hbp_kernel[i]; + bp =per_cpu (this_hbp_kernel[i], cpu);if (bp) { temp_kdr7 |=encode_dr7 (i, bp->info.len, bp->info.type);set_debugreg (bp->info.address, i);
@@ -207,6 +207,10 @@ int arch_validate_hwbkpt_settings(structunsigned int align;int ret = -EINVAL ; +/* User-space breakpoints cannot be restricted to a subset of CPUs */ +if (tsk && bp->cpumask) +return ret; +switch (bp->info.type) {/* * Ptrace-refactoring code
include/asm-generic/hw_breakpoint.h +2 -0
@@ -8,6 +8,7 @@#ifdef __KERNEL__#include <linux/list.h> #include <linux/types.h> +#include <linux/cpumask.h> #include <linux/kallsyms.h> /**
@@ -102,6 +103,7 @@*/ struct hw_breakpoint {void (*triggered)(struct hw_breakpoint *,struct pt_regs *); +const cpumask_t *cpumask;struct arch_hw_breakpoint info; };
kernel/hw_breakpoint.c +86 -35
178 lines not on this page · raw message
arch/x86/include/asm/hw_breakpoint.h +1 -1
@@ -47,7 +47,7 @@ extern int arch_validate_hwbkpt_settings struct task_struct *tsk);extern void arch_update_user_hw_breakpoint (int pos,struct task_struct *tsk);extern void arch_flush_thread_hw_breakpoint (struct task_struct *tsk); -extern void arch_update_kernel_hw_breakpoint (void *); +extern void arch_update_kernel_hw_breakpoint (void );extern int hw_breakpoint_exceptions_notify (struct notifier_block *unused,unsigned long val,void *data);#endif /* __KERNEL__ */