aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/debug
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/debug')
-rw-r--r--kernel/debug/debug_core.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c
index f3cadda45f07..10db2833a423 100644
--- a/kernel/debug/debug_core.c
+++ b/kernel/debug/debug_core.c
@@ -55,6 +55,7 @@
55#include <linux/mm.h> 55#include <linux/mm.h>
56#include <linux/vmacache.h> 56#include <linux/vmacache.h>
57#include <linux/rcupdate.h> 57#include <linux/rcupdate.h>
58#include <linux/irq.h>
58 59
59#include <asm/cacheflush.h> 60#include <asm/cacheflush.h>
60#include <asm/byteorder.h> 61#include <asm/byteorder.h>
@@ -220,6 +221,46 @@ int __weak kgdb_skipexception(int exception, struct pt_regs *regs)
220 return 0; 221 return 0;
221} 222}
222 223
224#ifdef CONFIG_SMP
225
226/*
227 * Default (weak) implementation for kgdb_roundup_cpus
228 */
229
230static DEFINE_PER_CPU(call_single_data_t, kgdb_roundup_csd);
231
232void __weak kgdb_call_nmi_hook(void *ignored)
233{
234 /*
235 * NOTE: get_irq_regs() is supposed to get the registers from
236 * before the IPI interrupt happened and so is supposed to
237 * show where the processor was. In some situations it's
238 * possible we might be called without an IPI, so it might be
239 * safer to figure out how to make kgdb_breakpoint() work
240 * properly here.
241 */
242 kgdb_nmicallback(raw_smp_processor_id(), get_irq_regs());
243}
244
245void __weak kgdb_roundup_cpus(void)
246{
247 call_single_data_t *csd;
248 int this_cpu = raw_smp_processor_id();
249 int cpu;
250
251 for_each_online_cpu(cpu) {
252 /* No need to roundup ourselves */
253 if (cpu == this_cpu)
254 continue;
255
256 csd = &per_cpu(kgdb_roundup_csd, cpu);
257 csd->func = kgdb_call_nmi_hook;
258 smp_call_function_single_async(cpu, csd);
259 }
260}
261
262#endif
263
223/* 264/*
224 * Some architectures need cache flushes when we set/clear a 265 * Some architectures need cache flushes when we set/clear a
225 * breakpoint: 266 * breakpoint: