Skip to contentSkip to conversation

tick-common.c hack for s390 needed

PATCH Applied Heiko Carstens 6 participants 13 messages Mar 18, 2008 – Apr 1, 2008

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

Hi Thomas, Ingo,

I'm converting s390 from s390's NO_IDLE_HZ to GENERIC_CLOCKEVENTS and therefore to the generic NO_HZ implementation.
One of the problems that need a patch for this is kernel/time/tick-common.c which relies on the irq stuff present in include/linux/irq.h. In particular s390 doesn't have something like irq_set_affinity which causes this build error:

CC kernel/time/tick-common.o
kernel/time/tick-common.c: In function 'tick_periodic':
kernel/time/tick-common.c:70: error: implicit declaration of function 'get_irq_regs' kernel/time/tick-common.c:70: error: invalid type argument of '->' (have 'int') kernel/time/tick-common.c: In function 'tick_setup_device':
kernel/time/tick-common.c:171: error: implicit declaration of function 'irq_set_affinity' kernel/time/tick-common.c: In function 'tick_check_new_device':
kernel/time/tick-common.c:216: error: implicit declaration of function 'irq_can_set_affinity'

Actually there's a huge #ifndef CONFIG_S390 in linux/irq.h ;)

To make the code work the patch below is necessary. It's ok since all clock event devices on s390 are per cpu. However I think this patch is ugly at best. Any ideas how to fix this in a better and more generic way?

---
 kernel/time/tick-common.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
kernel/time/tick-common.c +5 -2
Index: linux-2.6/kernel/time/tick-common.c
===================================================================
@@ -19,6 +19,7 @@
 #include <linux/profile.h>
 #include <linux/sched.h>
 #include <linux/tick.h>
+#include <asm/irq_regs.h>
 
 #include "tick-internal.h"
 
@@ -167,9 +168,10 @@ static void tick_setup_device(struct tic
 	 * When the device is not per cpu, pin the interrupt to the
 	 * current cpu:
 	 */
+#ifndef CONFIG_S390
 	if (!cpus_equal(newdev->cpumask, cpumask))
 		irq_set_affinity(newdev->irq, cpumask);
-
+#endif
 	/*
 	 * When global broadcasting is active, check if the current
 	 * device is registered as a placeholder for broadcast mode.
@@ -213,9 +215,10 @@ static int tick_check_new_device(struct 
 		 * If the cpu affinity of the device interrupt can not
 		 * be set, ignore it.
 		 */
+#ifndef CONFIG_S390
 		if (!irq_can_set_affinity(newdev->irq))
 			goto out_bc;
-
+#endif
 		/*
 		 * If we have a cpu local device already, do not replace it
 		 * by a non cpu local device
#1 lore raw
Quoted 8 lines · Heiko Carstens

Hi Thomas, Ingo,

I'm converting s390 from s390's NO_IDLE_HZ to GENERIC_CLOCKEVENTS and therefore to the generic NO_HZ implementation.
One of the problems that need a patch for this is kernel/time/tick-common.c which relies on the irq stuff present in include/linux/irq.h. In particular s390 doesn't have something like irq_set_affinity which causes this build error:

Generic code must never use linux/irq.h - it's more like asm-generic file predating asm-generic.

#2 lore raw
Quoted 10 lines · Christoph Hellwig
Quoted 8 lines · Heiko Carstens

Hi Thomas, Ingo,

I'm converting s390 from s390's NO_IDLE_HZ to GENERIC_CLOCKEVENTS and therefore to the generic NO_HZ implementation.
One of the problems that need a patch for this is kernel/time/tick-common.c which relies on the irq stuff present in include/linux/irq.h. In particular s390 doesn't have something like irq_set_affinity which causes this build error:

Quoted 2 lines

Generic code must never use linux/irq.h - it's more like asm-generic file predating asm-generic.

agreed.

Heiko, if you remove all these:

./time/tick-broadcast.c:#include <linux/irq.h>
./time/tick-oneshot.c:#include <linux/irq.h>
./time/tick-common.c:#include <linux/irq.h>
./hrtimer.c:#include <linux/irq.h>

from kernel/*, do things improve on s390? If yes then please send a patch for it and i'll check whether there's any include file dependency fallout on x86.

Ingo

#3 lore raw
Quoted 20 lines · Ingo Molnar
Quoted 10 lines · Christoph Hellwig
Quoted 8 lines · Heiko Carstens

Hi Thomas, Ingo,

I'm converting s390 from s390's NO_IDLE_HZ to GENERIC_CLOCKEVENTS and therefore to the generic NO_HZ implementation.
One of the problems that need a patch for this is kernel/time/tick-common.c which relies on the irq stuff present in include/linux/irq.h. In particular s390 doesn't have something like irq_set_affinity which causes this build error:

Quoted 2 lines

Generic code must never use linux/irq.h - it's more like asm-generic file predating asm-generic.

agreed.

Heiko, if you remove all these:

Quoted 8 lines

./time/tick-broadcast.c:#include <linux/irq.h>
./time/tick-oneshot.c:#include <linux/irq.h>
./time/tick-common.c:#include <linux/irq.h>
./hrtimer.c:#include <linux/irq.h>

from kernel/*, do things improve on s390? If yes then please send a patch for it and i'll check whether there's any include file dependency fallout on x86.

No, tick-common.c has calls to irq_set_affinity and irq_can_set_affinity, for which the prototypes are in linux/irq.h.
Each and every architecture seems to include linux/irq.h from a different file in asm-[your-favourite-arch]/*.h. I was able to fix the build breakage on x86 by adding an include <linux/interrupt.h>. But that won't work on other architectures.

Quoted 1 line

From a logical point of view I would expect that asm/irq.h is supposed to

include linux/irq.h, no?

The patch below removes at least three of the includes for a beginning. Still compiles on s390 and x86_64.

Subject: [PATCH] time: remove include/irq.h.

From: Heiko Carstens <[email protected]>

Generic code is not supposed to include linux/irq.h.

---

 kernel/hrtimer.c             |    1 -
 kernel/time/tick-broadcast.c |    1 -
 kernel/time/tick-oneshot.c   |    1 -
 3 files changed, 3 deletions(-)
kernel/hrtimer.c +0 -1
Index: linux-2.6/kernel/hrtimer.c
===================================================================
@@ -32,7 +32,6 @@
  */
 
 #include <linux/cpu.h>
-#include <linux/irq.h>
 #include <linux/module.h>
 #include <linux/percpu.h>
 #include <linux/hrtimer.h>
kernel/time/tick-broadcast.c +0 -1
Index: linux-2.6/kernel/time/tick-broadcast.c
===================================================================
@@ -14,7 +14,6 @@
 #include <linux/cpu.h>
 #include <linux/err.h>
 #include <linux/hrtimer.h>
-#include <linux/irq.h>
 #include <linux/percpu.h>
 #include <linux/profile.h>
 #include <linux/sched.h>
kernel/time/tick-oneshot.c +0 -1
Index: linux-2.6/kernel/time/tick-oneshot.c
===================================================================
@@ -14,7 +14,6 @@
 #include <linux/cpu.h>
 #include <linux/err.h>
 #include <linux/hrtimer.h>
-#include <linux/irq.h>
 #include <linux/percpu.h>
 #include <linux/profile.h>
 #include <linux/sched.h>
#4 lore raw
Quoted 11 lines · Heiko Carstens

The patch below removes at least three of the includes for a beginning. Still compiles on s390 and x86_64.

Subject: [PATCH] time: remove include/irq.h.

From: Heiko Carstens <[email protected]>

Generic code is not supposed to include linux/irq.h.

Applied, thanks,

tglx

#5 lore raw
Quoted 7 lines · Thomas Gleixner
Quoted 6 lines · Heiko Carstens

The patch below removes at least three of the includes for a beginning. Still compiles on s390 and x86_64.

Subject: [PATCH] time: remove include/irq.h.

Quoted 7 lines
Quoted 5 lines

From: Heiko Carstens <[email protected]>

Generic code is not supposed to include linux/irq.h.

Applied, thanks,

And here comes the second part...

Subject: [PATCH] time: remove include/irq.h from tick-common.c

From: Heiko Carstens <[email protected]>

Generic code is not supposed to include irq.h. Replace this include by linux/hardirq.h instead and add/replace an include of linux/irq.h in asm header files where necessary.
This change should only matter for architectures that make use of GENERIC_CLOCKEVENTS.
Architectures in question are mips, x86, arm, sh, powerpc, uml and sparc64.

I did some cross compile tests for mips, x86_64, arm, powerpc and sparc64. This patch fixes also build breakages caused by the include replacement in tick-common.h.

I didn't test uml and sh.

---
 include/asm-arm/hardirq.h     |    2 +-
 include/asm-powerpc/hardirq.h |    2 +-
 include/asm-sparc64/hardirq.h |    1 +
 include/asm-sparc64/irq.h     |    1 -
 kernel/time/tick-common.c     |    2 +-
 5 files changed, 4 insertions(+), 4 deletions(-)
include/asm-arm/hardirq.h +1 -1
Index: linux-2.6/include/asm-arm/hardirq.h
===================================================================
@@ -3,7 +3,7 @@
 
 #include <linux/cache.h>
 #include <linux/threads.h>
-#include <asm/irq.h>
+#include <linux/irq.h>
 
 typedef struct {
 	unsigned int __softirq_pending;
include/asm-powerpc/hardirq.h +1 -1
Index: linux-2.6/include/asm-powerpc/hardirq.h
===================================================================
@@ -2,7 +2,7 @@
 #define _ASM_POWERPC_HARDIRQ_H
 #ifdef __KERNEL__
 
-#include <asm/irq.h>
+#include <linux/irq.h>
 #include <asm/bug.h>
 
 /* The __last_jiffy_stamp field is needed to ensure that no decrementer
include/asm-sparc64/hardirq.h +1 -0
Index: linux-2.6/include/asm-sparc64/hardirq.h
===================================================================
@@ -6,6 +6,7 @@
 #ifndef __SPARC64_HARDIRQ_H
 #define __SPARC64_HARDIRQ_H
 
+#include <linux/irq.h>
 #include <asm/cpudata.h>
 
 #define __ARCH_IRQ_STAT
kernel/time/tick-common.c +1 -1
Index: linux-2.6/kernel/time/tick-common.c
===================================================================
@@ -14,7 +14,7 @@
 #include <linux/cpu.h>
 #include <linux/err.h>
 #include <linux/hrtimer.h>
-#include <linux/irq.h>
+#include <linux/hardirq.h>
 #include <linux/percpu.h>
 #include <linux/profile.h>
 #include <linux/sched.h>
include/asm-sparc64/irq.h +0 -1
Index: linux-2.6/include/asm-sparc64/irq.h
===================================================================
@@ -10,7 +10,6 @@
 #include <linux/linkage.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
-#include <linux/interrupt.h>
 #include <asm/pil.h>
 #include <asm/ptrace.h>
 
#6 lore raw
Quoted 10 lines · Heiko Carstens

Generic code is not supposed to include irq.h. Replace this include by linux/hardirq.h instead and add/replace an include of linux/irq.h in asm header files where necessary.
This change should only matter for architectures that make use of GENERIC_CLOCKEVENTS.
Architectures in question are mips, x86, arm, sh, powerpc, uml and sparc64.

I did some cross compile tests for mips, x86_64, arm, powerpc and sparc64. This patch fixes also build breakages caused by the include replacement in tick-common.h.

I generally dislike adding optional linux/* includes in asm/* includes - I'm nervous about this causing include loops.

However, there's a separate point to be discussed here.

That is, what interfaces are expected of every architecture in the kernel. If generic code wants to be able to set the affinity of interrupts, then that needs to become part of the interfaces listed in linux/interrupt.h rather than linux/irq.h.

So what I suggest is this approach instead (against Linus' tree of a couple of days ago) - we move irq_set_affinity() and irq_can_set_affinity() to linux/interrupt.h, change the linux/irq.h includes to linux/interrupt.h and include asm/irq_regs.h where needed (asm/irq_regs.h is supposed to be rarely used include since not much touches the stacked parent context registers.)

Build tested on ARM PXA family kernels and ARM's Realview platform kernels which both use genirq.

include/linux/interrupt.h +19 -0
index f8ab4ce..355e3b0 100644
@@ -102,6 +102,25 @@ extern void disable_irq_nosync(unsigned int irq);
 extern void disable_irq(unsigned int irq);
 extern void enable_irq(unsigned int irq);
 
+#ifdef CONFIG_SMP
+
+extern int irq_set_affinity(unsigned int irq, cpumask_t cpumask);
+extern int irq_can_set_affinity(unsigned int irq);
+
+#else /* CONFIG_SMP */
+
+static inline int irq_set_affinity(unsigned int irq, cpumask_t cpumask)
+{
+	return -EINVAL;
+}
+
+static inline int irq_can_set_affinity(unsigned int irq)
+{
+	return 0;
+}
+
+#endif /* CONFIG_SMP */
+
 #ifdef CONFIG_GENERIC_HARDIRQS
 /*
  * Special lockdep variants of irq disabling/enabling.
include/linux/irq.h +0 -10
index 176e5e7..1883a85 100644
@@ -228,21 +228,11 @@ static inline void set_pending_irq(unsigned int irq, cpumask_t mask)
 
 #endif /* CONFIG_GENERIC_PENDING_IRQ */
 
-extern int irq_set_affinity(unsigned int irq, cpumask_t cpumask);
-extern int irq_can_set_affinity(unsigned int irq);
-
 #else /* CONFIG_SMP */
 
 #define move_native_irq(x)
 #define move_masked_irq(x)
 
-static inline int irq_set_affinity(unsigned int irq, cpumask_t cpumask)
-{
-	return -EINVAL;
-}
-
-static inline int irq_can_set_affinity(unsigned int irq) { return 0; }
-
 #endif /* CONFIG_SMP */
 
 #ifdef CONFIG_IRQBALANCE
kernel/time/tick-broadcast.c +1 -1
index e1bd50c..fdfa0c7 100644
@@ -14,7 +14,7 @@
 #include <linux/cpu.h>
 #include <linux/err.h>
 #include <linux/hrtimer.h>
-#include <linux/irq.h>
+#include <linux/interrupt.h>
 #include <linux/percpu.h>
 #include <linux/profile.h>
 #include <linux/sched.h>
kernel/time/tick-common.c +3 -1
index 1bea399..4f38865 100644
@@ -14,12 +14,14 @@
 #include <linux/cpu.h>
 #include <linux/err.h>
 #include <linux/hrtimer.h>
-#include <linux/irq.h>
+#include <linux/interrupt.h>
 #include <linux/percpu.h>
 #include <linux/profile.h>
 #include <linux/sched.h>
 #include <linux/tick.h>
 
+#include <asm/irq_regs.h>
+
 #include "tick-internal.h"
 
 /*
kernel/time/tick-oneshot.c +1 -1
index 0258d31..450c049 100644
@@ -14,7 +14,7 @@
 #include <linux/cpu.h>
 #include <linux/err.h>
 #include <linux/hrtimer.h>
-#include <linux/irq.h>
+#include <linux/interrupt.h>
 #include <linux/percpu.h>
 #include <linux/profile.h>
 #include <linux/sched.h>
Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:
#7 lore raw
Quoted 15 lines · Russell King
Quoted 10 lines · Heiko Carstens

Generic code is not supposed to include irq.h. Replace this include by linux/hardirq.h instead and add/replace an include of linux/irq.h in asm header files where necessary.
This change should only matter for architectures that make use of GENERIC_CLOCKEVENTS.
Architectures in question are mips, x86, arm, sh, powerpc, uml and sparc64.

I did some cross compile tests for mips, x86_64, arm, powerpc and sparc64. This patch fixes also build breakages caused by the include replacement in tick-common.h.

I generally dislike adding optional linux/* includes in asm/* includes - I'm nervous about this causing include loops.

Quoted 6 lines

However, there's a separate point to be discussed here.

That is, what interfaces are expected of every architecture in the kernel. If generic code wants to be able to set the affinity of interrupts, then that needs to become part of the interfaces listed in linux/interrupt.h rather than linux/irq.h.

Every architecture besides one... as usual :/

Quoted 17 lines
include/linux/interrupt.h +9 -0
index f8ab4ce..355e3b0 100644
@@ -102,6 +102,25 @@ extern void disable_irq_nosync(unsigned int irq);
 extern void disable_irq(unsigned int irq);
 extern void enable_irq(unsigned int irq);
 
+#ifdef CONFIG_SMP
+
+extern int irq_set_affinity(unsigned int irq, cpumask_t cpumask);
+extern int irq_can_set_affinity(unsigned int irq);
+
+#else /* CONFIG_SMP */
+
+static inline int irq_set_affinity(unsigned int irq, cpumask_t cpumask)
+{

include/linux/interrupt.h extern void disable_irq_nosync(unsigned int irq); · line 123

Quoted 10 lines
include/linux/interrupt.h +10 -0
+	return -EINVAL;
+}
+
+static inline int irq_can_set_affinity(unsigned int irq)
+{
+	return 0;
+}
+
+#endif /* CONFIG_SMP */
+

Could you add something like

#ifdef CONFIG_GENERIC_HARDIRQS

/* added stuff from above */

#else /* CONFIG_GENERIC_HARDIRQS */

static inline int irq_set_affinity(unsigned int irq, cpumask_t cpumask)

{
	WARN_ON(1);
	return -EINVAL;
}

static inline int irq_can_set_affinity(unsigned int irq)

{
	return 0;
}

#endif /* CONFIG_GENERIC_HARDIRQS */

Then it should do the right thing on s390 as well.

#8 lore raw
In reply to Russell King
Quoted 22 lines · Russell King
Quoted 10 lines · Heiko Carstens

Generic code is not supposed to include irq.h. Replace this include by linux/hardirq.h instead and add/replace an include of linux/irq.h in asm header files where necessary.
This change should only matter for architectures that make use of GENERIC_CLOCKEVENTS.
Architectures in question are mips, x86, arm, sh, powerpc, uml and sparc64.

I did some cross compile tests for mips, x86_64, arm, powerpc and sparc64. This patch fixes also build breakages caused by the include replacement in tick-common.h.

I generally dislike adding optional linux/* includes in asm/* includes - I'm nervous about this causing include loops.

However, there's a separate point to be discussed here.

That is, what interfaces are expected of every architecture in the kernel. If generic code wants to be able to set the affinity of interrupts, then that needs to become part of the interfaces listed in linux/interrupt.h rather than linux/irq.h.

Quoted 6 lines

So what I suggest is this approach instead (against Linus' tree of a couple of days ago) - we move irq_set_affinity() and irq_can_set_affinity() to linux/interrupt.h, change the linux/irq.h includes to linux/interrupt.h and include asm/irq_regs.h where needed (asm/irq_regs.h is supposed to be rarely used include since not much touches the stacked parent context registers.)

That patch makes a lot of sense and resolves all the issues.

I push it through hrt.git and add the GENERIC_HARDIRQS dependency which was requested by Heiko.

Thanks,

tglx

Quoted 112 lines

Build tested on ARM PXA family kernels and ARM's Realview platform kernels which both use genirq.

include/linux/interrupt.h +19 -0
index f8ab4ce..355e3b0 100644
@@ -102,6 +102,25 @@ extern void disable_irq_nosync(unsigned int irq);
 extern void disable_irq(unsigned int irq);
 extern void enable_irq(unsigned int irq);
 
+#ifdef CONFIG_SMP
+
+extern int irq_set_affinity(unsigned int irq, cpumask_t cpumask);
+extern int irq_can_set_affinity(unsigned int irq);
+
+#else /* CONFIG_SMP */
+
+static inline int irq_set_affinity(unsigned int irq, cpumask_t cpumask)
+{
+	return -EINVAL;
+}
+
+static inline int irq_can_set_affinity(unsigned int irq)
+{
+	return 0;
+}
+
+#endif /* CONFIG_SMP */
+
 #ifdef CONFIG_GENERIC_HARDIRQS
 /*
  * Special lockdep variants of irq disabling/enabling.
include/linux/irq.h +0 -10
index 176e5e7..1883a85 100644
@@ -228,21 +228,11 @@ static inline void set_pending_irq(unsigned int irq, cpumask_t mask)
 
 #endif /* CONFIG_GENERIC_PENDING_IRQ */
 
-extern int irq_set_affinity(unsigned int irq, cpumask_t cpumask);
-extern int irq_can_set_affinity(unsigned int irq);
-
 #else /* CONFIG_SMP */
 
 #define move_native_irq(x)
 #define move_masked_irq(x)
 
-static inline int irq_set_affinity(unsigned int irq, cpumask_t cpumask)
-{
-	return -EINVAL;
-}
-
-static inline int irq_can_set_affinity(unsigned int irq) { return 0; }
-
 #endif /* CONFIG_SMP */
 
 #ifdef CONFIG_IRQBALANCE
kernel/time/tick-broadcast.c +1 -1
index e1bd50c..fdfa0c7 100644
@@ -14,7 +14,7 @@
 #include <linux/cpu.h>
 #include <linux/err.h>
 #include <linux/hrtimer.h>
-#include <linux/irq.h>
+#include <linux/interrupt.h>
 #include <linux/percpu.h>
 #include <linux/profile.h>
 #include <linux/sched.h>
kernel/time/tick-common.c +3 -1
index 1bea399..4f38865 100644
@@ -14,12 +14,14 @@
 #include <linux/cpu.h>
 #include <linux/err.h>
 #include <linux/hrtimer.h>
-#include <linux/irq.h>
+#include <linux/interrupt.h>
 #include <linux/percpu.h>
 #include <linux/profile.h>
 #include <linux/sched.h>
 #include <linux/tick.h>
 
+#include <asm/irq_regs.h>
+
 #include "tick-internal.h"
 
 /*
kernel/time/tick-oneshot.c +1 -1
index 0258d31..450c049 100644
@@ -14,7 +14,7 @@
 #include <linux/cpu.h>
 #include <linux/err.h>
 #include <linux/hrtimer.h>
-#include <linux/irq.h>
+#include <linux/interrupt.h>
 #include <linux/percpu.h>
 #include <linux/profile.h>
 #include <linux/sched.h>
Signature · 4 lines
-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:
#9 lore raw
Quoted 31 lines · Thomas Gleixner
Quoted 22 lines · Russell King
Quoted 10 lines · Heiko Carstens

Generic code is not supposed to include irq.h. Replace this include by linux/hardirq.h instead and add/replace an include of linux/irq.h in asm header files where necessary.
This change should only matter for architectures that make use of GENERIC_CLOCKEVENTS.
Architectures in question are mips, x86, arm, sh, powerpc, uml and sparc64.

I did some cross compile tests for mips, x86_64, arm, powerpc and sparc64. This patch fixes also build breakages caused by the include replacement in tick-common.h.

I generally dislike adding optional linux/* includes in asm/* includes - I'm nervous about this causing include loops.

However, there's a separate point to be discussed here.

That is, what interfaces are expected of every architecture in the kernel. If generic code wants to be able to set the affinity of interrupts, then that needs to become part of the interfaces listed in linux/interrupt.h rather than linux/irq.h.

Quoted 6 lines

So what I suggest is this approach instead (against Linus' tree of a couple of days ago) - we move irq_set_affinity() and irq_can_set_affinity() to linux/interrupt.h, change the linux/irq.h includes to linux/interrupt.h and include asm/irq_regs.h where needed (asm/irq_regs.h is supposed to be rarely used include since not much touches the stacked parent context registers.)

Quoted 4 lines

That patch makes a lot of sense and resolves all the issues.

I push it through hrt.git and add the GENERIC_HARDIRQS dependency which was requested by Heiko.

Okay. Signed-off-by: Russell King <[email protected]>

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:
#10 lore raw
In reply to Thomas Gleixner
Quoted 31 lines · Thomas Gleixner
Quoted 22 lines · Russell King
Quoted 10 lines · Heiko Carstens

Generic code is not supposed to include irq.h. Replace this include by linux/hardirq.h instead and add/replace an include of linux/irq.h in asm header files where necessary.
This change should only matter for architectures that make use of GENERIC_CLOCKEVENTS.
Architectures in question are mips, x86, arm, sh, powerpc, uml and sparc64.

I did some cross compile tests for mips, x86_64, arm, powerpc and sparc64. This patch fixes also build breakages caused by the include replacement in tick-common.h.

I generally dislike adding optional linux/* includes in asm/* includes - I'm nervous about this causing include loops.

However, there's a separate point to be discussed here.

That is, what interfaces are expected of every architecture in the kernel. If generic code wants to be able to set the affinity of interrupts, then that needs to become part of the interfaces listed in linux/interrupt.h rather than linux/irq.h.

Quoted 6 lines

So what I suggest is this approach instead (against Linus' tree of a couple of days ago) - we move irq_set_affinity() and irq_can_set_affinity() to linux/interrupt.h, change the linux/irq.h includes to linux/interrupt.h and include asm/irq_regs.h where needed (asm/irq_regs.h is supposed to be rarely used include since not much touches the stacked parent context registers.)

Quoted 4 lines

That patch makes a lot of sense and resolves all the issues.

I push it through hrt.git and add the GENERIC_HARDIRQS dependency which was requested by Heiko.

Thomas, would you mind if we push this patch via git-s390?
As far as I can see s390 is the only architecture which has a dependency on this patch. This would make merging our NO_IDLE_HZ to GENERIC_CLOCKEVENTS conversion easier.
I'd take the version you have in your mm branch in your hrt tree, if you're ok with this.

#11 lore raw
Quoted 11 lines · Heiko Carstens
Quoted 4 lines

That patch makes a lot of sense and resolves all the issues.

I push it through hrt.git and add the GENERIC_HARDIRQS dependency which was requested by Heiko.

Thomas, would you mind if we push this patch via git-s390?
As far as I can see s390 is the only architecture which has a dependency on this patch. This would make merging our NO_IDLE_HZ to GENERIC_CLOCKEVENTS conversion easier.
I'd take the version you have in your mm branch in your hrt tree, if you're ok with this.

Ok, I drop it.

Thanks,
tglx

#12 lore raw
In reply to Heiko Carstens
Quoted 5 lines · Heiko Carstens

Actually there's a huge #ifndef CONFIG_S390 in linux/irq.h ;)

To make the code work the patch below is necessary. It's ok since all clock event devices on s390 are per cpu. However I think this patch is ugly at best. Any ideas how to fix this in a better and more generic way?

You could have an #else path in linux/irq.h to just define these functions as s390, maybe like

static inline int irq_set_affinity(unsigned int irq, cpumask_t cpumask)

{
	BUG();
	return 0;
}
static inline int irq_can_set_affinity(unsigned int irq)
{
	return 0;
}
	Arnd <><