[PATCH] x86: apic - unify lapic_resume - fix

Previous thread: [PATCH] Fix i486 suspend to disk CR4 oops by David Fries on Sunday, August 17, 2008 - 9:03 pm. (26 messages)

Next thread: [PATCH 1/2] Remove deprecated stop_machine_run: fix Xen by Rusty Russell on Sunday, August 17, 2008 - 9:14 pm. (2 messages)
From: Yinghai Lu
Date: Sunday, August 17, 2008 - 9:12 pm

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>

diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index 1b0baf5..7fb7dca 100644
--- a/arch/x86/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
@@ -1448,6 +1448,7 @@ static int lapic_resume(struct sys_device *dev)
 		enable_x2apic();
 	else
 #endif
+	{
 		/*
 		 * Make sure the APICBASE points to the right address
 		 *
@@ -1458,6 +1459,7 @@ static int lapic_resume(struct sys_device *dev)
 		l &= ~MSR_IA32_APICBASE_BASE;
 		l |= MSR_IA32_APICBASE_ENABLE | mp_lapic_addr;
 		wrmsr(MSR_IA32_APICBASE, l, h);
+	}
 
 	apic_write(APIC_LVTERR, ERROR_APIC_VECTOR | APIC_LVT_MASKED);
 	apic_write(APIC_ID, apic_pm_state.apic_id);
--

From: Yinghai Lu
Date: Sunday, August 17, 2008 - 9:12 pm

Ingo said sparse_irq is some intrusive. need to make it selectable

to make it simple, remove irq_desc as parameter in some functions.
(ack, eoi, set_affinity).
may need to make member if irq_chip to take irq_desc, or struct irq later.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
 arch/Kconfig              |    3 -
 arch/x86/Kconfig          |   12 ++++
 arch/x86/kernel/io_apic.c |  124 ++++++++++++++++++++++++++++++----------------
 arch/x86/kernel/irq_32.c  |    2 
 arch/x86/kernel/irq_64.c  |    4 -
 include/linux/irq.h       |   12 ----
 kernel/irq/chip.c         |   26 ---------
 kernel/irq/handle.c       |   34 +-----------
 kernel/irq/manage.c       |    8 --
 kernel/irq/migration.c    |    8 --
 10 files changed, 103 insertions(+), 130 deletions(-)

Index: linux-2.6/arch/Kconfig
===================================================================
--- linux-2.6.orig/arch/Kconfig
+++ linux-2.6/arch/Kconfig
@@ -106,6 +106,3 @@ config HAVE_CLK
 config HAVE_DYN_ARRAY
 	def_bool n
 
-config HAVE_SPARSE_IRQ
-	def_bool n
-
Index: linux-2.6/arch/x86/Kconfig
===================================================================
--- linux-2.6.orig/arch/x86/Kconfig
+++ linux-2.6/arch/x86/Kconfig
@@ -34,7 +34,6 @@ config X86
 	select HAVE_GENERIC_DMA_COHERENT if X86_32
 	select HAVE_EFFICIENT_UNALIGNED_ACCESS
 	select HAVE_DYN_ARRAY
-	select HAVE_SPARSE_IRQ
 
 config ARCH_DEFCONFIG
 	string
@@ -241,6 +240,17 @@ config SMP
 
 	  If you don't know what to do here, say N.
 
+config HAVE_SPARSE_IRQ
+	bool "Support sparse irq numbering"
+	depends on PCI_MSI || HT_IRQ
+	default y
+	help
+	  This enables support for sparse irq, esp for msi/msi-x. the irq
+	  number will be bus/dev/fn + 12bit. You may need if you have lots of
+	  cards supports msi-x installed.
+
+	  If you don't know what to do here, say Y.
+
 config X86_FIND_SMP_CONFIG
 	def_bool y
 	depends on X86_MPPARSE || X86_VOYAGER
Index: ...
From: Yinghai Lu
Date: Sunday, August 17, 2008 - 9:12 pm

So could revert back to use irq_desc[] for other arch except x86

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>

---
 arch/alpha/kernel/irq.c                     |   21 +--
 arch/alpha/kernel/irq_alpha.c               |    7 -
 arch/alpha/kernel/irq_i8259.c               |    8 -
 arch/alpha/kernel/irq_pyxis.c               |    9 -
 arch/alpha/kernel/irq_srm.c                 |    9 -
 arch/alpha/kernel/sys_alcor.c               |    9 -
 arch/alpha/kernel/sys_cabriolet.c           |    8 -
 arch/alpha/kernel/sys_dp264.c               |    9 -
 arch/alpha/kernel/sys_eb64p.c               |    8 -
 arch/alpha/kernel/sys_eiger.c               |    7 -
 arch/alpha/kernel/sys_jensen.c              |   50 ++++-----
 arch/alpha/kernel/sys_marvel.c              |   20 +--
 arch/alpha/kernel/sys_mikasa.c              |    8 -
 arch/alpha/kernel/sys_noritake.c            |    8 -
 arch/alpha/kernel/sys_rawhide.c             |    8 -
 arch/alpha/kernel/sys_rx164.c               |    8 -
 arch/alpha/kernel/sys_sable.c               |    8 -
 arch/alpha/kernel/sys_takara.c              |    8 -
 arch/alpha/kernel/sys_titan.c               |    8 -
 arch/alpha/kernel/sys_wildfire.c            |   19 +--
 arch/arm/common/gic.c                       |    2 
 arch/arm/common/it8152.c                    |    2 
 arch/arm/common/locomo.c                    |   16 +--
 arch/arm/common/sa1111.c                    |    4 
 arch/arm/kernel/ecard.c                     |    4 
 arch/arm/kernel/irq.c                       |    8 -
 arch/arm/mach-at91/gpio.c                   |    4 
 arch/arm/mach-davinci/gpio.c                |   13 --
 arch/arm/mach-ep93xx/core.c                 |   12 +-
 arch/arm/mach-footbridge/isa-irq.c          |    2 
 arch/arm/mach-h720x/common.c                |    2 
 arch/arm/mach-h720x/cpu-h7202.c             |    2 
 arch/arm/mach-imx/irq.c                     |    2 
 arch/arm/mach-integrator/integrator_cp.c    |    2 
 arch/arm/mach-iop13xx/msi.c             ...
From: Ingo Molnar
Date: Monday, August 18, 2008 - 12:37 am

great!

could we get rid of the remaining non-x86 arch changes too, please? 

- __do_IRQ(): why is the change needed? Architectures that want to use 
  sparse IRQs should first properly convert to genirq (i.e. should get 
  rid of their __do_IRQ() use).

- kstat_cpu / kstat_irqs_cpu: seems unnecessary now?

- create_irq prototype return value change: cannot we limit the irq 
  space to 0..INT_MAX, and leave the prototype alone?

- create_irq(int) argument change: how about introducing a new 
  create_irq_nr(int) variant, while the create_irq(void) function would 
  just call create_irq_nr(0) ?

	Ingo

diff --git a/arch/alpha/kernel/irq.c b/arch/alpha/kernel/irq.c
index c626a82..b5348ae 100644
--- a/arch/alpha/kernel/irq.c
+++ b/arch/alpha/kernel/irq.c
@@ -89,7 +89,7 @@ show_interrupts(struct seq_file *p, void *v)
 		seq_printf(p, "%10u ", kstat_irqs(irq));
 #else
 		for_each_online_cpu(j)
-			seq_printf(p, "%10u ", kstat_cpu(j).irqs[irq]);
+			seq_printf(p, "%10u ", kstat_irqs_cpu(irq, j));
 #endif
 		seq_printf(p, " %14s", irq_desc[irq].chip->typename);
 		seq_printf(p, "  %c%s",
@@ -156,6 +156,6 @@ handle_irq(int irq)
 	 * at IPL 0.
 	 */
 	local_irq_disable();
-	__do_IRQ(irq);
+	__do_IRQ(irq, &irq_desc[irq]);
 	irq_exit();
 }
diff --git a/arch/alpha/kernel/irq_alpha.c b/arch/alpha/kernel/irq_alpha.c
index e16aeb6..2c0852c 100644
--- a/arch/alpha/kernel/irq_alpha.c
+++ b/arch/alpha/kernel/irq_alpha.c
@@ -64,7 +64,7 @@ do_entInt(unsigned long type, unsigned long vector,
 		smp_percpu_timer_interrupt(regs);
 		cpu = smp_processor_id();
 		if (cpu != boot_cpuid) {
-		        kstat_cpu(cpu).irqs[RTC_IRQ]++;
+			irq_desc[RTC_IRQ].kstat_irqs[cpu]++;
 		} else {
 			handle_irq(RTC_IRQ);
 		}
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
index f88efb1..26a1185 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -69,22 +69,24 @@ int show_interrupts(struct seq_file *p, void *v)
 	}
 
 	if (i < NR_IRQS) ...
From: Yinghai Lu
Date: Monday, August 18, 2008 - 11:14 am

will send out another patch later

YH
From: Ingo Molnar
Date: Monday, August 18, 2008 - 12:25 am

applied to tip/x86/apic, thanks.

	Ingo
--

Previous thread: [PATCH] Fix i486 suspend to disk CR4 oops by David Fries on Sunday, August 17, 2008 - 9:03 pm. (26 messages)

Next thread: [PATCH 1/2] Remove deprecated stop_machine_run: fix Xen by Rusty Russell on Sunday, August 17, 2008 - 9:14 pm. (2 messages)