linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -tip] x86: do_IRQ - send EOI for x86-32 on irq without handler v2
@ 2009-04-08 14:50 Cyrill Gorcunov
  2009-04-08 14:52 ` Ingo Molnar
  0 siblings, 1 reply; 5+ messages in thread
From: Cyrill Gorcunov @ 2009-04-08 14:50 UTC (permalink / raw)
  To: Ingo Molnar, H. Peter Anvin, Thomas Gleixner; +Cc: LKML, Suresh Siddha

If IRQ has no handler it remains non-Ack'ed even if APIC is not
requested for being disabled. Fix it.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---

|more stuff needs fixing here first:
|
|arch/x86/kernel/irq.c: In function ‘do_IRQ’:
|arch/x86/kernel/irq.c:226: error: ‘disable_apic’ undeclared (first use in this
|function)
|arch/x86/kernel/irq.c:226: error: (Each undeclared identifier is reported only
|once
|arch/x86/kernel/irq.c:226: error: for each function it appears in.)
|
|like making 'disable_apic' available everywhere.
|
|Or better yet: introduce a dummy apic->write() method in the
|disable_apic=1 case so we can call a straight ack_APIC_irq().
|
|        Ingo

Ingo, I think introducing additional dummy here would be a bit
expencive -- a number of callers of ack_APIC_irq just should not
check for disable_apic since it's not needed. disable_apic is to
depend on CONFIG_X86_LOCAL_APIC rather then CONFIG_X86_64 actually.
So make it then. Or you mean something else? Like new apic->write_eoi
operation? (I'm a bit tired so brain is a half functional now :)

 arch/x86/kernel/irq.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6.git/arch/x86/kernel/irq.c
=====================================================================
--- linux-2.6.git.orig/arch/x86/kernel/irq.c
+++ linux-2.6.git/arch/x86/kernel/irq.c
@@ -223,10 +223,10 @@ unsigned int __irq_entry do_IRQ(struct p
 	irq = __get_cpu_var(vector_irq)[vector];
 
 	if (!handle_irq(irq, regs)) {
-#ifdef CONFIG_X86_64
+#ifdef CONFIG_X86_LOCAL_APIC
 		if (!disable_apic)
-			ack_APIC_irq();
 #endif
+			ack_APIC_irq();
 
 		if (printk_ratelimit())
 			printk(KERN_EMERG "%s: %d.%d No irq handler for vector (irq %d)\n",

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

* Re: [PATCH -tip] x86: do_IRQ - send EOI for x86-32 on irq without handler v2
  2009-04-08 14:50 [PATCH -tip] x86: do_IRQ - send EOI for x86-32 on irq without handler v2 Cyrill Gorcunov
@ 2009-04-08 14:52 ` Ingo Molnar
  2009-04-08 15:45   ` Cyrill Gorcunov
  0 siblings, 1 reply; 5+ messages in thread
From: Ingo Molnar @ 2009-04-08 14:52 UTC (permalink / raw)
  To: Cyrill Gorcunov; +Cc: H. Peter Anvin, Thomas Gleixner, LKML, Suresh Siddha


* Cyrill Gorcunov <gorcunov@openvz.org> wrote:

> Ingo, I think introducing additional dummy here would be a bit 
> expencive -- a number of callers of ack_APIC_irq just should not 
> check for disable_apic since it's not needed. disable_apic is to 
> depend on CONFIG_X86_LOCAL_APIC rather then CONFIG_X86_64 
> actually. So make it then. Or you mean something else? Like new 
> apic->write_eoi operation? (I'm a bit tired so brain is a half 
> functional now :)

no, i meant a dummy apic->write() method in the !apic case. Check 
what ack_APIC_irq() does internally.

	Ingo

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

* Re: [PATCH -tip] x86: do_IRQ - send EOI for x86-32 on irq without handler v2
  2009-04-08 14:52 ` Ingo Molnar
@ 2009-04-08 15:45   ` Cyrill Gorcunov
  2009-04-08 15:55     ` Ingo Molnar
  0 siblings, 1 reply; 5+ messages in thread
From: Cyrill Gorcunov @ 2009-04-08 15:45 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: H. Peter Anvin, Thomas Gleixner, LKML, Suresh Siddha

[Ingo Molnar - Wed, Apr 08, 2009 at 04:52:18PM +0200]
| 
| * Cyrill Gorcunov <gorcunov@openvz.org> wrote:
| 
| > Ingo, I think introducing additional dummy here would be a bit 
| > expencive -- a number of callers of ack_APIC_irq just should not 
| > check for disable_apic since it's not needed. disable_apic is to 
| > depend on CONFIG_X86_LOCAL_APIC rather then CONFIG_X86_64 
| > actually. So make it then. Or you mean something else? Like new 
| > apic->write_eoi operation? (I'm a bit tired so brain is a half 
| > functional now :)
| 
| no, i meant a dummy apic->write() method in the !apic case. Check 
| what ack_APIC_irq() does internally.
| 
| 	Ingo
|

Of course I saw how ack_APIC_irq implemented :) It's already guarded
by CONFIG_X86_LOCAL_APIC and I could just move check for disable_apic
right here (ie it could be like

static inline void ack_APIC_irq(void)
{
#ifdef CONFIG_X86_LOCAL_APIC
	/*
	 * ack_APIC_irq() actually gets compiled as a single instruction
	 * ... yummie.
	 */

	if (!disable_apic)
		/* Docs say use 0 for future compatibility */
		apic_write(APIC_EOI, 0);
#endif
}

but what is bothering me is that a number of ack_APIC_irq callers
will pass execution with always disable_apic=0 and as result
this checking would be just spedning cycles for free.

So Ingo, it seems I miss something on what you mean. apic->write is already
called only for CONFIG_X86_LOCAL_APIC here as well and the arguable
point is where to check for disable_apic variable. But do_IRQ is a
special case (wrt to say smp_apic_timer_interrupt or setup_local_APIC.
I mean as example -- setup_local_APIC is not even called for disable_apic=1).

/me: scratching the head heavily

        Cyrill

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

* Re: [PATCH -tip] x86: do_IRQ - send EOI for x86-32 on irq without handler v2
  2009-04-08 15:45   ` Cyrill Gorcunov
@ 2009-04-08 15:55     ` Ingo Molnar
  2009-04-08 16:21       ` Cyrill Gorcunov
  0 siblings, 1 reply; 5+ messages in thread
From: Ingo Molnar @ 2009-04-08 15:55 UTC (permalink / raw)
  To: Cyrill Gorcunov; +Cc: H. Peter Anvin, Thomas Gleixner, LKML, Suresh Siddha


* Cyrill Gorcunov <gorcunov@gmail.com> wrote:

> [Ingo Molnar - Wed, Apr 08, 2009 at 04:52:18PM +0200]
> | 
> | * Cyrill Gorcunov <gorcunov@openvz.org> wrote:
> | 
> | > Ingo, I think introducing additional dummy here would be a bit 
> | > expencive -- a number of callers of ack_APIC_irq just should not 
> | > check for disable_apic since it's not needed. disable_apic is to 
> | > depend on CONFIG_X86_LOCAL_APIC rather then CONFIG_X86_64 
> | > actually. So make it then. Or you mean something else? Like new 
> | > apic->write_eoi operation? (I'm a bit tired so brain is a half 
> | > functional now :)
> | 
> | no, i meant a dummy apic->write() method in the !apic case. Check 
> | what ack_APIC_irq() does internally.
> | 
> | 	Ingo
> |
> 
> Of course I saw how ack_APIC_irq implemented :) It's already guarded
> by CONFIG_X86_LOCAL_APIC and I could just move check for disable_apic
> right here (ie it could be like
> 
> static inline void ack_APIC_irq(void)
> {
> #ifdef CONFIG_X86_LOCAL_APIC
> 	/*
> 	 * ack_APIC_irq() actually gets compiled as a single instruction
> 	 * ... yummie.
> 	 */
> 
> 	if (!disable_apic)
> 		/* Docs say use 0 for future compatibility */
> 		apic_write(APIC_EOI, 0);
> #endif
> }
> 
> but what is bothering me is that a number of ack_APIC_irq callers
> will pass execution with always disable_apic=0 and as result
> this checking would be just spedning cycles for free.
> 
> So Ingo, it seems I miss something on what you mean. apic->write 
> is already called only for CONFIG_X86_LOCAL_APIC here as well and 
> the arguable point is where to check for disable_apic variable. 
> But do_IRQ is a special case (wrt to say smp_apic_timer_interrupt 
> or setup_local_APIC. I mean as example -- setup_local_APIC is not 
> even called for disable_apic=1).
> 
> /me: scratching the head heavily

You should look into how apic_write() is implemented. It is a call 
to apic->write().

So my suggestion is that you could implement a freely callable 
ack_APIC_irq() by replacing the apic->write() method with a NOP 
method in the apic-disabled case.

Does that sound good to you?

	Ingo

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

* Re: [PATCH -tip] x86: do_IRQ - send EOI for x86-32 on irq without handler v2
  2009-04-08 15:55     ` Ingo Molnar
@ 2009-04-08 16:21       ` Cyrill Gorcunov
  0 siblings, 0 replies; 5+ messages in thread
From: Cyrill Gorcunov @ 2009-04-08 16:21 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: H. Peter Anvin, Thomas Gleixner, LKML, Suresh Siddha

[Ingo Molnar - Wed, Apr 08, 2009 at 05:55:00PM +0200]
| 
| * Cyrill Gorcunov <gorcunov@gmail.com> wrote:
| 
| > [Ingo Molnar - Wed, Apr 08, 2009 at 04:52:18PM +0200]
| > | 
| > | * Cyrill Gorcunov <gorcunov@openvz.org> wrote:
| > | 
| > | > Ingo, I think introducing additional dummy here would be a bit 
| > | > expencive -- a number of callers of ack_APIC_irq just should not 
| > | > check for disable_apic since it's not needed. disable_apic is to 
| > | > depend on CONFIG_X86_LOCAL_APIC rather then CONFIG_X86_64 
| > | > actually. So make it then. Or you mean something else? Like new 
| > | > apic->write_eoi operation? (I'm a bit tired so brain is a half 
| > | > functional now :)
| > | 
| > | no, i meant a dummy apic->write() method in the !apic case. Check 
| > | what ack_APIC_irq() does internally.
| > | 
| > | 	Ingo
| > |
| > 
| > Of course I saw how ack_APIC_irq implemented :) It's already guarded
| > by CONFIG_X86_LOCAL_APIC and I could just move check for disable_apic
| > right here (ie it could be like
| > 
| > static inline void ack_APIC_irq(void)
| > {
| > #ifdef CONFIG_X86_LOCAL_APIC
| > 	/*
| > 	 * ack_APIC_irq() actually gets compiled as a single instruction
| > 	 * ... yummie.
| > 	 */
| > 
| > 	if (!disable_apic)
| > 		/* Docs say use 0 for future compatibility */
| > 		apic_write(APIC_EOI, 0);
| > #endif
| > }
| > 
| > but what is bothering me is that a number of ack_APIC_irq callers
| > will pass execution with always disable_apic=0 and as result
| > this checking would be just spedning cycles for free.
| > 
| > So Ingo, it seems I miss something on what you mean. apic->write 
| > is already called only for CONFIG_X86_LOCAL_APIC here as well and 
| > the arguable point is where to check for disable_apic variable. 
| > But do_IRQ is a special case (wrt to say smp_apic_timer_interrupt 
| > or setup_local_APIC. I mean as example -- setup_local_APIC is not 
| > even called for disable_apic=1).
| > 
| > /me: scratching the head heavily
| 
| You should look into how apic_write() is implemented. It is a call 
| to apic->write().
| 
| So my suggestion is that you could implement a freely callable 
| ack_APIC_irq() by replacing the apic->write() method with a NOP 
| method in the apic-disabled case.
| 
| Does that sound good to you?
| 
| 	Ingo
|

Ah, Ingo, now I see what you mean :)

You should only say me like -- implement dynamic apic->write
depending on disabled_apic, now it's clear :-)

Will do.
 
        Cyrill

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

end of thread, other threads:[~2009-04-08 16:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-08 14:50 [PATCH -tip] x86: do_IRQ - send EOI for x86-32 on irq without handler v2 Cyrill Gorcunov
2009-04-08 14:52 ` Ingo Molnar
2009-04-08 15:45   ` Cyrill Gorcunov
2009-04-08 15:55     ` Ingo Molnar
2009-04-08 16:21       ` Cyrill Gorcunov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).