1. 16 10月, 2008 4 次提交
  2. 02 10月, 2008 1 次提交
    • D
      genirq: record trigger type · 0c5d1eb7
      David Brownell 提交于
      Genirq hasn't previously recorded the trigger type used by any given IRQ,
      although some irq_chip support has done so.  That data can be useful when
      troubleshooting.  This patch records it in the relevant irq_desc.status
      bits, and improves consistency between the two driver-visible calls
      affected:
      
       - Make set_irq_type() usage match request_irq() usage:
          * IRQ_TYPE_NONE should be a NOP; succeed, so irq_chip methods
            won't have to handle that case any more (many do it wrong).
          * IRQ_TYPE_PROBE is ignored; any buggy out-of-tree callers
            might need to switch over to the real IRQ probing code.
          * emit the same diagnostics (from shared utility code)
      
       - Their kerneldoc now reflects usage:
          * request_irq() flags include IRQF_TRIGGER_* to specify
            active edge(s)/level ... docs previously omitted that
          * set_irq_type() is declared in <linux/irq.h> so callers
            should use the (bit-equivalent) IRQ_TYPE_* symbols there
      
      Also: adds a warning about shared IRQs that don't end up using the
      requested trigger mode; and fix an unrelated "sparse" warning.
      Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Acked-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      0c5d1eb7
  3. 07 9月, 2008 1 次提交
  4. 22 8月, 2008 1 次提交
    • A
      genirq: fix irq_desc->depth handling with DEBUG_SHIRQ · 377bf1e4
      Anton Vorontsov 提交于
      When DEBUG_SHIRQ is selected, a spurious IRQ is issued before
      the setup_irq() initializes the desc->depth. An IRQ handler may
      call disable_irq_nosync(), but then setup_irq() will overwrite
      desc->depth, and upon enable_irq() we'll catch this WARN:
      
      ------------[ cut here ]------------
      Badness at kernel/irq/manage.c:180
      NIP: c0061ab8 LR: c0061f10 CTR: 00000000
      REGS: cf83be50 TRAP: 0700   Not tainted  (2.6.27-rc3-23450-g74919b0)
      MSR: 00021032 <ME,IR,DR>  CR: 22042022  XER: 20000000
      TASK = cf829100[5] 'events/0' THREAD: cf83a000
      GPR00: c0061f10 cf83bf00 cf829100 c038e674 00000016 00000000 cf83bef8 00000038
      GPR08: c0298910 00000000 c0310d28 cf83a000 00000c9c 1001a1a8 0fffe000 00800000
      GPR16: ffffffff 00000000 007fff00 00000000 007ffeb0 c03320a0 c031095c c0310924
      GPR24: cf8292ec cf807190 cf83a000 00009032 c038e6a4 c038e674 cf99b1cc c038e674
      NIP [c0061ab8] __enable_irq+0x20/0x80
      LR [c0061f10] enable_irq+0x50/0x70
      Call Trace:
      [cf83bf00] [c038e674] irq_desc+0x630/0x9000 (unreliable)
      [cf83bf10] [c0061f10] enable_irq+0x50/0x70
      [cf83bf30] [c01abe94] phy_change+0x68/0x108
      [cf83bf50] [c0046394] run_workqueue+0xc4/0x16c
      [cf83bf90] [c0046834] worker_thread+0x74/0xd4
      [cf83bfd0] [c004ab7c] kthread+0x48/0x84
      [cf83bff0] [c00135e0] kernel_thread+0x44/0x60
      Instruction dump:
      4e800020 3d20c031 38a94214 4bffffcc 9421fff0 7c0802a6 93e1000c 7c7f1b78
      90010014 8123001c 2f890000 409e001c <0fe00000> 80010014 83e1000c 38210010
      
      That trace corresponds to this line:
      WARN(1, KERN_WARNING "Unbalanced enable for IRQ %d\n", irq);
      
      The patch fixes the problem by moving the SHIRQ code below the
      setup_irq().
      
      Unfortunately we can't easily move the SHIRQ code inside the
      setup_irq(), since it grabs a spinlock, so to prvent a 'real'
      IRQ from interfere us we should disable that IRQ.
      
      p.s. The driver in question is drivers/net/phy/phy.c.
      Signed-off-by: NAnton Vorontsov <avorontsov@ru.mvista.com>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      377bf1e4
  5. 13 8月, 2008 1 次提交
  6. 06 8月, 2008 1 次提交
  7. 27 7月, 2008 2 次提交
  8. 26 7月, 2008 1 次提交
  9. 25 7月, 2008 1 次提交
    • U
      generic irqs: handle failure of irqchip->set_type in setup_irq · 82736f4d
      Uwe Kleine-König 提交于
      set_type returns an int indicating success or failure, but up to now
      setup_irq ignores that.
      
      In my case this resulted in a machine hang:
      
      gpio-keys requested IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, but
      arm/ns9xxx can only trigger on one direction so set_type didn't touch
      the configuration which happens do default to a level sensitiveness and
      returned -EINVAL.  setup_irq ignored that and unmasked the irq.  This
      resulted in an endless triggering of the gpio-key interrupt service
      routine which effectively killed the machine.
      
      With this patch applied setup_irq propagates the error to the caller.
      
      Note that before in the case
      
      	chip && !chip->set_type && !chip->name
      
      a NULL pointer was feed to printk.  This is fixed, too.
      Signed-off-by: NUwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      82736f4d
  10. 24 7月, 2008 1 次提交
  11. 22 7月, 2008 1 次提交
  12. 19 7月, 2008 1 次提交
    • E
      genirq: enable polling for disabled screaming irqs · f84dbb91
      Eric W. Biederman 提交于
      When we disable a screaming irq we never see it again.  If the irq
      line is shared or if the driver half works this is a real pain.  So
      periodically poll the handlers for screaming interrupts.
      
      I use a timer instead of the classic irq poll technique of working off
      the timer interrupt because when we use the local apic timers
      note_interrupt is never called (bug?).  Further on a system with
      dynamic ticks the timer interrupt might not even fire unless there is
      a timer telling it it needs to.
      
      I forced this case on my test system with an e1000 nic and my ssh
      session remained responsive despite the interrupt handler only being
      called every 10th of a second.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      f84dbb91
  13. 12 7月, 2008 1 次提交
  14. 10 7月, 2008 1 次提交
  15. 05 6月, 2008 1 次提交
    • M
      genirq: Expose default irq affinity mask (take 3) · 18404756
      Max Krasnyansky 提交于
      Current IRQ affinity interface does not provide a way to set affinity
      for the IRQs that will be allocated/activated in the future.
      This patch creates /proc/irq/default_smp_affinity that lets users set
      default affinity mask for the newly allocated IRQs. Changing the default
      does not affect affinity masks for the currently active IRQs, they
      have to be changed explicitly.
      
      Updated based on Paul J's comments and added some more documentation.
      Signed-off-by: NMax Krasnyansky <maxk@qualcomm.com>
      Cc: pj@sgi.com
      Cc: a.p.zijlstra@chello.nl
      Cc: tglx@linutronix.de
      Cc: rdunlap@xenotime.net
      Cc: mingo@elte.hu
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      18404756
  16. 02 5月, 2008 1 次提交
    • T
      genirq: reenable a nobody cared disabled irq when a new driver arrives · 1adb0850
      Thomas Gleixner 提交于
      Uwe Kleine-Koenig has some strange hardware where one of the shared
      interrupts can be asserted during boot before the appropriate driver
      loads. Requesting the shared irq line from another driver result in a
      spurious interrupt storm which finally disables the interrupt line.
      
      I have seen similar behaviour on resume before (the hardware does not
      work anymore so I can not verify).
      
      Change the spurious disable logic to increment the disable depth and
      mark the interrupt with an extra flag which allows us to reenable the
      interrupt when a new driver arrives which requests the same irq
      line. In the worst case this will disable the irq again via the
      spurious trap, but there is a decent chance that the new driver is the
      one which can handle the already asserted interrupt and makes the box
      usable again.
      
      Eric Biederman said further: This case also happens on a regular basis
      in kdump kernels where we deliberately don't shutdown the hardware
      before starting the new kernel.  This patch should reduce the need for
      using irqpoll in that situation by a small amount.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Tested-and-Acked-by: NUwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
      1adb0850
  17. 29 4月, 2008 1 次提交
  18. 20 4月, 2008 1 次提交
  19. 19 2月, 2008 2 次提交
  20. 09 2月, 2008 2 次提交
  21. 30 1月, 2008 3 次提交
  22. 19 12月, 2007 1 次提交
  23. 15 11月, 2007 1 次提交
    • R
      __do_IRQ does not check IRQ_DISABLED when IRQ_PER_CPU is set · c642b839
      Russ Anderson 提交于
      In __do_IRQ(), the normal case is that IRQ_DISABLED is checked and if set
      the handler (handle_IRQ_event()) is not called.
      
      Earlier in __do_IRQ(), if IRQ_PER_CPU is set the code does not check
      IRQ_DISABLED and calls the handler even though IRQ_DISABLED is set.  This
      behavior seems unintentional.
      
      One user encountering this behavior is the CPE handler (in
      arch/ia64/kernel/mca.c).  When the CPE handler encounters too many CPEs
      (such as a solid single bit error), it sets up a polling timer and disables
      the CPE interrupt (to avoid excessive overhead logging the stream of single
      bit errors).  disable_irq_nosync() is called which sets IRQ_DISABLED.  The
      IRQ_PER_CPU flag was previously set (in ia64_mca_late_init()).  The net
      result is the CPE handler gets called even though it is marked disabled.
      
      If the behavior of not checking IRQ_DISABLED when IRQ_PER_CPU is set is
      intentional, it would be worthy of a comment describing the intended
      behavior.  disable_irq_nosync() does call chip->disable() to provide a
      chipset specifiec interface for disabling the interrupt, which avoids this
      issue when used.
      Signed-off-by: NRuss Anderson <rja@sgi.com>
      Cc: "Luck, Tony" <tony.luck@intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Bjorn Helgaas <bjorn.helgaas@hp.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c642b839
  24. 24 10月, 2007 1 次提交
    • H
      Fix synchronize_irq races with IRQ handler · a98ce5c6
      Herbert Xu 提交于
      As it is some callers of synchronize_irq rely on memory barriers
      to provide synchronisation against the IRQ handlers.  For example,
      the tg3 driver does
      
      	tp->irq_sync = 1;
      	smp_mb();
      	synchronize_irq();
      
      and then in the IRQ handler:
      
      	if (!tp->irq_sync)
      		netif_rx_schedule(dev, &tp->napi);
      
      Unfortunately memory barriers only work well when they come in
      pairs.  Because we don't actually have memory barriers on the
      IRQ path, the memory barrier before the synchronize_irq() doesn't
      actually protect us.
      
      In particular, synchronize_irq() may return followed by the
      result of netif_rx_schedule being made visible.
      
      This patch (mostly written by Linus) fixes this by using spin
      locks instead of memory barries on the synchronize_irq() path.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Acked-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a98ce5c6
  25. 17 10月, 2007 2 次提交
  26. 31 8月, 2007 1 次提交
    • J
      request_irq: fix DEBUG_SHIRQ handling · 59845b1f
      Jarek Poplawski 提交于
      Mariusz Kozlowski reported lockdep's warning:
      
      > =================================
      > [ INFO: inconsistent lock state ]
      > 2.6.23-rc2-mm1 #7
      > ---------------------------------
      > inconsistent {in-hardirq-W} -> {hardirq-on-W} usage.
      > ifconfig/5492 [HC0[0]:SC0[0]:HE1:SE1] takes:
      >  (&tp->lock){+...}, at: [<de8706e0>] rtl8139_interrupt+0x27/0x46b [8139too]
      > {in-hardirq-W} state was registered at:
      >   [<c0138eeb>] __lock_acquire+0x949/0x11ac
      >   [<c01397e7>] lock_acquire+0x99/0xb2
      >   [<c0452ff3>] _spin_lock+0x35/0x42
      >   [<de8706e0>] rtl8139_interrupt+0x27/0x46b [8139too]
      >   [<c0147a5d>] handle_IRQ_event+0x28/0x59
      >   [<c01493ca>] handle_level_irq+0xad/0x10b
      >   [<c0105a13>] do_IRQ+0x93/0xd0
      >   [<c010441e>] common_interrupt+0x2e/0x34
      ...
      > other info that might help us debug this:
      > 1 lock held by ifconfig/5492:
      >  #0:  (rtnl_mutex){--..}, at: [<c0451778>] mutex_lock+0x1c/0x1f
      >
      > stack backtrace:
      ...
      >  [<c0452ff3>] _spin_lock+0x35/0x42
      >  [<de8706e0>] rtl8139_interrupt+0x27/0x46b [8139too]
      >  [<c01480fd>] free_irq+0x11b/0x146
      >  [<de871d59>] rtl8139_close+0x8a/0x14a [8139too]
      >  [<c03bde63>] dev_close+0x57/0x74
      ...
      
      This shows that a driver's irq handler was running both in hard interrupt
      and process contexts with irqs enabled. The latter was done during
      free_irq() call and was possible only with CONFIG_DEBUG_SHIRQ enabled.
      This was fixed by another patch.
      
      But similar problem is possible with request_irq(): any locks taken from
      irq handler could be vulnerable - especially with soft interrupts. This
      patch fixes it by disabling local interrupts during handler's run. (It
      seems, disabling softirqs should be enough, but it needs more checking
      on possible races or other special cases).
      Reported-by: NMariusz Kozlowski <m.kozlowski@tuxland.pl>
      Signed-off-by: NJarek Poplawski <jarkao2@o2.pl>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      59845b1f
  27. 23 8月, 2007 1 次提交
  28. 13 8月, 2007 2 次提交
  29. 09 8月, 2007 1 次提交
  30. 02 8月, 2007 1 次提交
    • T
      genirq: temporary fix for level-triggered IRQ resend · 0fc4969b
      Thomas Gleixner 提交于
      Marcin Slusarz reported a ne2k-pci "hung network interface" regression.
      
      delayed disable relies on the ability to re-trigger the interrupt in the
      case that a real interrupt happens after the software disable was set.
      In this case we actually disable the interrupt on the hardware level
      _after_ it occurred.
      
      On enable_irq, we need to re-trigger the interrupt. On i386 this relies
      on a hardware resend mechanism (send_IPI_self()).
      
      Actually we only need the resend for edge type interrupts. Level type
      interrupts come back once enable_irq() re-enables the interrupt line.
      
      I assume that the interrupt in question is level triggered because it is
      shared and above the legacy irqs 0-15:
      
      	17:         12   IO-APIC-fasteoi   eth1, eth0
      
      Looking into the IO_APIC code, the resend via send_IPI_self() happens
      unconditionally. So the resend is done for level and edge interrupts.
      This makes the problem more mysterious.
      
      The code in question lib8390.c does
      
      	disable_irq();
      	fiddle_with_the_network_card_hardware()
      	enable_irq();
      
      The fiddle_with_the_network_card_hardware() might cause interrupts,
      which are cleared in the same code path again,
      
      Marcin found that when he disables the irq line on the hardware level
      (removing the delayed disable) the card is kept alive.
      
      So the difference is that we can get a resend on enable_irq, when an
      interrupt happens during the time, where we are in the disabled region.
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      0fc4969b