: sparc64: Implement NMI watchdog on capable cpus.
David Miller
maintainerPATCH 3/3 : sparc64: Implement NMI watchdog on capable cpus.
Signed-off-by David S. Miller <[email protected]>
--- arch/sparc/include/asm/cpudata_64.h | 2 +- arch/sparc/include/asm/irq_64.h | 4 +- arch/sparc/include/asm/kdebug_64.h | 2 + arch/sparc/include/asm/nmi.h | 10 ++ arch/sparc/include/asm/pcr.h | 16 +++ arch/sparc/kernel/Makefile | 1 + arch/sparc/kernel/irq_64.c | 68 +---------- arch/sparc/kernel/nmi.c | 224 +++++++++++++++++++++++++++++++++++ arch/sparc/kernel/pcr.c | 17 +++- arch/sparc/oprofile/init.c | 128 ++++++--------------- 10 files changed, 309 insertions(+), 163 deletions(-) create mode 100644 arch/sparc/include/asm/nmi.h create mode 100644 arch/sparc/kernel/nmi.c
arch/sparc/include/asm/cpudata_64.h +1 -1
@@ -17,7 +17,7 @@ typedef struct { /* Dcache line 1 */ unsigned int __softirq_pending; /* must be 1st, see rtrap.S */ - unsigned int __pad0; + unsigned int __nmi_count; unsigned long clock_tick; /* %tick's per second */ unsigned long __pad; unsigned int __pad1;
arch/sparc/include/asm/irq_64.h +1 -3
@@ -66,9 +66,6 @@ extern void virt_irq_free(unsigned int virt_irq);extern void __init init_IRQ (void );extern void fixup_irqs (void ); -extern int register_perfctr_intr (void (*handler)(struct pt_regs *)); -extern void release_perfctr_intr (void (*handler)(struct pt_regs *)); -static inline void set_softint (unsigned long bits) { __asm__ __volatile__("wr %0, 0x0, %%set_softint"
@@ -98,5 +95,6 @@ void __trigger_all_cpu_backtrace(void);extern void *hardirq_stack[NR_CPUS ];extern void *softirq_stack[NR_CPUS ];#define __ARCH_HAS_DO_SOFTIRQ +#define ARCH_HAS_NMI_WATCHDOG #endif
arch/sparc/include/asm/kdebug_64.h +2 -0
@@ -14,6 +14,8 @@ enum die_val {DIE_TRAP ,DIE_TRAP_TL1 ,DIE_CALL , +DIE_NMI , + DIE_NMIWATCHDOG, };#endif
arch/sparc/include/asm/nmi.h new file +10 -0
@@ -0,0 +1,10 @@ +#ifndef __NMI_H +#define __NMI_H + +extern int __init nmi_init (void ); +extern void perfctr_irq (int irq,struct pt_regs *regs); +extern void nmi_adjust_hz (unsigned int new_hz); + +extern int nmi_usable; + +#endif /* __NMI_H */
arch/sparc/include/asm/pcr.h +16 -0
@@ -27,4 +27,20 @@ extern void schedule_deferred_pcr_work(void);#define PCR_N2_SL1_SHIFT 27#define PCR_N2_OV1 0x80000000 +extern unsigned int picl_shift; + +/* In order to commonize as much of the implementation as +* possible, we use PICH as our counter. Mostly this is +* to accomodate Niagara-1 which can only count insn cycles +* in PICH. +*/ +static inline u64 picl_value (unsigned int nmi_hz) +{ +u32 delta =local_cpu_data ().clock_tick / (nmi_hz << picl_shift); + +return ((u64)((0 - delta) &0xffffffff )) <<32 ; +} + +extern u64 pcr_enable; +#endif /* __PCR_H */
arch/sparc/kernel/Makefile +1 -0
@@ -53,6 +53,7 @@ obj-$(CONFIG_SPARC64) += hvapi.o obj-$(CONFIG_SPARC64) += sstate.o obj-$(CONFIG_SPARC64) += mdesc.o obj-$(CONFIG_SPARC64) += pcr.o +obj-$(CONFIG_SPARC64) += nmi.o # sparc32 do not use GENERIC_HARDIRQS but uses the generic devres implementation obj-$(CONFIG_SPARC32) += devres.o
arch/sparc/kernel/irq_64.c +5 -63
80 lines not on this page · raw message
arch/sparc/kernel/nmi.c new file +224 -0
224 lines not on this page · raw message
arch/sparc/kernel/pcr.c +15 -2
@@ -9,12 +9,22 @@#include <asm/pil.h> #include <asm/pcr.h> +#include <asm/nmi.h> /* This code is shared between various users of the performance * counters. Users will be oprofile, pseudo-NMI watchdog, and the * perf_counter support layer. */ +#define PCR_SUN4U_ENABLE (PCR_PIC_PRIV | PCR_STRACE | PCR_UTRACE) +#define PCR_N2_ENABLE (PCR_PIC_PRIV | PCR_STRACE | PCR_UTRACE | \ + PCR_N2_TOE_OV1 | \ + (2 << PCR_N2_SL1_SHIFT) | \ + (0xff << PCR_N2_MASK1_SHIFT)) + +u64 pcr_enable; +unsigned int picl_shift; +/* Performance counter interrupts run unmasked at PIL level 15. * Therefore we can't do things like wakeups and other work * that expects IRQ disabling to be adhered to in locking etc.
@@ -117,12 +127,15 @@ int __init pcr_arch_init(void)switch (tlb_type) {case hypervisor: pcr_ops = &n2_pcr_ops; + pcr_enable =PCR_N2_ENABLE ; + picl_shift =2 ;break ; -case spitfire:case cheetah:case cheetah_plus: +case spitfire: pcr_ops = &direct_pcr_ops; + pcr_enable =PCR_SUN4U_ENABLE ;break ;default :
@@ -130,7 +143,7 @@ int __init pcr_arch_init(void) goto out_unregister; } -return 0 ; +return nmi_init (); out_unregister:unregister_perf_hsvc ();
arch/sparc/oprofile/init.c +34 -94
158 lines not on this page · raw message
Signature · 1 line
1.6.1.2.253.ga34a