lkml.org 
[lkml]   [2000]   [Jul]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subjectnmi_counter cleanup
Date
This patch against 2.4.0-test5-pre2 :-

(1) Changes nmi_counter from atomic_t to unsigned int. nmi_counter is
per cpu and is only updated from the owning cpu. There is no need
for it to be atomic, the lock prefix just slows things down,
especially with the NMI oopser going.

(2) Removes nmi_counter from ppp, mips and s390 architectures, they
define it but never use it.

Any objections before I send it to Linus?

Index: 0-test5-pre2.1/include/asm-ia64/hardirq.h
--- 0-test5-pre2.1/include/asm-ia64/hardirq.h Fri, 26 May 2000 13:10:01 +1000 kaos (linux-2.4/p/24_hardirq.h 1.1 644)
+++ 0-test5-pre2.1(w)/include/asm-ia64/hardirq.h Tue, 18 Jul 2000 13:50:14 +1000 kaos (linux-2.4/p/24_hardirq.h 1.1 644)
@@ -14,7 +14,7 @@
typedef struct {
unsigned int __local_irq_count;
unsigned int __local_bh_count;
- atomic_t __nmi_counter;
+ unsigned int __nmi_counter;
# if NR_CPUS > 1
unsigned int __pad[13]; /* this assumes 64-byte cache-lines... */
# endif
Index: 0-test5-pre2.1/include/asm-ppc/hardirq.h
--- 0-test5-pre2.1/include/asm-ppc/hardirq.h Fri, 14 Jul 2000 19:35:46 +1000 kaos (linux-2.4/A/36_hardirq.h 1.2 644)
+++ 0-test5-pre2.1(w)/include/asm-ppc/hardirq.h Tue, 18 Jul 2000 13:51:59 +1000 kaos (linux-2.4/A/36_hardirq.h 1.2 644)
@@ -7,8 +7,7 @@
typedef struct {
unsigned int __local_irq_count;
unsigned int __local_bh_count;
- atomic_t __nmi_counter;
- unsigned int __pad[5];
+ unsigned int __pad[6];
} ____cacheline_aligned irq_cpustat_t;

extern irq_cpustat_t irq_stat [NR_CPUS];
@@ -18,7 +17,6 @@
*/
#define local_irq_count(cpu) (irq_stat[(cpu)].__local_irq_count)
#define local_bh_count(cpu) (irq_stat[(cpu)].__local_bh_count)
-#define nmi_counter(cpu) (irq_stat[(cpu)].__nmi_counter)

/*
* Are we in an interrupt context? Either doing bottom half
Index: 0-test5-pre2.1/include/asm-mips/hardirq.h
--- 0-test5-pre2.1/include/asm-mips/hardirq.h Fri, 26 May 2000 13:10:01 +1000 kaos (linux-2.4/M/14_hardirq.h 1.1 644)
+++ 0-test5-pre2.1(w)/include/asm-mips/hardirq.h Tue, 18 Jul 2000 13:49:32 +1000 kaos (linux-2.4/M/14_hardirq.h 1.1 644)
@@ -26,7 +26,6 @@
*/
#define local_irq_count(cpu) (irq_stat[(cpu)].__local_irq_count)
#define local_bh_count(cpu) (irq_stat[(cpu)].__local_bh_count)
-#define nmi_counter(cpu) (irq_stat[(cpu)].__nmi_counter)

/*
* Are we in an interrupt context? Either doing bottom half
Index: 0-test5-pre2.1/include/asm-i386/hardirq.h
--- 0-test5-pre2.1/include/asm-i386/hardirq.h Fri, 26 May 2000 13:10:01 +1000 kaos (linux-2.4/O/23_hardirq.h 1.1 644)
+++ 0-test5-pre2.1(w)/include/asm-i386/hardirq.h Tue, 18 Jul 2000 13:51:28 +1000 kaos (linux-2.4/O/23_hardirq.h 1.1 644)
@@ -8,7 +8,7 @@
typedef struct {
unsigned int __local_irq_count;
unsigned int __local_bh_count;
- atomic_t __nmi_counter;
+ unsigned int __nmi_counter;
unsigned int __pad[5];
} ____cacheline_aligned irq_cpustat_t;

Index: 0-test5-pre2.1/arch/s390/kernel/irq.c
--- 0-test5-pre2.1/arch/s390/kernel/irq.c Fri, 26 May 2000 13:10:01 +1000 kaos (linux-2.4/Y/b/39_irq.c 1.1 644)
+++ 0-test5-pre2.1(w)/arch/s390/kernel/irq.c Tue, 18 Jul 2000 13:48:33 +1000 kaos (linux-2.4/Y/b/39_irq.c 1.1 644)
@@ -45,8 +45,6 @@
const char *devname,
void *dev_id);

-atomic_t nmi_counter;
-
#if 0
/*
* The following vectors are part of the Linux architecture, there
@@ -105,7 +103,7 @@

} /* endfor */

- p += sprintf(p, "NMI: %10u\n", atomic_read(&nmi_counter));
+ p += sprintf(p, "NMI: %10u\n", nmi_counter);
#ifdef CONFIG_SMP
p += sprintf(p, "IPI: %10u\n", atomic_read(&ipi_count));
#endif
Index: 0-test5-pre2.1/arch/ia64/kernel/irq.c
--- 0-test5-pre2.1/arch/ia64/kernel/irq.c Fri, 23 Jun 2000 07:53:48 +1000 kaos (linux-2.4/c/c/10_irq.c 1.2 644)
+++ 0-test5-pre2.1(w)/arch/ia64/kernel/irq.c Tue, 18 Jul 2000 13:47:37 +1000 kaos (linux-2.4/c/c/10_irq.c 1.2 644)
@@ -162,7 +162,7 @@
p += sprintf(p, "NMI: ");
for (j = 0; j < smp_num_cpus; j++)
p += sprintf(p, "%10u ",
- atomic_read(&nmi_counter(cpu_logical_map(j))));
+ nmi_counter(cpu_logical_map(j)));
p += sprintf(p, "\n");
#if defined(CONFIG_SMP) && defined(__i386__)
p += sprintf(p, "LOC: ");
Index: 0-test5-pre2.1/arch/i386/kernel/io_apic.c
--- 0-test5-pre2.1/arch/i386/kernel/io_apic.c Thu, 06 Jul 2000 11:41:49 +1000 kaos (linux-2.4/z/c/33_io_apic.c 1.1.1.2 644)
+++ 0-test5-pre2.1(w)/arch/i386/kernel/io_apic.c Tue, 18 Jul 2000 13:47:14 +1000 kaos (linux-2.4/z/c/33_io_apic.c 1.1.1.2 644)
@@ -1059,8 +1059,6 @@
return 0;
}

-extern atomic_t nmi_counter[NR_CPUS];
-
static int __init nmi_irq_works(void)
{
irq_cpustat_t tmp[NR_CPUS];
@@ -1072,7 +1070,7 @@

for (j = 0; j < smp_num_cpus; j++) {
cpu = cpu_logical_map(j);
- if (atomic_read(&nmi_counter(cpu)) - atomic_read(&tmp[cpu].__nmi_counter) <= 3) {
+ if (nmi_counter(cpu) - tmp[cpu].__nmi_counter <= 3) {
printk(KERN_WARNING "CPU#%d NMI appears to be stuck.\n", cpu);
return 0;
}
Index: 0-test5-pre2.1/arch/i386/kernel/irq.c
--- 0-test5-pre2.1/arch/i386/kernel/irq.c Fri, 26 May 2000 13:10:01 +1000 kaos (linux-2.4/z/c/43_irq.c 1.1 644)
+++ 0-test5-pre2.1(w)/arch/i386/kernel/irq.c Tue, 18 Jul 2000 13:45:11 +1000 kaos (linux-2.4/z/c/43_irq.c 1.1 644)
@@ -160,7 +160,7 @@
p += sprintf(p, "NMI: ");
for (j = 0; j < smp_num_cpus; j++)
p += sprintf(p, "%10u ",
- atomic_read(&nmi_counter(cpu_logical_map(j))));
+ nmi_counter(cpu_logical_map(j)));
p += sprintf(p, "\n");
#if CONFIG_SMP
p += sprintf(p, "LOC: ");
Index: 0-test5-pre2.1/arch/i386/kernel/traps.c
--- 0-test5-pre2.1/arch/i386/kernel/traps.c Fri, 07 Jul 2000 14:32:54 +1000 kaos (linux-2.4/A/c/1_traps.c 1.1.2.2.1.1 644)
+++ 0-test5-pre2.1(w)/arch/i386/kernel/traps.c Tue, 18 Jul 2000 13:44:53 +1000 kaos (linux-2.4/A/c/1_traps.c 1.1.2.2.1.1 644)
@@ -459,7 +459,7 @@
unsigned char reason = inb(0x61);


- atomic_inc(&nmi_counter(smp_processor_id()));
+ ++nmi_counter(smp_processor_id());
if (!(reason & 0xc0)) {
#if CONFIG_X86_IO_APIC
/*

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:57    [W:0.092 / U:0.508 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site