From: Andi Kleen <andi@firstfloor.org>
To: x86@kernel.org
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
Andi Kleen <ak@linux.intel.com>,
jason.wessel@windriver.com
Subject: [PATCH 5/6] x86, kgdb: Support compiling without hardware break points
Date: Fri, 4 Oct 2013 14:39:47 -0700 [thread overview]
Message-ID: <1380922788-23112-6-git-send-email-andi@firstfloor.org> (raw)
In-Reply-To: <1380922788-23112-1-git-send-email-andi@firstfloor.org>
From: Andi Kleen <ak@linux.intel.com>
Add some ifdefs to support compiling without CONFIG_HW_BREAKPOINTS.
HW_BREAKPOINTS pulls in all of perf, and presumably there are
some use cases where people want to debug without perf.
The standard software breakpoints still work of course.
Cc: jason.wessel@windriver.com
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
arch/x86/kernel/cpu/Makefile | 2 +-
arch/x86/kernel/kgdb.c | 12 ++++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile
index a735914..e125307 100644
--- a/arch/x86/kernel/cpu/Makefile
+++ b/arch/x86/kernel/cpu/Makefile
@@ -46,7 +46,7 @@ endif
obj-$(CONFIG_X86_MCE) += mcheck/
obj-$(CONFIG_MTRR) += mtrr/
-obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o
+obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o
obj-$(CONFIG_HYPERVISOR_GUEST) += vmware.o hypervisor.o mshyperv.o
diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c
index 836f832..f3efeb9 100644
--- a/arch/x86/kernel/kgdb.c
+++ b/arch/x86/kernel/kgdb.c
@@ -193,6 +193,8 @@ void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
gdb_regs[GDB_SP] = p->thread.sp;
}
+#ifdef CONFIG_HW_BREAKPOINTS
+
static struct hw_breakpoint {
unsigned enabled;
unsigned long addr;
@@ -419,6 +421,8 @@ static void kgdb_disable_hw_debug(struct pt_regs *regs)
}
}
+#endif
+
#ifdef CONFIG_SMP
/**
* kgdb_roundup_cpus - Get other CPUs into a holding pattern
@@ -639,6 +643,8 @@ out:
return retval;
}
+#ifdef CONFIG_HW_BREAKPOINTS
+
static void kgdb_hw_overflow_handler(struct perf_event *event,
struct perf_sample_data *data, struct pt_regs *regs)
{
@@ -689,6 +695,8 @@ void kgdb_arch_late(void)
}
}
+#endif
+
/**
* kgdb_arch_exit - Perform any architecture specific uninitalization.
*
@@ -697,6 +705,7 @@ void kgdb_arch_late(void)
*/
void kgdb_arch_exit(void)
{
+#ifdef CONFIG_HW_BREAKPOINTS
int i;
for (i = 0; i < 4; i++) {
if (breakinfo[i].pev) {
@@ -704,6 +713,7 @@ void kgdb_arch_exit(void)
breakinfo[i].pev = NULL;
}
}
+#endif
unregister_nmi_handler(NMI_UNKNOWN, "kgdb");
unregister_nmi_handler(NMI_LOCAL, "kgdb");
unregister_die_notifier(&kgdb_notifier);
@@ -807,9 +817,11 @@ struct kgdb_arch arch_kgdb_ops = {
/* Breakpoint instruction: */
.gdb_bpt_instr = { 0xcc },
.flags = KGDB_HW_BREAKPOINT,
+#ifdef CONFIG_HW_BREAKPOINTS
.set_hw_breakpoint = kgdb_set_hw_break,
.remove_hw_breakpoint = kgdb_remove_hw_break,
.disable_hw_break = kgdb_disable_hw_debug,
.remove_all_hw_break = kgdb_remove_all_hw_break,
.correct_hw_break = kgdb_correct_hw_break,
+#endif
};
--
1.8.3.1
next prev parent reply other threads:[~2013-10-04 21:40 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-04 21:39 Allow disabling perf on x86 Andi Kleen
2013-10-04 21:39 ` [PATCH 1/6] perf, x86, amd: Move __get_ibs_caps into common amd CPU file Andi Kleen
2013-10-04 21:39 ` [PATCH 2/6] perf, x86: Make perf amd ibs code depend on PERF_EVENTS and SUP_AMD Andi Kleen
2013-10-04 21:39 ` [PATCH 3/6] x86, ptrace: Ifdef HW_BREAKPOINTS code in ptrace Andi Kleen
2013-10-04 21:39 ` [PATCH 4/6] trace: Make UPROBES depend on PERF_EVENTS Andi Kleen
2013-10-05 0:52 ` Steven Rostedt
2013-10-05 3:25 ` Andi Kleen
2013-10-04 21:39 ` Andi Kleen [this message]
2013-10-04 21:39 ` [PATCH 6/6] x86: Allow disabling HW_BREAKPOINTS and PERF_EVENTS Andi Kleen
2013-10-04 22:27 ` Frederic Weisbecker
2013-10-05 7:08 ` Ingo Molnar
2013-10-05 17:05 ` Andi Kleen
2013-10-08 19:55 ` Frederic Weisbecker
2013-10-08 20:05 ` Peter Zijlstra
2013-10-08 20:34 ` Frederic Weisbecker
2013-10-08 20:35 ` Frederic Weisbecker
2013-10-09 6:02 ` Ingo Molnar
2013-10-06 16:49 ` Ingo Molnar
2013-10-08 6:59 ` Ingo Molnar
2013-10-08 15:35 ` Steven Rostedt
2013-10-08 19:39 ` Ingo Molnar
2013-10-08 15:42 ` Vince Weaver
2013-10-08 15:51 ` Dave Jones
2013-10-08 16:22 ` David Ahern
2013-10-08 16:24 ` Dave Jones
2013-10-08 19:36 ` Ingo Molnar
2013-10-08 20:19 ` Steven Rostedt
2013-10-09 3:21 ` Andi Kleen
2013-10-09 3:24 ` Andi Kleen
2013-10-09 3:39 ` Andi Kleen
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=1380922788-23112-6-git-send-email-andi@firstfloor.org \
--to=andi@firstfloor.org \
--cc=ak@linux.intel.com \
--cc=jason.wessel@windriver.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=x86@kernel.org \
/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