From: Frederic Weisbecker <fweisbec@gmail.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: LKML <linux-kernel@vger.kernel.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Prasad <prasad@linux.vnet.ibm.com>
Subject: [PATCH 4/3] x86/hw-breakpoints: Don't lose GE flag while disabling a breakpoint
Date: Thu, 26 Nov 2009 06:04:38 +0100 [thread overview]
Message-ID: <1259211878-6013-1-git-send-regression-fweisbec@gmail.com> (raw)
In-Reply-To: <1259210142-5714-1-git-send-regression-fweisbec@gmail.com>
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>
---
arch/x86/kernel/hw_breakpoint.c | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/arch/x86/kernel/hw_breakpoint.c b/arch/x86/kernel/hw_breakpoint.c
index 92ea5aa..d42f65a 100644
--- a/arch/x86/kernel/hw_breakpoint.c
+++ b/arch/x86/kernel/hw_breakpoint.c
@@ -59,22 +59,28 @@ static DEFINE_PER_CPU(unsigned long, cpu_debugreg[HBP_NUM]);
static DEFINE_PER_CPU(struct perf_event *, bp_per_reg[HBP_NUM]);
-/*
- * 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)
+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)) |
- DR_GLOBAL_SLOWDOWN;
+ 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)
+{
+ return __encode_dr7(drnum, len, type) | DR_GLOBAL_SLOWDOWN;
+}
+
+/*
* Decode the length and type bits for a particular breakpoint as
* stored in debug register 7. Return the "enabled" status.
*/
@@ -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);
}
--
1.6.2.3
next prev parent reply other threads:[~2009-11-26 5:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-26 4:35 [PATCH 1/3] ksym_tracer: Fix breakpoint removal after modification Frederic Weisbecker
2009-11-26 4:35 ` [PATCH 2/3] hw-breakpoints: Improve in-kernel event creation error granularity Frederic Weisbecker
2009-11-26 8:44 ` [tip:perf/core] " tip-bot for Frederic Weisbecker
2009-11-26 4:35 ` [PATCH 3/3] hw-breakpoints: Simplify error handling in breakpoint creation requests Frederic Weisbecker
2009-11-26 8:45 ` [tip:perf/core] " tip-bot for Frederic Weisbecker
2009-11-26 5:04 ` Frederic Weisbecker [this message]
2009-11-26 8:45 ` [tip:perf/core] x86/hw-breakpoints: Don't lose GE flag while disabling a breakpoint tip-bot for Frederic Weisbecker
2009-11-26 8:44 ` [tip:perf/core] ksym_tracer: Fix breakpoint removal after modification tip-bot for Frederic Weisbecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1259211878-6013-1-git-send-regression-fweisbec@gmail.com \
--to=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=prasad@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome