public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [Patch/RFC]: check CONFIG_GENERIC_HARDIRQS for request/free_irq in interrupt.h
@ 2008-05-29 15:41 Christian Borntraeger
  2008-05-29 17:04 ` Martin Schwidefsky
  0 siblings, 1 reply; 4+ messages in thread
From: Christian Borntraeger @ 2008-05-29 15:41 UTC (permalink / raw)
  To: LKML; +Cc: Ingo Molnar, Thomas Gleixner, Martin Schwidefsky

I currently try to evaluate virtio_console for kvm on s390 and got
the following problem:

virtio_console uses hvc_alloc with irq=0. That means, register_irq
and free_irq are never called by hvc_console.c, but the linker will
still complain about unknown references to free_irq and request_irq.

As the whole kernel/irq folder depends on CONFIG_GENERIC_HARDIRQS 
it seems consistent to declare all functions from kernel/irq only if
CONFIG_GENERIC_HARDIRQS is set. Otherwise we can use empty functions.

This patch does that for register_irq and free_irq. 

Comments?

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
CC: Ingo Molnar <mingo@elte.hu>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Martin Schwidefsky <schwidefsky@de.ibm.com>
---
 include/linux/interrupt.h |   13 +++++++++++++
 1 file changed, 13 insertions(+)

Index: linux-2.6/include/linux/interrupt.h
===================================================================
--- linux-2.6.orig/include/linux/interrupt.h
+++ linux-2.6/include/linux/interrupt.h
@@ -69,9 +69,22 @@ struct irqaction {
 };
 
 extern irqreturn_t no_action(int cpl, void *dev_id);
+
+#ifdef CONFIG_GENERIC_HARDIRQS
 extern int __must_check request_irq(unsigned int, irq_handler_t handler,
 		       unsigned long, const char *, void *);
 extern void free_irq(unsigned int, void *);
+#else
+static inline int request_irq(unsigned int irq, irq_handler_t handler,
+		unsigned long irqflags, const char *devname, void *dev_id)
+{
+	return -EINVAL;
+}
+
+static inline void free_irq(unsigned int irq, void *dev_id)
+{
+}
+#endif
 
 struct device;
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Patch/RFC]: check CONFIG_GENERIC_HARDIRQS for request/free_irq in interrupt.h
  2008-05-29 15:41 [Patch/RFC]: check CONFIG_GENERIC_HARDIRQS for request/free_irq in interrupt.h Christian Borntraeger
@ 2008-05-29 17:04 ` Martin Schwidefsky
  2008-05-29 18:32   ` Christian Borntraeger
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Schwidefsky @ 2008-05-29 17:04 UTC (permalink / raw)
  To: Christian Borntraeger; +Cc: LKML, Ingo Molnar, Thomas Gleixner

On Thu, 2008-05-29 at 17:41 +0200, Christian Borntraeger wrote:
> I currently try to evaluate virtio_console for kvm on s390 and got
> the following problem:
> 
> virtio_console uses hvc_alloc with irq=0. That means, register_irq
> and free_irq are never called by hvc_console.c, but the linker will
> still complain about unknown references to free_irq and request_irq.
> 
> As the whole kernel/irq folder depends on CONFIG_GENERIC_HARDIRQS 
> it seems consistent to declare all functions from kernel/irq only if
> CONFIG_GENERIC_HARDIRQS is set. Otherwise we can use empty functions.
> 
> This patch does that for register_irq and free_irq. 
> 
> Comments?

Please don't. So far whenever the linker complained about the missing
register_irq/free_irq functions it has been a bug in a Kconfig file.
We should not silently accept code that requires the concept of an
irq-line when there is no such thing on a s390.

-- 
blue skies,
  Martin.

"Reality continues to ruin my life." - Calvin.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Patch/RFC]: check CONFIG_GENERIC_HARDIRQS for request/free_irq in interrupt.h
  2008-05-29 17:04 ` Martin Schwidefsky
@ 2008-05-29 18:32   ` Christian Borntraeger
  2008-05-30  3:36     ` Rusty Russell
  0 siblings, 1 reply; 4+ messages in thread
From: Christian Borntraeger @ 2008-05-29 18:32 UTC (permalink / raw)
  To: schwidefsky; +Cc: LKML, Ingo Molnar, Thomas Gleixner, Rusty Russell

Am Donnerstag, 29. Mai 2008 schrieb Martin Schwidefsky:
> On Thu, 2008-05-29 at 17:41 +0200, Christian Borntraeger wrote:
> > I currently try to evaluate virtio_console for kvm on s390 and got
> > the following problem:
> > 
> > virtio_console uses hvc_alloc with irq=0. That means, register_irq
> > and free_irq are never called by hvc_console.c, but the linker will
> > still complain about unknown references to free_irq and request_irq.
> > 
> > As the whole kernel/irq folder depends on CONFIG_GENERIC_HARDIRQS 
> > it seems consistent to declare all functions from kernel/irq only if
> > CONFIG_GENERIC_HARDIRQS is set. Otherwise we can use empty functions.
> > 
> > This patch does that for register_irq and free_irq. 
> > 
> > Comments?
> 
> Please don't. So far whenever the linker complained about the missing
> register_irq/free_irq functions it has been a bug in a Kconfig file.
> We should not silently accept code that requires the concept of an
> irq-line when there is no such thing on a s390.

Ok, convinced.

I will look if I can modify virtio_console to get rid of hvc_console. Reading
all the comments, it appears that Rusty is not really happy with all the 
dependencies/limitations that hvc_console brings to virtio_console.

Rusty, be prepared.... ;-)

Christian

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Patch/RFC]: check CONFIG_GENERIC_HARDIRQS for request/free_irq in interrupt.h
  2008-05-29 18:32   ` Christian Borntraeger
@ 2008-05-30  3:36     ` Rusty Russell
  0 siblings, 0 replies; 4+ messages in thread
From: Rusty Russell @ 2008-05-30  3:36 UTC (permalink / raw)
  To: Christian Borntraeger
  Cc: schwidefsky, LKML, Ingo Molnar, Thomas Gleixner, Stephen Rothwell,
	will schmidt

On Friday 30 May 2008 04:32:58 Christian Borntraeger wrote:
> Am Donnerstag, 29. Mai 2008 schrieb Martin Schwidefsky:
> > On Thu, 2008-05-29 at 17:41 +0200, Christian Borntraeger wrote:
> > > I currently try to evaluate virtio_console for kvm on s390 and got
> > > the following problem:
> > >
> > > virtio_console uses hvc_alloc with irq=0. That means, register_irq
> > > and free_irq are never called by hvc_console.c, but the linker will
> > > still complain about unknown references to free_irq and request_irq.
> > >
> > > As the whole kernel/irq folder depends on CONFIG_GENERIC_HARDIRQS
> > > it seems consistent to declare all functions from kernel/irq only if
> > > CONFIG_GENERIC_HARDIRQS is set. Otherwise we can use empty functions.
> > >
> > > This patch does that for register_irq and free_irq.
> > >
> > > Comments?
> >
> > Please don't. So far whenever the linker complained about the missing
> > register_irq/free_irq functions it has been a bug in a Kconfig file.
> > We should not silently accept code that requires the concept of an
> > irq-line when there is no such thing on a s390.
>
> Ok, convinced.
>
> I will look if I can modify virtio_console to get rid of hvc_console.
> Reading all the comments, it appears that Rusty is not really happy with
> all the dependencies/limitations that hvc_console brings to virtio_console.
>
> Rusty, be prepared.... ;-)
>
> Christian

OK, my plan was to at least allow the hook of notifiers in hvc_console, rather 
than relying on interrupts or nothing.  Then expose "use interrupt to notify" 
and "use a backoff timer to notify" helpers and let the caller hook one up.

But it was a vague plan which may become unrecognisable when meeting 
reality...

Cheers,
Rusty.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-05-30  3:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-29 15:41 [Patch/RFC]: check CONFIG_GENERIC_HARDIRQS for request/free_irq in interrupt.h Christian Borntraeger
2008-05-29 17:04 ` Martin Schwidefsky
2008-05-29 18:32   ` Christian Borntraeger
2008-05-30  3:36     ` Rusty Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox