Lines Matching full:cpu

16 #include <linux/cpu.h>
35 * The powerpc watchdog ensures that each CPU is able to service timers.
36 * The watchdog sets up a simple timer on each CPU to run once per timer
37 * period, and updates a per-cpu timestamp and a "pending" cpumask. This is
43 * The soft-NMI checker can detect lockups on the local CPU. When interrupts
50 * The soft-NMI checker will compare the heartbeat timestamp for this CPU
61 * CPU clears their pending bit in their heartbeat timer. When the bitmask
62 * becomes empty, the last CPU to clear its pending bit updates a global
65 * In the heartbeat timer, if any CPU notices that the global timestamp has
67 * means the CPU(s) with their bit still set in the pending mask have had
71 * watchdog to detect an unresponsive CPU and pull it out of its stuck
117 int cpu = raw_smp_processor_id(); in wd_lockup_ipi() local
120 pr_emerg("CPU %d Hard LOCKUP\n", cpu); in wd_lockup_ipi()
121 pr_emerg("CPU %d TB:%lld, last heartbeat TB:%lld (%lldms ago)\n", in wd_lockup_ipi()
122 cpu, tb, per_cpu(wd_timer_tb, cpu), in wd_lockup_ipi()
123 tb_to_ns(tb - per_cpu(wd_timer_tb, cpu)) / 1000000); in wd_lockup_ipi()
145 static void set_cpu_stuck(int cpu, u64 tb) in set_cpu_stuck() argument
147 set_cpumask_stuck(cpumask_of(cpu), tb); in set_cpu_stuck()
150 static void watchdog_smp_panic(int cpu, u64 tb) in watchdog_smp_panic() argument
159 if (cpumask_test_cpu(cpu, &wd_smp_cpus_pending)) in watchdog_smp_panic()
164 pr_emerg("CPU %d detected hard LOCKUP on other CPUs %*pbl\n", in watchdog_smp_panic()
165 cpu, cpumask_pr_args(&wd_smp_cpus_pending)); in watchdog_smp_panic()
166 pr_emerg("CPU %d TB:%lld, last SMP heartbeat TB:%lld (%lldms ago)\n", in watchdog_smp_panic()
167 cpu, tb, wd_smp_last_reset_tb, in watchdog_smp_panic()
176 if (c == cpu) in watchdog_smp_panic()
199 static void wd_smp_clear_cpu_pending(int cpu, u64 tb) in wd_smp_clear_cpu_pending() argument
201 if (!cpumask_test_cpu(cpu, &wd_smp_cpus_pending)) { in wd_smp_clear_cpu_pending()
202 if (unlikely(cpumask_test_cpu(cpu, &wd_smp_cpus_stuck))) { in wd_smp_clear_cpu_pending()
208 pr_emerg("CPU %d became unstuck TB:%lld\n", in wd_smp_clear_cpu_pending()
209 cpu, tb); in wd_smp_clear_cpu_pending()
216 cpumask_clear_cpu(cpu, &wd_smp_cpus_stuck); in wd_smp_clear_cpu_pending()
221 cpumask_clear_cpu(cpu, &wd_smp_cpus_pending); in wd_smp_clear_cpu_pending()
236 static void watchdog_timer_interrupt(int cpu) in watchdog_timer_interrupt() argument
240 per_cpu(wd_timer_tb, cpu) = tb; in watchdog_timer_interrupt()
242 wd_smp_clear_cpu_pending(cpu, tb); in watchdog_timer_interrupt()
245 watchdog_smp_panic(cpu, tb); in watchdog_timer_interrupt()
251 int cpu = raw_smp_processor_id(); in DEFINE_INTERRUPT_HANDLER_NMI() local
257 if (!cpumask_test_cpu(cpu, &wd_cpus_enabled)) in DEFINE_INTERRUPT_HANDLER_NMI()
263 if (tb - per_cpu(wd_timer_tb, cpu) >= wd_panic_timeout_tb) { in DEFINE_INTERRUPT_HANDLER_NMI()
265 if (cpumask_test_cpu(cpu, &wd_smp_cpus_stuck)) { in DEFINE_INTERRUPT_HANDLER_NMI()
269 set_cpu_stuck(cpu, tb); in DEFINE_INTERRUPT_HANDLER_NMI()
271 pr_emerg("CPU %d self-detected hard LOCKUP @ %pS\n", in DEFINE_INTERRUPT_HANDLER_NMI()
272 cpu, (void *)regs->nip); in DEFINE_INTERRUPT_HANDLER_NMI()
273 pr_emerg("CPU %d TB:%lld, last heartbeat TB:%lld (%lldms ago)\n", in DEFINE_INTERRUPT_HANDLER_NMI()
274 cpu, tb, per_cpu(wd_timer_tb, cpu), in DEFINE_INTERRUPT_HANDLER_NMI()
275 tb_to_ns(tb - per_cpu(wd_timer_tb, cpu)) / 1000000); in DEFINE_INTERRUPT_HANDLER_NMI()
296 int cpu = smp_processor_id(); in watchdog_timer_fn() local
301 if (!cpumask_test_cpu(cpu, &watchdog_cpumask)) in watchdog_timer_fn()
304 watchdog_timer_interrupt(cpu); in watchdog_timer_fn()
314 int cpu = smp_processor_id(); in arch_touch_nmi_watchdog() local
317 if (tb - per_cpu(wd_timer_tb, cpu) >= ticks) { in arch_touch_nmi_watchdog()
318 per_cpu(wd_timer_tb, cpu) = tb; in arch_touch_nmi_watchdog()
319 wd_smp_clear_cpu_pending(cpu, tb); in arch_touch_nmi_watchdog()
327 int cpu = smp_processor_id(); in start_watchdog() local
330 if (cpumask_test_cpu(cpu, &wd_cpus_enabled)) { in start_watchdog()
338 if (!cpumask_test_cpu(cpu, &watchdog_cpumask)) in start_watchdog()
342 cpumask_set_cpu(cpu, &wd_cpus_enabled); in start_watchdog()
344 cpumask_set_cpu(cpu, &wd_smp_cpus_pending); in start_watchdog()
357 static int start_watchdog_on_cpu(unsigned int cpu) in start_watchdog_on_cpu() argument
359 return smp_call_function_single(cpu, start_watchdog, NULL, true); in start_watchdog_on_cpu()
365 int cpu = smp_processor_id(); in stop_watchdog() local
368 if (!cpumask_test_cpu(cpu, &wd_cpus_enabled)) in stop_watchdog()
369 return; /* Can happen in CPU unplug case */ in stop_watchdog()
374 cpumask_clear_cpu(cpu, &wd_cpus_enabled); in stop_watchdog()
377 wd_smp_clear_cpu_pending(cpu, get_tb()); in stop_watchdog()
380 static int stop_watchdog_on_cpu(unsigned int cpu) in stop_watchdog_on_cpu() argument
382 return smp_call_function_single(cpu, stop_watchdog, NULL, true); in stop_watchdog_on_cpu()
398 int cpu; in watchdog_nmi_stop() local
400 for_each_cpu(cpu, &wd_cpus_enabled) in watchdog_nmi_stop()
401 stop_watchdog_on_cpu(cpu); in watchdog_nmi_stop()
406 int cpu; in watchdog_nmi_start() local
409 for_each_cpu_and(cpu, cpu_online_mask, &watchdog_cpumask) in watchdog_nmi_start()
410 start_watchdog_on_cpu(cpu); in watchdog_nmi_start()