2009-01-22 13:33:19

by Brian Gerst

[permalink] [raw]
Subject: [PATCH 0/5] 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


2009-01-22 13:33:46

by Brian Gerst

[permalink] [raw]
Subject: [PATCH 1/5] x86-32: Remove idle_timestamp

idle_timestamp is left over from the removed irqbalance code.

Signed-off-by: Brian Gerst <[email protected]>
---
arch/x86/include/asm/hardirq_32.h | 1 -
arch/x86/kernel/process_32.c | 1 -
2 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/hardirq_32.h b/arch/x86/include/asm/hardirq_32.h
index d4b5d73..a70ed05 100644
--- a/arch/x86/include/asm/hardirq_32.h
+++ b/arch/x86/include/asm/hardirq_32.h
@@ -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;
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 2c00a57..1a1ae8e 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -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();
--
1.6.1

2009-01-22 13:34:05

by Brian Gerst

[permalink] [raw]
Subject: [PATCH 2/5] x86-64: Remove include of apic.h from hardirq_64.h

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

Signed-off-by: Brian Gerst <[email protected]>
---
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(-)

diff --git a/arch/x86/include/asm/hardirq_64.h b/arch/x86/include/asm/hardirq_64.h
index a65bab2..873c3c7 100644
--- a/arch/x86/include/asm/hardirq_64.h
+++ b/arch/x86/include/asm/hardirq_64.h
@@ -3,7 +3,6 @@

#include <linux/threads.h>
#include <linux/irq.h>
-#include <asm/apic.h>

typedef struct {
unsigned int __softirq_pending;
diff --git a/arch/x86/kernel/efi_64.c b/arch/x86/kernel/efi_64.c
index 652c528..a4ee291 100644
--- a/arch/x86/kernel/efi_64.c
+++ b/arch/x86/kernel/efi_64.c
@@ -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;
diff --git a/arch/x86/kernel/irq_64.c b/arch/x86/kernel/irq_64.c
index 0b254de..018963a 100644
--- a/arch/x86/kernel/irq_64.c
+++ b/arch/x86/kernel/irq_64.c
@@ -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);
--
1.6.1

2009-01-22 13:34:29

by Brian Gerst

[permalink] [raw]
Subject: [PATCH 3/5] x86: Sync hardirq_{32,64}.h

In general, use the 64-bit version.

Signed-off-by: Brian Gerst <[email protected]>
---
arch/x86/include/asm/hardirq_32.h | 14 ++++++++++----
arch/x86/include/asm/hardirq_64.h | 10 +++++-----
2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/arch/x86/include/asm/hardirq_32.h b/arch/x86/include/asm/hardirq_32.h
index a70ed05..e5a332c 100644
--- a/arch/x86/include/asm/hardirq_32.h
+++ b/arch/x86/include/asm/hardirq_32.h
@@ -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 */
diff --git a/arch/x86/include/asm/hardirq_64.h b/arch/x86/include/asm/hardirq_64.h
index 873c3c7..392e7d6 100644
--- a/arch/x86/include/asm/hardirq_64.h
+++ b/arch/x86/include/asm/hardirq_64.h
@@ -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);

--
1.6.1

2009-01-22 13:34:48

by Brian Gerst

[permalink] [raw]
Subject: [PATCH 4/5] x86: Merge hardirq_{32,64}.h into hardirq.h

Signed-off-by: Brian Gerst <[email protected]>
---
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

diff --git a/arch/x86/include/asm/hardirq.h b/arch/x86/include/asm/hardirq.h
index 000787d..f4a95f2 100644
--- a/arch/x86/include/asm/hardirq.h
+++ b/arch/x86/include/asm/hardirq.h
@@ -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 */
diff --git a/arch/x86/include/asm/hardirq_32.h b/arch/x86/include/asm/hardirq_32.h
deleted file mode 100644
index e5a332c..0000000
--- a/arch/x86/include/asm/hardirq_32.h
+++ /dev/null
@@ -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 */
diff --git a/arch/x86/include/asm/hardirq_64.h b/arch/x86/include/asm/hardirq_64.h
deleted file mode 100644
index 392e7d6..0000000
--- a/arch/x86/include/asm/hardirq_64.h
+++ /dev/null
@@ -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 */
--
1.6.1

2009-01-22 13:35:07

by Brian Gerst

[permalink] [raw]
Subject: [PATCH 5/5] x86: make irq_cpustat_t fields conditional.

Signed-off-by: Brian Gerst <[email protected]>
---
arch/x86/include/asm/hardirq.h | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/hardirq.h b/arch/x86/include/asm/hardirq.h
index f4a95f2..176f058 100644
--- a/arch/x86/include/asm/hardirq.h
+++ b/arch/x86/include/asm/hardirq.h
@@ -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);
--
1.6.1

2009-01-23 02:09:33

by Tejun Heo

[permalink] [raw]
Subject: Re: [PATCH 0/5] x86: Merge hardirq.h

Brian Gerst wrote:
> 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.

--
tejun

2009-01-23 09:17:24

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH 0/5] x86: Merge hardirq.h


* Tejun Heo <[email protected]> wrote:

> Brian Gerst wrote:
> > 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

Pulled into tip/core/percpu, thanks guys!

Ingo

2009-01-23 10:02:06

by Ingo Molnar

[permalink] [raw]
Subject: [PATCH] x86, xen: fix hardirq.h merge fallout


Find small 32-bit fixlet below.

Ingo

--------------->
>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.

Signed-off-by: Ingo Molnar <[email protected]>
---
arch/x86/xen/suspend.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/x86/xen/suspend.c b/arch/x86/xen/suspend.c
index 212ffe0..95be7b4 100644
--- a/arch/x86/xen/suspend.c
+++ b/arch/x86/xen/suspend.c
@@ -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"