Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 99899
b: refs/heads/master
c: 4de0043
h: refs/heads/master
i:
  99897: 4d817c7
  99895: 95325c5
v: v3
  • Loading branch information
Cyrill Gorcunov authored and Ingo Molnar committed Jul 8, 2008
1 parent bea9967 commit 3879272
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c376d45432d935e6f1e0ff2d6be3734bcd3ba455
refs/heads/master: 4de0043617f949fdac538fd59335e2150cd1b863
13 changes: 4 additions & 9 deletions trunk/arch/x86/kernel/nmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,7 @@ int __init check_nmi_watchdog(void)
unsigned int *prev_nmi_count;
int cpu;

if (nmi_watchdog == NMI_NONE)
return 0;

if (!atomic_read(&nmi_active))
if (!nmi_watchdog_active() || !atomic_read(&nmi_active))
return 0;

prev_nmi_count = kmalloc(nr_cpu_ids * sizeof(int), GFP_KERNEL);
Expand Down Expand Up @@ -317,8 +314,7 @@ void setup_apic_nmi_watchdog(void *unused)
void stop_apic_nmi_watchdog(void *unused)
{
/* only support LOCAL and IO APICs for now */
if (nmi_watchdog != NMI_LOCAL_APIC &&
nmi_watchdog != NMI_IO_APIC)
if (!nmi_watchdog_active())
return;
if (__get_cpu_var(wd_enabled) == 0)
return;
Expand Down Expand Up @@ -348,8 +344,7 @@ static DEFINE_PER_CPU(int, nmi_touch);

void touch_nmi_watchdog(void)
{
if (nmi_watchdog == NMI_LOCAL_APIC ||
nmi_watchdog == NMI_IO_APIC) {
if (nmi_watchdog_active()) {
unsigned cpu;

/*
Expand Down Expand Up @@ -474,7 +469,7 @@ int proc_nmi_enabled(struct ctl_table *table, int write, struct file *file,
if (!!old_state == !!nmi_watchdog_enabled)
return 0;

if (atomic_read(&nmi_active) < 0 || nmi_watchdog == NMI_NONE) {
if (atomic_read(&nmi_active) < 0 || !nmi_watchdog_active()) {
printk(KERN_WARNING
"NMI watchdog is permanently disabled\n");
return -EIO;
Expand Down
13 changes: 13 additions & 0 deletions trunk/include/asm-x86/nmi.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,19 @@ static inline void localise_nmi_watchdog(void)
if (nmi_watchdog == NMI_IO_APIC)
nmi_watchdog = NMI_LOCAL_APIC;
}

/* check if nmi_watchdog is active (ie was specified at boot) */
static inline int nmi_watchdog_active(void)
{
/*
* actually it should be:
* return (nmi_watchdog == NMI_LOCAL_APIC ||
* nmi_watchdog == NMI_IO_APIC)
* but since they are power of two we could use a
* cheaper way --cvg
*/
return nmi_watchdog & 0x3;
}
#endif

void lapic_watchdog_stop(void);
Expand Down

0 comments on commit 3879272

Please sign in to comment.