diff mbox

ioapic: when switches to level trigger mode, interrupts raised repeatedly.

Message ID bcf786e7b66395fde3e5d6c00ba116d5232ee307.1300266266.git.yamahata@valinux.co.jp
State New
Headers show

Commit Message

Isaku Yamahata March 16, 2011, 9:05 a.m. UTC
- the trigger mode is edge at first
- During initializatoin, the interrupt is raised as edge which is masked.
  The corresponding bit of irr is set.
- Then the mode is switched to level and it's unmasked.
- the bit of irr is set, so the interrupt is raised repeatedly by
  ioapic_service().
- OS considers that the irq line is broken and falls back to polling mode.

This patch fixes the issues.
After raising edige, clear the bit of irr.

> Bringing up interface eth0:
> Determining IP information for eth0...irq 18: nobody cared (try booting with the "irqpoll" option)
> Pid: 4126, comm: ip Not tainted 2.6.38-rc7 #1
> Call Trace:
>  <IRQ>  [<ffffffff8105b009>] ? __report_bad_irq+0x38/0x87
>  [<ffffffff8105b177>] ? note_interrupt+0x11f/0x188
>  [<ffffffff8105bacf>] ? handle_fasteoi_irq+0xa7/0xd1
>  [<ffffffff810046ff>] ? handle_irq+0x83/0x8c
>  [<ffffffff81003eb9>] ? do_IRQ+0x48/0xaf
>  [<ffffffff81300513>] ? ret_from_intr+0x0/0xe
>  [<ffffffff81031ab8>] ? __do_softirq+0x4f/0x114
>  [<ffffffff81002d6c>] ? call_softirq+0x1c/0x28
>  [<ffffffff81004647>] ? do_softirq+0x33/0x68
>  [<ffffffff810316fb>] ? irq_exit+0x36/0x38
>  [<ffffffff81015f2c>] ? smp_apic_timer_interrupt+0x88/0x96
>  [<ffffffff81002853>] ? apic_timer_interrupt+0x13/0x20
>  <EOI>  [<ffffffff810177ed>] ? __ioapic_set_affinity+0x68/0x7c
>  [<ffffffff813000f0>] ? _raw_spin_unlock_irqrestore+0x8/0xa
>  [<ffffffff8105a84f>] ? __setup_irq+0x224/0x2cb
>  [<ffffffff8120e3c5>] ? e1000_intr+0x0/0x103
>  [<ffffffff8105a9c7>] ? request_threaded_irq+0xd1/0x114
>  [<ffffffff8120e396>] ? e1000_request_irq+0x34/0x63
>  [<ffffffff8121237d>] ? e1000_open+0x81/0x11f
>  [<ffffffff8129097c>] ? call_netdevice_notifiers+0x45/0x4a
>  [<ffffffff81290d8d>] ? __dev_open+0x97/0xc4
>  [<ffffffff8128e9c5>] ? __dev_change_flags+0xb9/0x13d
>  [<ffffffff81290cc1>] ? dev_change_flags+0x1c/0x51
>  [<ffffffff812d0542>] ? devinet_ioctl+0x26e/0x594
>  [<ffffffff812d174c>] ? inet_ioctl+0x92/0xaa
>  [<ffffffff81281d75>] ? T.1003+0x13/0x32
>  [<ffffffff81282152>] ? sock_ioctl+0x1f2/0x1ff
>  [<ffffffff810ae2d3>] ? do_vfs_ioctl+0x498/0x4e7
>  [<ffffffff81281203>] ? sock_alloc_file+0xb3/0x115
>  [<ffffffff8109f79f>] ? fd_install+0x31/0x5d
>  [<ffffffff810ae364>] ? sys_ioctl+0x42/0x65
>  [<ffffffff81001f3b>] ? system_call_fastpath+0x16/0x1b
> handlers:
> [<ffffffff8120e3c5>] (e1000_intr+0x0/0x103)
> Disabling IRQ #18

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/ioapic.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Comments

Aurelien Jarno April 3, 2011, 7:53 p.m. UTC | #1
On Wed, Mar 16, 2011 at 06:05:01PM +0900, Isaku Yamahata wrote:
> - the trigger mode is edge at first
> - During initializatoin, the interrupt is raised as edge which is masked.
>   The corresponding bit of irr is set.
> - Then the mode is switched to level and it's unmasked.
> - the bit of irr is set, so the interrupt is raised repeatedly by
>   ioapic_service().
> - OS considers that the irq line is broken and falls back to polling mode.
> 
> This patch fixes the issues.
> After raising edige, clear the bit of irr.
> 
> > Bringing up interface eth0:
> > Determining IP information for eth0...irq 18: nobody cared (try booting with the "irqpoll" option)
> > Pid: 4126, comm: ip Not tainted 2.6.38-rc7 #1
> > Call Trace:
> >  <IRQ>  [<ffffffff8105b009>] ? __report_bad_irq+0x38/0x87
> >  [<ffffffff8105b177>] ? note_interrupt+0x11f/0x188
> >  [<ffffffff8105bacf>] ? handle_fasteoi_irq+0xa7/0xd1
> >  [<ffffffff810046ff>] ? handle_irq+0x83/0x8c
> >  [<ffffffff81003eb9>] ? do_IRQ+0x48/0xaf
> >  [<ffffffff81300513>] ? ret_from_intr+0x0/0xe
> >  [<ffffffff81031ab8>] ? __do_softirq+0x4f/0x114
> >  [<ffffffff81002d6c>] ? call_softirq+0x1c/0x28
> >  [<ffffffff81004647>] ? do_softirq+0x33/0x68
> >  [<ffffffff810316fb>] ? irq_exit+0x36/0x38
> >  [<ffffffff81015f2c>] ? smp_apic_timer_interrupt+0x88/0x96
> >  [<ffffffff81002853>] ? apic_timer_interrupt+0x13/0x20
> >  <EOI>  [<ffffffff810177ed>] ? __ioapic_set_affinity+0x68/0x7c
> >  [<ffffffff813000f0>] ? _raw_spin_unlock_irqrestore+0x8/0xa
> >  [<ffffffff8105a84f>] ? __setup_irq+0x224/0x2cb
> >  [<ffffffff8120e3c5>] ? e1000_intr+0x0/0x103
> >  [<ffffffff8105a9c7>] ? request_threaded_irq+0xd1/0x114
> >  [<ffffffff8120e396>] ? e1000_request_irq+0x34/0x63
> >  [<ffffffff8121237d>] ? e1000_open+0x81/0x11f
> >  [<ffffffff8129097c>] ? call_netdevice_notifiers+0x45/0x4a
> >  [<ffffffff81290d8d>] ? __dev_open+0x97/0xc4
> >  [<ffffffff8128e9c5>] ? __dev_change_flags+0xb9/0x13d
> >  [<ffffffff81290cc1>] ? dev_change_flags+0x1c/0x51
> >  [<ffffffff812d0542>] ? devinet_ioctl+0x26e/0x594
> >  [<ffffffff812d174c>] ? inet_ioctl+0x92/0xaa
> >  [<ffffffff81281d75>] ? T.1003+0x13/0x32
> >  [<ffffffff81282152>] ? sock_ioctl+0x1f2/0x1ff
> >  [<ffffffff810ae2d3>] ? do_vfs_ioctl+0x498/0x4e7
> >  [<ffffffff81281203>] ? sock_alloc_file+0xb3/0x115
> >  [<ffffffff8109f79f>] ? fd_install+0x31/0x5d
> >  [<ffffffff810ae364>] ? sys_ioctl+0x42/0x65
> >  [<ffffffff81001f3b>] ? system_call_fastpath+0x16/0x1b
> > handlers:
> > [<ffffffff8120e3c5>] (e1000_intr+0x0/0x103)
> > Disabling IRQ #18
> 
> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
> ---
>  hw/ioapic.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)

Thanks, applied.

> diff --git a/hw/ioapic.c b/hw/ioapic.c
> index 569327d..8557e5c 100644
> --- a/hw/ioapic.c
> +++ b/hw/ioapic.c
> @@ -164,6 +164,7 @@ static void ioapic_set_irq(void *opaque, int vector, int level)
>              if (level) {
>                  s->irr |= mask;
>                  ioapic_service(s);
> +                s->irr &= ~mask;
>              }
>          }
>      }
> -- 
> 1.7.1.1
> 
> 
>
Isaku Yamahata April 3, 2011, 11:42 p.m. UTC | #2
Thank you for applying. But I found that the patch is wrong and
I'm preparing the new one. Can you please revert it?

On Sun, Apr 03, 2011 at 09:53:14PM +0200, Aurelien Jarno wrote:
> On Wed, Mar 16, 2011 at 06:05:01PM +0900, Isaku Yamahata wrote:
> > - the trigger mode is edge at first
> > - During initializatoin, the interrupt is raised as edge which is masked.
> >   The corresponding bit of irr is set.
> > - Then the mode is switched to level and it's unmasked.
> > - the bit of irr is set, so the interrupt is raised repeatedly by
> >   ioapic_service().
> > - OS considers that the irq line is broken and falls back to polling mode.
> > 
> > This patch fixes the issues.
> > After raising edige, clear the bit of irr.
> > 
> > > Bringing up interface eth0:
> > > Determining IP information for eth0...irq 18: nobody cared (try booting with the "irqpoll" option)
> > > Pid: 4126, comm: ip Not tainted 2.6.38-rc7 #1
> > > Call Trace:
> > >  <IRQ>  [<ffffffff8105b009>] ? __report_bad_irq+0x38/0x87
> > >  [<ffffffff8105b177>] ? note_interrupt+0x11f/0x188
> > >  [<ffffffff8105bacf>] ? handle_fasteoi_irq+0xa7/0xd1
> > >  [<ffffffff810046ff>] ? handle_irq+0x83/0x8c
> > >  [<ffffffff81003eb9>] ? do_IRQ+0x48/0xaf
> > >  [<ffffffff81300513>] ? ret_from_intr+0x0/0xe
> > >  [<ffffffff81031ab8>] ? __do_softirq+0x4f/0x114
> > >  [<ffffffff81002d6c>] ? call_softirq+0x1c/0x28
> > >  [<ffffffff81004647>] ? do_softirq+0x33/0x68
> > >  [<ffffffff810316fb>] ? irq_exit+0x36/0x38
> > >  [<ffffffff81015f2c>] ? smp_apic_timer_interrupt+0x88/0x96
> > >  [<ffffffff81002853>] ? apic_timer_interrupt+0x13/0x20
> > >  <EOI>  [<ffffffff810177ed>] ? __ioapic_set_affinity+0x68/0x7c
> > >  [<ffffffff813000f0>] ? _raw_spin_unlock_irqrestore+0x8/0xa
> > >  [<ffffffff8105a84f>] ? __setup_irq+0x224/0x2cb
> > >  [<ffffffff8120e3c5>] ? e1000_intr+0x0/0x103
> > >  [<ffffffff8105a9c7>] ? request_threaded_irq+0xd1/0x114
> > >  [<ffffffff8120e396>] ? e1000_request_irq+0x34/0x63
> > >  [<ffffffff8121237d>] ? e1000_open+0x81/0x11f
> > >  [<ffffffff8129097c>] ? call_netdevice_notifiers+0x45/0x4a
> > >  [<ffffffff81290d8d>] ? __dev_open+0x97/0xc4
> > >  [<ffffffff8128e9c5>] ? __dev_change_flags+0xb9/0x13d
> > >  [<ffffffff81290cc1>] ? dev_change_flags+0x1c/0x51
> > >  [<ffffffff812d0542>] ? devinet_ioctl+0x26e/0x594
> > >  [<ffffffff812d174c>] ? inet_ioctl+0x92/0xaa
> > >  [<ffffffff81281d75>] ? T.1003+0x13/0x32
> > >  [<ffffffff81282152>] ? sock_ioctl+0x1f2/0x1ff
> > >  [<ffffffff810ae2d3>] ? do_vfs_ioctl+0x498/0x4e7
> > >  [<ffffffff81281203>] ? sock_alloc_file+0xb3/0x115
> > >  [<ffffffff8109f79f>] ? fd_install+0x31/0x5d
> > >  [<ffffffff810ae364>] ? sys_ioctl+0x42/0x65
> > >  [<ffffffff81001f3b>] ? system_call_fastpath+0x16/0x1b
> > > handlers:
> > > [<ffffffff8120e3c5>] (e1000_intr+0x0/0x103)
> > > Disabling IRQ #18
> > 
> > Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
> > ---
> >  hw/ioapic.c |    1 +
> >  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> Thanks, applied.
> 
> > diff --git a/hw/ioapic.c b/hw/ioapic.c
> > index 569327d..8557e5c 100644
> > --- a/hw/ioapic.c
> > +++ b/hw/ioapic.c
> > @@ -164,6 +164,7 @@ static void ioapic_set_irq(void *opaque, int vector, int level)
> >              if (level) {
> >                  s->irr |= mask;
> >                  ioapic_service(s);
> > +                s->irr &= ~mask;
> >              }
> >          }
> >      }
> > -- 
> > 1.7.1.1
> > 
> > 
> > 
> 
> -- 
> Aurelien Jarno                          GPG: 1024D/F1BCDB73
> aurelien@aurel32.net                 http://www.aurel32.net
>
Aurelien Jarno April 4, 2011, 5:14 a.m. UTC | #3
On Mon, Apr 04, 2011 at 08:42:07AM +0900, Isaku Yamahata wrote:
> Thank you for applying. But I found that the patch is wrong and
> I'm preparing the new one. Can you please revert it?

Reverted for now, I'll ait for some comments on the new patch.

> On Sun, Apr 03, 2011 at 09:53:14PM +0200, Aurelien Jarno wrote:
> > On Wed, Mar 16, 2011 at 06:05:01PM +0900, Isaku Yamahata wrote:
> > > - the trigger mode is edge at first
> > > - During initializatoin, the interrupt is raised as edge which is masked.
> > >   The corresponding bit of irr is set.
> > > - Then the mode is switched to level and it's unmasked.
> > > - the bit of irr is set, so the interrupt is raised repeatedly by
> > >   ioapic_service().
> > > - OS considers that the irq line is broken and falls back to polling mode.
> > > 
> > > This patch fixes the issues.
> > > After raising edige, clear the bit of irr.
> > > 
> > > > Bringing up interface eth0:
> > > > Determining IP information for eth0...irq 18: nobody cared (try booting with the "irqpoll" option)
> > > > Pid: 4126, comm: ip Not tainted 2.6.38-rc7 #1
> > > > Call Trace:
> > > >  <IRQ>  [<ffffffff8105b009>] ? __report_bad_irq+0x38/0x87
> > > >  [<ffffffff8105b177>] ? note_interrupt+0x11f/0x188
> > > >  [<ffffffff8105bacf>] ? handle_fasteoi_irq+0xa7/0xd1
> > > >  [<ffffffff810046ff>] ? handle_irq+0x83/0x8c
> > > >  [<ffffffff81003eb9>] ? do_IRQ+0x48/0xaf
> > > >  [<ffffffff81300513>] ? ret_from_intr+0x0/0xe
> > > >  [<ffffffff81031ab8>] ? __do_softirq+0x4f/0x114
> > > >  [<ffffffff81002d6c>] ? call_softirq+0x1c/0x28
> > > >  [<ffffffff81004647>] ? do_softirq+0x33/0x68
> > > >  [<ffffffff810316fb>] ? irq_exit+0x36/0x38
> > > >  [<ffffffff81015f2c>] ? smp_apic_timer_interrupt+0x88/0x96
> > > >  [<ffffffff81002853>] ? apic_timer_interrupt+0x13/0x20
> > > >  <EOI>  [<ffffffff810177ed>] ? __ioapic_set_affinity+0x68/0x7c
> > > >  [<ffffffff813000f0>] ? _raw_spin_unlock_irqrestore+0x8/0xa
> > > >  [<ffffffff8105a84f>] ? __setup_irq+0x224/0x2cb
> > > >  [<ffffffff8120e3c5>] ? e1000_intr+0x0/0x103
> > > >  [<ffffffff8105a9c7>] ? request_threaded_irq+0xd1/0x114
> > > >  [<ffffffff8120e396>] ? e1000_request_irq+0x34/0x63
> > > >  [<ffffffff8121237d>] ? e1000_open+0x81/0x11f
> > > >  [<ffffffff8129097c>] ? call_netdevice_notifiers+0x45/0x4a
> > > >  [<ffffffff81290d8d>] ? __dev_open+0x97/0xc4
> > > >  [<ffffffff8128e9c5>] ? __dev_change_flags+0xb9/0x13d
> > > >  [<ffffffff81290cc1>] ? dev_change_flags+0x1c/0x51
> > > >  [<ffffffff812d0542>] ? devinet_ioctl+0x26e/0x594
> > > >  [<ffffffff812d174c>] ? inet_ioctl+0x92/0xaa
> > > >  [<ffffffff81281d75>] ? T.1003+0x13/0x32
> > > >  [<ffffffff81282152>] ? sock_ioctl+0x1f2/0x1ff
> > > >  [<ffffffff810ae2d3>] ? do_vfs_ioctl+0x498/0x4e7
> > > >  [<ffffffff81281203>] ? sock_alloc_file+0xb3/0x115
> > > >  [<ffffffff8109f79f>] ? fd_install+0x31/0x5d
> > > >  [<ffffffff810ae364>] ? sys_ioctl+0x42/0x65
> > > >  [<ffffffff81001f3b>] ? system_call_fastpath+0x16/0x1b
> > > > handlers:
> > > > [<ffffffff8120e3c5>] (e1000_intr+0x0/0x103)
> > > > Disabling IRQ #18
> > > 
> > > Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
> > > ---
> > >  hw/ioapic.c |    1 +
> > >  1 files changed, 1 insertions(+), 0 deletions(-)
> > 
> > Thanks, applied.
> > 
> > > diff --git a/hw/ioapic.c b/hw/ioapic.c
> > > index 569327d..8557e5c 100644
> > > --- a/hw/ioapic.c
> > > +++ b/hw/ioapic.c
> > > @@ -164,6 +164,7 @@ static void ioapic_set_irq(void *opaque, int vector, int level)
> > >              if (level) {
> > >                  s->irr |= mask;
> > >                  ioapic_service(s);
> > > +                s->irr &= ~mask;
> > >              }
> > >          }
> > >      }
> > > -- 
> > > 1.7.1.1
> > > 
> > > 
> > > 
> > 
> > -- 
> > Aurelien Jarno                          GPG: 1024D/F1BCDB73
> > aurelien@aurel32.net                 http://www.aurel32.net
> > 
> 
> -- 
> yamahata
> 
>
diff mbox

Patch

diff --git a/hw/ioapic.c b/hw/ioapic.c
index 569327d..8557e5c 100644
--- a/hw/ioapic.c
+++ b/hw/ioapic.c
@@ -164,6 +164,7 @@  static void ioapic_set_irq(void *opaque, int vector, int level)
             if (level) {
                 s->irr |= mask;
                 ioapic_service(s);
+                s->irr &= ~mask;
             }
         }
     }