Skip to contentSkip to conversation

fix typo in nmi.c of apic

PATCH In review Luming Yu 4 participants 7 messages Sep 11, 2009 – Oct 27, 2009 x86

lore
Share & tools
lore

Luming Yu

author
#0 lore raw

PATCH 1/1 fix typo in nmi.c of apic

Hi there,

I came across x86/kernel/apic/nmi.c and found several typo. It's trivial in terms of doing nothing on changing execution logic.

Please review. If make sense, please apply.

Ps. The patch is enclosed in attachment. The inline one is c&p of it for reading.

Thanks,
Luming

 nmi.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
arch/x86/kernel/apic/nmi.c +0 -0
index b3025b4..9ff1f6d 100644
@@ -121,7 +121,7 @@ static void report_broken_nmi(int cpu, unsigned

int *prev_nmi_count)
atomic_dec(&nmi_active);
}

-static void __acpi_nmi_disable(void *__unused) +static void __apic_nmi_disable(void *__unused)
{
apic_write(APIC_LVT0, APIC_DM_NMI | APIC_LVT_MASKED);
}
@@ -178,7 +178,7 @@ error:
if (nmi_watchdog == NMI_IO_APIC) {
if (!timer_through_8259)
disable_8259A_irq(0);
- on_each_cpu(__acpi_nmi_disable, NULL, 1);
+ on_each_cpu(__apic_nmi_disable, NULL, 1);
}

#ifdef CONFIG_X86_32
@@ -276,7 +276,7 @@ late_initcall(init_lapic_nmi_sysfs);

#endif /* CONFIG_PM */

-static void __acpi_nmi_enable(void *__unused)
+static void __apic_nmi_enable(void *__unused)
{
apic_write(APIC_LVT0, APIC_DM_NMI);
}
@@ -284,19 +284,19 @@ static void __acpi_nmi_enable(void *__unused)
/*
* Enable timer based NMIs on all CPUs:
*/
-void acpi_nmi_enable(void)
+void apic_nmi_enable(void)
{
if (atomic_read(&nmi_active) && nmi_watchdog == NMI_IO_APIC)
- on_each_cpu(__acpi_nmi_enable, NULL, 1);
+ on_each_cpu(__apic_nmi_enable, NULL, 1);
}

/*
* Disable timer based NMIs on all CPUs:
*/
-void acpi_nmi_disable(void)
+void apic_nmi_disable(void)
{
if (atomic_read(&nmi_active) && nmi_watchdog == NMI_IO_APIC)
- on_each_cpu(__acpi_nmi_disable, NULL, 1);
+ on_each_cpu(__apic_nmi_disable, NULL, 1);
}

/*
@@ -341,7 +341,7 @@ void stop_apic_nmi_watchdog(void *unused)
if (nmi_watchdog == NMI_LOCAL_APIC)
lapic_watchdog_stop();
else
- __acpi_nmi_disable(NULL);
+ __apic_nmi_disable(NULL);
__get_cpu_var(wd_enabled) = 0;
atomic_dec(&nmi_active);
}
@@ -472,7 +472,7 @@ static void enable_ioapic_nmi_watchdog_single(void *unused)
{
__get_cpu_var(wd_enabled) = 1;
atomic_inc(&nmi_active);
- __acpi_nmi_enable(NULL);
+ __apic_nmi_enable(NULL);
}

static void enable_ioapic_nmi_watchdog(void)

arch/x86/kernel/apic/nmi.c +9 -9
index b3025b4..9ff1f6d 100644
@@ -121,7 +121,7 @@ static void report_broken_nmi(int cpu, unsigned int *prev_nmi_count)
 	atomic_dec(&nmi_active);
 }
 
-static void __acpi_nmi_disable(void *__unused)
+static void __apic_nmi_disable(void *__unused)
 {
 	apic_write(APIC_LVT0, APIC_DM_NMI | APIC_LVT_MASKED);
 }
@@ -178,7 +178,7 @@ error:
 	if (nmi_watchdog == NMI_IO_APIC) {
 		if (!timer_through_8259)
 			disable_8259A_irq(0);
-		on_each_cpu(__acpi_nmi_disable, NULL, 1);
+		on_each_cpu(__apic_nmi_disable, NULL, 1);
 	}
 
 #ifdef CONFIG_X86_32
@@ -276,7 +276,7 @@ late_initcall(init_lapic_nmi_sysfs);
 
 #endif	/* CONFIG_PM */
 
-static void __acpi_nmi_enable(void *__unused)
+static void __apic_nmi_enable(void *__unused)
 {
 	apic_write(APIC_LVT0, APIC_DM_NMI);
 }
@@ -284,19 +284,19 @@ static void __acpi_nmi_enable(void *__unused)
 /*
  * Enable timer based NMIs on all CPUs:
  */
-void acpi_nmi_enable(void)
+void apic_nmi_enable(void)
 {
 	if (atomic_read(&nmi_active) && nmi_watchdog == NMI_IO_APIC)
-		on_each_cpu(__acpi_nmi_enable, NULL, 1);
+		on_each_cpu(__apic_nmi_enable, NULL, 1);
 }
 
 /*
  * Disable timer based NMIs on all CPUs:
  */
-void acpi_nmi_disable(void)
+void apic_nmi_disable(void)
 {
 	if (atomic_read(&nmi_active) && nmi_watchdog == NMI_IO_APIC)
-		on_each_cpu(__acpi_nmi_disable, NULL, 1);
+		on_each_cpu(__apic_nmi_disable, NULL, 1);
 }
 
 /*
@@ -341,7 +341,7 @@ void stop_apic_nmi_watchdog(void *unused)
 	if (nmi_watchdog == NMI_LOCAL_APIC)
 		lapic_watchdog_stop();
 	else
-		__acpi_nmi_disable(NULL);
+		__apic_nmi_disable(NULL);
 	__get_cpu_var(wd_enabled) = 0;
 	atomic_dec(&nmi_active);
 }
@@ -472,7 +472,7 @@ static void enable_ioapic_nmi_watchdog_single(void *unused)
 {
 	__get_cpu_var(wd_enabled) = 1;
 	atomic_inc(&nmi_active);
-	__acpi_nmi_enable(NULL);
+	__apic_nmi_enable(NULL);
 }
 
 static void enable_ioapic_nmi_watchdog(void)
#1 lore raw
Quoted 4 lines · Luming Yu

I came across x86/kernel/apic/nmi.c and found several typo. It's trivial in terms of doing nothing on changing execution logic.

Please review. If make sense, please apply.

Not a typo, but a historical leftover I believe. I think your change
makes sense these days now either way.

Maciej

#2 lore raw
In reply to Luming Yu
Quoted 4 lines · Luming Yu

I came across x86/kernel/apic/nmi.c and found several typo. It's trivial in terms of doing nothing on changing execution logic.

Please review. If make sense, please apply.

Hi,

I'd rather go this through x86 tree. Adding Ingo.

Quoted 87 lines

Ps. The patch is enclosed in attachment. The inline one is c&p of it for reading.

Thanks,
Luming

 nmi.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
arch/x86/kernel/apic/nmi.c +1 -1
index b3025b4..9ff1f6d 100644
@@ -121,7 +121,7 @@ static void report_broken_nmi(int cpu, unsigned
 int *prev_nmi_count)
 	atomic_dec(&nmi_active);
 }
 
-static void __acpi_nmi_disable(void *__unused)
+static void __apic_nmi_disable(void *__unused)
 {
 	apic_write(APIC_LVT0, APIC_DM_NMI | APIC_LVT_MASKED);

}

arch/x86/kernel/apic/nmi.c +8 -8
@@ -178,7 +178,7 @@ error:
 	if (nmi_watchdog == NMI_IO_APIC) {
 		if (!timer_through_8259)
 			disable_8259A_irq(0);
-		on_each_cpu(__acpi_nmi_disable, NULL, 1);
+		on_each_cpu(__apic_nmi_disable, NULL, 1);
 	}
 
 #ifdef CONFIG_X86_32
@@ -276,7 +276,7 @@ late_initcall(init_lapic_nmi_sysfs);
 
 #endif	/* CONFIG_PM */
 
-static void __acpi_nmi_enable(void *__unused)
+static void __apic_nmi_enable(void *__unused)
 {
 	apic_write(APIC_LVT0, APIC_DM_NMI);
 }
@@ -284,19 +284,19 @@ static void __acpi_nmi_enable(void *__unused)
 /*
  * Enable timer based NMIs on all CPUs:
  */
-void acpi_nmi_enable(void)
+void apic_nmi_enable(void)
 {
 	if (atomic_read(&nmi_active) && nmi_watchdog == NMI_IO_APIC)
-		on_each_cpu(__acpi_nmi_enable, NULL, 1);
+		on_each_cpu(__apic_nmi_enable, NULL, 1);
 }
 
 /*
  * Disable timer based NMIs on all CPUs:
  */
-void acpi_nmi_disable(void)
+void apic_nmi_disable(void)
 {
 	if (atomic_read(&nmi_active) && nmi_watchdog == NMI_IO_APIC)
-		on_each_cpu(__acpi_nmi_disable, NULL, 1);
+		on_each_cpu(__apic_nmi_disable, NULL, 1);
 }
 
 /*
@@ -341,7 +341,7 @@ void stop_apic_nmi_watchdog(void *unused)
 	if (nmi_watchdog == NMI_LOCAL_APIC)
 		lapic_watchdog_stop();
 	else
-		__acpi_nmi_disable(NULL);
+		__apic_nmi_disable(NULL);
 	__get_cpu_var(wd_enabled) = 0;
 	atomic_dec(&nmi_active);
 }
@@ -472,7 +472,7 @@ static void enable_ioapic_nmi_watchdog_single(void *unused)
 {
 	__get_cpu_var(wd_enabled) = 1;
 	atomic_inc(&nmi_active);
-	__acpi_nmi_enable(NULL);
+	__apic_nmi_enable(NULL);
 }
 
 static void enable_ioapic_nmi_watchdog(void)
Signature · 2 lines
Jiri Kosina
SUSE Labs, Novell Inc.
#3 lore raw
Quoted 32 lines · Jiri Kosina
Quoted 4 lines · Luming Yu

I came across x86/kernel/apic/nmi.c and found several typo. It's trivial in terms of doing nothing on changing execution logic.

Please review. If make sense, please apply.

Hi,

I'd rather go this through x86 tree. Adding Ingo.

Quoted 21 lines

Ps. The patch is enclosed in attachment. The inline one is c&p of it for reading.

Thanks,
Luming

 nmi.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
arch/x86/kernel/apic/nmi.c +0 -0
index b3025b4..9ff1f6d 100644
@@ -121,7 +121,7 @@ static void report_broken_nmi(int cpu, unsigned
 int *prev_nmi_count)
 	atomic_dec(&nmi_active);
 }
 
Quoted 2 lines

arch/x86/kernel/apic/nmi.c static void report_broken_nmi(int cpu, unsigned int *prev_nmi_count) · line 124

Quoted 2 lines
arch/x86/kernel/apic/nmi.c +1 -1
-static void __acpi_nmi_disable(void *__unused)
+static void __apic_nmi_disable(void *__unused)

that's correctly named, as a 'git grep acpi_nmi_disable' should reveal.

Ingo

#4 lore raw
Quoted 25 lines · Ingo Molnar
Quoted 25 lines
Quoted 2 lines

I came across x86/kernel/apic/nmi.c and found several typo. It's trivial in terms of doing nothing on changing execution logic.

I'd rather go this through x86 tree. Adding Ingo.

Quoted 21 lines

Ps. The patch is enclosed in attachment. The inline one is c&p of it for reading.

Thanks,
Luming

 nmi.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
arch/x86/kernel/apic/nmi.c +0 -0
index b3025b4..9ff1f6d 100644
@@ -121,7 +121,7 @@ static void report_broken_nmi(int cpu, unsigned
 int *prev_nmi_count)
 	atomic_dec(&nmi_active);
 }
 
Quoted 4 lines
Quoted 2 lines

arch/x86/kernel/apic/nmi.c static void report_broken_nmi(int cpu, unsigned int *prev_nmi_count) · line 124

Quoted 2 lines
arch/x86/kernel/apic/nmi.c +1 -1
-static void __acpi_nmi_disable(void *__unused)
+static void __apic_nmi_disable(void *__unused)

that's correctly named, as a 'git grep acpi_nmi_disable' should reveal.

I actually think that Luming Yu is right that the function is misnamed. What does it have to do with ACPI?

All we do here is disable the NMI/LVT flags on the corresponding APIC. No ACPI involved.

Signature · 2 lines
Jiri Kosina
SUSE Labs, Novell Inc.
#5 lore raw
Quoted 27 lines · Jiri Kosina
Quoted 25 lines · Ingo Molnar
Quoted 25 lines
Quoted 2 lines

I came across x86/kernel/apic/nmi.c and found several typo. It's trivial in terms of doing nothing on changing execution logic.

I'd rather go this through x86 tree. Adding Ingo.

Quoted 21 lines

Ps. The patch is enclosed in attachment. The inline one is c&p of it for reading.

Thanks,
Luming

 nmi.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
arch/x86/kernel/apic/nmi.c +0 -0
index b3025b4..9ff1f6d 100644
@@ -121,7 +121,7 @@ static void report_broken_nmi(int cpu, unsigned
 int *prev_nmi_count)
 	atomic_dec(&nmi_active);
 }
 
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

arch/x86/kernel/apic/nmi.c static void report_broken_nmi(int cpu, unsigned int *prev_nmi_count) · line 124

Quoted 2 lines
arch/x86/kernel/apic/nmi.c +1 -1
-static void __acpi_nmi_disable(void *__unused)
+static void __apic_nmi_disable(void *__unused)

that's correctly named, as a 'git grep acpi_nmi_disable' should reveal.

I actually think that Luming Yu is right that the function is misnamed. What does it have to do with ACPI?

It's not misnamed - it is a facility provided by architecture code to the ACPI subsystem and hence named acpi_*(). See:

5d0e600: [PATCH] x86: fix laptop bootup hang in init_acpi()

Other architectures could opt to implement the same quirk - but it has nothing to do with APIC.

Yes, on x86 we use the local APIC to disable NMIs, but that has no effect on the naming of the facility ...

Ingo

author
#6 lore raw
Quoted 35 lines · Ingo Molnar
Quoted 32 lines · Jiri Kosina
Quoted 29 lines · Ingo Molnar
Quoted 25 lines
Quoted 2 lines

I came across x86/kernel/apic/nmi.c and found several typo. It's trivial in terms of doing nothing on changing execution logic.

I'd rather go this through x86 tree. Adding Ingo.

Quoted 21 lines

Ps. The patch is enclosed in attachment. The inline one is c&p of it for reading.

Thanks,
Luming

 nmi.c |   18 +++++++++---------

 1 file changed, 9 insertions(+), 9 deletions(-)
arch/x86/kernel/apic/nmi.c +0 -0
index b3025b4..9ff1f6d 100644
@@ -121,7 +121,7 @@ static void report_broken_nmi(int cpu, unsigned
 int *prev_nmi_count)
         atomic_dec(&nmi_active);
  }
 
Quoted 2 lines

arch/x86/kernel/apic/nmi.c static void report_broken_nmi(int cpu, unsigned int *prev_nmi_count) · line 124

Quoted 2 lines
arch/x86/kernel/apic/nmi.c +1 -1
-static void __acpi_nmi_disable(void *__unused)
+static void __apic_nmi_disable(void *__unused)

that's correctly named, as a 'git grep acpi_nmi_disable' should reveal.

Quoted 7 lines
Quoted 2 lines

I actually think that Luming Yu is right that the function is misnamed. What does it have to do with ACPI?

It's not misnamed - it is a facility provided by architecture code to the ACPI subsystem and hence named acpi_*(). See:

 5d0e600: [PATCH] x86: fix laptop bootup hang in init_acpi()

Hmm..I would put some comments around those "__acpi_xxx", so others can know it is intended name.

Quoted 9 lines

Other architectures could opt to implement the same quirk - but it has nothing to do with APIC.

Yes, on x86 we use the local APIC to disable NMIs, but that has no effect on the naming of the facility ...

       Ingo