Skip to contentSkip to conversation

x86: Merge hardirq.h

PATCH In review Brian Gerst 3 participants 9 messages Jan 22, 2009 – Jan 23, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover x86: Merge hardirq.h

This patch series merges the 32-bit and 64-bit hardirq.h headers and does several associated cleanups. Based on tip/core/percpu.

 arch/x86/include/asm/hardirq.h    |   49 ++++++++++++++++++++++++++++++++++---
 arch/x86/include/asm/hardirq_32.h |   33 -------------------------
 arch/x86/include/asm/hardirq_64.h |   39 -----------------------------
 arch/x86/kernel/efi_64.c          |    1 +
 arch/x86/kernel/irq_64.c          |    1 +
 arch/x86/kernel/process_32.c      |    1 -
 6 files changed, 47 insertions(+), 77 deletions(-)

--
Brian Gerst

#1 lore raw

PATCH 1/5 x86-32: Remove idle_timestamp

idle_timestamp is left over from the removed irqbalance code.

---
 arch/x86/include/asm/hardirq_32.h |    1 -
 arch/x86/kernel/process_32.c      |    1 -
 2 files changed, 0 insertions(+), 2 deletions(-)
arch/x86/include/asm/hardirq_32.h +0 -1
index d4b5d73..a70ed05 100644
@@ -6,7 +6,6 @@
 
 typedef struct {
 	unsigned int __softirq_pending;
-	unsigned long idle_timestamp;
 	unsigned int __nmi_count;	/* arch dependent */
 	unsigned int apic_timer_irqs;	/* arch dependent */
 	unsigned int irq0_irqs;
arch/x86/kernel/process_32.c +0 -1
index 2c00a57..1a1ae8e 100644
@@ -108,7 +108,6 @@ void cpu_idle(void)
 				play_dead();
 
 			local_irq_disable();
-			__get_cpu_var(irq_stat).idle_timestamp = jiffies;
 			/* Don't trace irqs off for idle */
 			stop_critical_timings();
 			pm_idle();
Signature · 1 line
1.6.1
#2 lore raw

PATCH 2/5 x86-64: Remove include of apic.h from hardirq_64.h

In reply to Brian Gerst

APIC definitions aren't needed here. Remove the include and fix up the fallout.

---
 arch/x86/include/asm/hardirq_64.h |    1 -
 arch/x86/kernel/efi_64.c          |    1 +
 arch/x86/kernel/irq_64.c          |    1 +
 3 files changed, 2 insertions(+), 1 deletions(-)
arch/x86/include/asm/hardirq_64.h +0 -1
index a65bab2..873c3c7 100644
@@ -3,7 +3,6 @@
 
 #include <linux/threads.h>
 #include <linux/irq.h>
-#include <asm/apic.h>
 
 typedef struct {
 	unsigned int __softirq_pending;
arch/x86/kernel/efi_64.c +1 -0
index 652c528..a4ee291 100644
@@ -36,6 +36,7 @@
 #include <asm/proto.h>
 #include <asm/efi.h>
 #include <asm/cacheflush.h>
+#include <asm/fixmap.h>
 
 static pgd_t save_pgd __initdata;
 static unsigned long efi_flags __initdata;
arch/x86/kernel/irq_64.c +1 -0
index 0b254de..018963a 100644
@@ -18,6 +18,7 @@
 #include <linux/smp.h>
 #include <asm/io_apic.h>
 #include <asm/idle.h>
+#include <asm/apic.h>
 
 DEFINE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
 EXPORT_PER_CPU_SYMBOL(irq_stat);
Signature · 1 line
1.6.1
#3 lore raw

PATCH 3/5 x86: Sync hardirq_{32,64}.h

In reply to Brian Gerst

In general, use the 64-bit version.

---
 arch/x86/include/asm/hardirq_32.h |   14 ++++++++++----
 arch/x86/include/asm/hardirq_64.h |   10 +++++-----
 2 files changed, 15 insertions(+), 9 deletions(-)
arch/x86/include/asm/hardirq_32.h +10 -4
index a70ed05..e5a332c 100644
@@ -14,6 +14,7 @@ typedef struct {
 	unsigned int irq_tlb_count;
 	unsigned int irq_thermal_count;
 	unsigned int irq_spurious_count;
+	unsigned int irq_threshold_count;
 } ____cacheline_aligned irq_cpustat_t;
 
 DECLARE_PER_CPU(irq_cpustat_t, irq_stat);
@@ -22,11 +23,16 @@ DECLARE_PER_CPU(irq_cpustat_t, irq_stat);
 #define MAX_HARDIRQS_PER_CPU NR_VECTORS
 
 #define __ARCH_IRQ_STAT
-#define __IRQ_STAT(cpu, member) (per_cpu(irq_stat, cpu).member)
 
-#define inc_irq_stat(member)	(__get_cpu_var(irq_stat).member++)
+#define inc_irq_stat(member)	percpu_add(irq_stat.member, 1)
 
-void ack_bad_irq(unsigned int irq);
-#include <linux/irq_cpustat.h>
+#define local_softirq_pending()	percpu_read(irq_stat.__softirq_pending)
+
+#define __ARCH_SET_SOFTIRQ_PENDING
+
+#define set_softirq_pending(x)	percpu_write(irq_stat.__softirq_pending, (x))
+#define or_softirq_pending(x)	percpu_or(irq_stat.__softirq_pending, (x))
+
+extern void ack_bad_irq(unsigned int irq);
 
 #endif /* _ASM_X86_HARDIRQ_32_H */
arch/x86/include/asm/hardirq_64.h +5 -5
index 873c3c7..392e7d6 100644
@@ -22,16 +22,16 @@ DECLARE_PER_CPU(irq_cpustat_t, irq_stat);
 /* We can have at most NR_VECTORS irqs routed to a cpu at a time */
 #define MAX_HARDIRQS_PER_CPU NR_VECTORS
 
-#define __ARCH_IRQ_STAT 1
+#define __ARCH_IRQ_STAT
 
 #define inc_irq_stat(member)	percpu_add(irq_stat.member, 1)
 
-#define local_softirq_pending() percpu_read(irq_stat.__softirq_pending)
+#define local_softirq_pending()	percpu_read(irq_stat.__softirq_pending)
 
-#define __ARCH_SET_SOFTIRQ_PENDING 1
+#define __ARCH_SET_SOFTIRQ_PENDING
 
-#define set_softirq_pending(x) percpu_write(irq_stat.__softirq_pending, (x))
-#define or_softirq_pending(x)  percpu_or(irq_stat.__softirq_pending, (x))
+#define set_softirq_pending(x)	percpu_write(irq_stat.__softirq_pending, (x))
+#define or_softirq_pending(x)	percpu_or(irq_stat.__softirq_pending, (x))
 
 extern void ack_bad_irq(unsigned int irq);
 
Signature · 1 line
1.6.1
#4 lore raw

PATCH 4/5 x86: Merge hardirq_{32,64}.h into hardirq.h

In reply to Brian Gerst
---
 arch/x86/include/asm/hardirq.h    |   43 ++++++++++++++++++++++++++++++++----
 arch/x86/include/asm/hardirq_32.h |   38 --------------------------------
 arch/x86/include/asm/hardirq_64.h |   38 --------------------------------
 3 files changed, 38 insertions(+), 81 deletions(-)
 delete mode 100644 arch/x86/include/asm/hardirq_32.h
 delete mode 100644 arch/x86/include/asm/hardirq_64.h
arch/x86/include/asm/hardirq.h +38 -5
index 000787d..f4a95f2 100644
@@ -1,11 +1,44 @@
-#ifdef CONFIG_X86_32
-# include "hardirq_32.h"
-#else
-# include "hardirq_64.h"
-#endif
+#ifndef _ASM_X86_HARDIRQ_H
+#define _ASM_X86_HARDIRQ_H
+
+#include <linux/threads.h>
+#include <linux/irq.h>
+
+typedef struct {
+	unsigned int __softirq_pending;
+	unsigned int __nmi_count;	/* arch dependent */
+	unsigned int apic_timer_irqs;	/* arch dependent */
+	unsigned int irq0_irqs;
+	unsigned int irq_resched_count;
+	unsigned int irq_call_count;
+	unsigned int irq_tlb_count;
+	unsigned int irq_thermal_count;
+	unsigned int irq_spurious_count;
+	unsigned int irq_threshold_count;
+} ____cacheline_aligned irq_cpustat_t;
+
+DECLARE_PER_CPU(irq_cpustat_t, irq_stat);
+
+/* We can have at most NR_VECTORS irqs routed to a cpu at a time */
+#define MAX_HARDIRQS_PER_CPU NR_VECTORS
+
+#define __ARCH_IRQ_STAT
+
+#define inc_irq_stat(member)	percpu_add(irq_stat.member, 1)
+
+#define local_softirq_pending()	percpu_read(irq_stat.__softirq_pending)
+
+#define __ARCH_SET_SOFTIRQ_PENDING
+
+#define set_softirq_pending(x)	percpu_write(irq_stat.__softirq_pending, (x))
+#define or_softirq_pending(x)	percpu_or(irq_stat.__softirq_pending, (x))
+
+extern void ack_bad_irq(unsigned int irq);
 
 extern u64 arch_irq_stat_cpu(unsigned int cpu);
 #define arch_irq_stat_cpu	arch_irq_stat_cpu
 
 extern u64 arch_irq_stat(void);
 #define arch_irq_stat		arch_irq_stat
+
+#endif /* _ASM_X86_HARDIRQ_H */
arch/x86/include/asm/hardirq_32.h deleted +0 -38
deleted file mode 100644
index e5a332c..0000000
@@ -1,38 +0,0 @@
-#ifndef _ASM_X86_HARDIRQ_32_H
-#define _ASM_X86_HARDIRQ_32_H
-
-#include <linux/threads.h>
-#include <linux/irq.h>
-
-typedef struct {
-	unsigned int __softirq_pending;
-	unsigned int __nmi_count;	/* arch dependent */
-	unsigned int apic_timer_irqs;	/* arch dependent */
-	unsigned int irq0_irqs;
-	unsigned int irq_resched_count;
-	unsigned int irq_call_count;
-	unsigned int irq_tlb_count;
-	unsigned int irq_thermal_count;
-	unsigned int irq_spurious_count;
-	unsigned int irq_threshold_count;
-} ____cacheline_aligned irq_cpustat_t;
-
-DECLARE_PER_CPU(irq_cpustat_t, irq_stat);
-
-/* We can have at most NR_VECTORS irqs routed to a cpu at a time */
-#define MAX_HARDIRQS_PER_CPU NR_VECTORS
-
-#define __ARCH_IRQ_STAT
-
-#define inc_irq_stat(member)	percpu_add(irq_stat.member, 1)
-
-#define local_softirq_pending()	percpu_read(irq_stat.__softirq_pending)
-
-#define __ARCH_SET_SOFTIRQ_PENDING
-
-#define set_softirq_pending(x)	percpu_write(irq_stat.__softirq_pending, (x))
-#define or_softirq_pending(x)	percpu_or(irq_stat.__softirq_pending, (x))
-
-extern void ack_bad_irq(unsigned int irq);
-
-#endif /* _ASM_X86_HARDIRQ_32_H */
arch/x86/include/asm/hardirq_64.h deleted +0 -38
deleted file mode 100644
index 392e7d6..0000000
@@ -1,38 +0,0 @@
-#ifndef _ASM_X86_HARDIRQ_64_H
-#define _ASM_X86_HARDIRQ_64_H
-
-#include <linux/threads.h>
-#include <linux/irq.h>
-
-typedef struct {
-	unsigned int __softirq_pending;
-	unsigned int __nmi_count;	/* arch dependent */
-	unsigned int apic_timer_irqs;	/* arch dependent */
-	unsigned int irq0_irqs;
-	unsigned int irq_resched_count;
-	unsigned int irq_call_count;
-	unsigned int irq_tlb_count;
-	unsigned int irq_thermal_count;
-	unsigned int irq_spurious_count;
-	unsigned int irq_threshold_count;
-} ____cacheline_aligned irq_cpustat_t;
-
-DECLARE_PER_CPU(irq_cpustat_t, irq_stat);
-
-/* We can have at most NR_VECTORS irqs routed to a cpu at a time */
-#define MAX_HARDIRQS_PER_CPU NR_VECTORS
-
-#define __ARCH_IRQ_STAT
-
-#define inc_irq_stat(member)	percpu_add(irq_stat.member, 1)
-
-#define local_softirq_pending()	percpu_read(irq_stat.__softirq_pending)
-
-#define __ARCH_SET_SOFTIRQ_PENDING
-
-#define set_softirq_pending(x)	percpu_write(irq_stat.__softirq_pending, (x))
-#define or_softirq_pending(x)	percpu_or(irq_stat.__softirq_pending, (x))
-
-extern void ack_bad_irq(unsigned int irq);
-
-#endif /* _ASM_X86_HARDIRQ_64_H */
Signature · 1 line
1.6.1
#5 lore raw

PATCH 5/5 x86: make irq_cpustat_t fields conditional.

In reply to Brian Gerst
---
 arch/x86/include/asm/hardirq.h |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
arch/x86/include/asm/hardirq.h +10 -2
index f4a95f2..176f058 100644
@@ -7,14 +7,22 @@
 typedef struct {
 	unsigned int __softirq_pending;
 	unsigned int __nmi_count;	/* arch dependent */
-	unsigned int apic_timer_irqs;	/* arch dependent */
 	unsigned int irq0_irqs;
+#ifdef CONFIG_X86_LOCAL_APIC
+	unsigned int apic_timer_irqs;	/* arch dependent */
+	unsigned int irq_spurious_count;
+#endif
+#ifdef CONFIG_SMP
 	unsigned int irq_resched_count;
 	unsigned int irq_call_count;
 	unsigned int irq_tlb_count;
+#endif
+#ifdef CONFIG_X86_MCE
 	unsigned int irq_thermal_count;
-	unsigned int irq_spurious_count;
+# ifdef CONFIG_X86_64
 	unsigned int irq_threshold_count;
+# endif
+#endif
 } ____cacheline_aligned irq_cpustat_t;
 
 DECLARE_PER_CPU(irq_cpustat_t, irq_stat);
Signature · 1 line
1.6.1
#6 lore raw
In reply to Brian Gerst
Quoted 10 lines · Brian Gerst

This patch series merges the 32-bit and 64-bit hardirq.h headers and does several associated cleanups. Based on tip/core/percpu.

 arch/x86/include/asm/hardirq.h    |   49 ++++++++++++++++++++++++++++++++++---
 arch/x86/include/asm/hardirq_32.h |   33 -------------------------
 arch/x86/include/asm/hardirq_64.h |   39 -----------------------------
 arch/x86/kernel/efi_64.c          |    1 +
 arch/x86/kernel/irq_64.c          |    1 +
 arch/x86/kernel/process_32.c      |    1 -
 6 files changed, 47 insertions(+), 77 deletions(-)

Patch tree reviewed and imported into the following git tree (sync seems slow today if it doesn't appear please pull directly from master)

git://git.kernel.org/pub/scm/linux/kernel/git/tj/misc.git tj-percpu

with the following changes.

* commit messages modified according to x86-ism
* added missing #include <asm/apic.h> to mce_intel_64.c for patch 0002

Thanks.

Signature · 1 line
tejun
#7 lore raw
Quoted 12 lines · Tejun Heo
Quoted 10 lines · Brian Gerst

This patch series merges the 32-bit and 64-bit hardirq.h headers and does several associated cleanups. Based on tip/core/percpu.

 arch/x86/include/asm/hardirq.h    |   49 ++++++++++++++++++++++++++++++++++---
 arch/x86/include/asm/hardirq_32.h |   33 -------------------------
 arch/x86/include/asm/hardirq_64.h |   39 -----------------------------
 arch/x86/kernel/efi_64.c          |    1 +
 arch/x86/kernel/irq_64.c          |    1 +
 arch/x86/kernel/process_32.c      |    1 -
 6 files changed, 47 insertions(+), 77 deletions(-)
Quoted 4 lines

Patch tree reviewed and imported into the following git tree (sync seems slow today if it doesn't appear please pull directly from master)

git://git.kernel.org/pub/scm/linux/kernel/git/tj/misc.git tj-percpu

Pulled into tip/core/percpu, thanks guys!

Ingo

#8 lore raw

PATCH 1/1 x86, xen: fix hardirq.h merge fallout

Find small 32-bit fixlet below.

Ingo

--------------->

Quoted 1 line

From 99d0000f710f3432182761f65f9658f1cf0bf455 Mon Sep 17 00:00:00 2001

From: Ingo Molnar <[email protected]>
Date: Fri, 23 Jan 2009 11:09:15 +0100
Subject: [PATCH] x86, xen: fix hardirq.h merge fallout

Impact: build fix

This build error:

arch/x86/xen/suspend.c:22: error: implicit declaration of function 'fix_to_virt' arch/x86/xen/suspend.c:22: error: 'FIX_PARAVIRT_BOOTMAP' undeclared (first use in this function) arch/x86/xen/suspend.c:22: error: (Each undeclared identifier is reported only once arch/x86/xen/suspend.c:22: error: for each function it appears in.)

triggers because the hardirq.h unification removed an implicit fixmap.h include - on which arch/x86/xen/suspend.c depended. Add the fixmap.h include explicitly.

---
 arch/x86/xen/suspend.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/x86/xen/suspend.c +1 -0
index 212ffe0..95be7b4 100644
@@ -6,6 +6,7 @@
 
 #include <asm/xen/hypercall.h>
 #include <asm/xen/page.h>
+#include <asm/fixmap.h>
 
 #include "xen-ops.h"
 #include "mmu.h"