1. 14 8月, 2009 1 次提交
    • L
      genirq: prevent wakeup of freed irq thread · 2d860ad7
      Linus Torvalds 提交于
      free_irq() can remove an irqaction while the corresponding interrupt
      is in progress, but free_irq() sets action->thread to NULL
      unconditionally, which might lead to a NULL pointer dereference in
      handle_IRQ_event() when the hard interrupt context tries to wake up
      the handler thread.
      
      Prevent this by moving the thread stop after synchronize_irq(). No
      need to set action->thread to NULL either as action is going to be
      freed anyway.
      
      This fixes a boot crash reported against preempt-rt which uses the
      mainline irq threads code to implement full irq threading.
      
      [ tglx: removed local irqthread variable ]
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      2d860ad7
  2. 23 7月, 2009 1 次提交
    • B
      genirq: Fix UP compile failure caused by irq_thread_check_affinity · 61f38261
      Bruno Premont 提交于
      Since genirq: Delegate irq affinity setting to the irq thread
      (591d2fb0) compilation with
      CONFIG_SMP=n fails with following error:
      
      /usr/src/linux-2.6/kernel/irq/manage.c:
         In function 'irq_thread_check_affinity':
      /usr/src/linux-2.6/kernel/irq/manage.c:475:
         error: 'struct irq_desc' has no member named 'affinity'
      make[4]: *** [kernel/irq/manage.o] Error 1
      
      That commit adds a new function irq_thread_check_affinity() which
      uses struct irq_desc.affinity which is only available for CONFIG_SMP=y.
      Move that function under #ifdef CONFIG_SMP.
      
      [ tglx@brownpaperbag: compile and boot tested on UP and SMP ]
      Signed-off-by: NBruno Premont <bonbons@linux-vserver.org>
      LKML-Reference: <20090722222232.2eb3e1c4@neptune.home>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      61f38261
  3. 21 7月, 2009 1 次提交
    • T
      genirq: Delegate irq affinity setting to the irq thread · 591d2fb0
      Thomas Gleixner 提交于
      irq_set_thread_affinity() calls set_cpus_allowed_ptr() which might
      sleep, but irq_set_thread_affinity() is called with desc->lock held
      and can be called from hard interrupt context as well. The code has
      another bug as it does not hold a ref on the task struct as required
      by set_cpus_allowed_ptr().
      
      Just set the IRQTF_AFFINITY bit in action->thread_flags. The next time
      the thread runs it migrates itself. Solves all of the above problems
      nicely.
      
      Add kerneldoc to irq_set_thread_affinity() while at it.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      LKML-Reference: <new-submission>
      591d2fb0
  4. 13 5月, 2009 1 次提交
  5. 28 4月, 2009 1 次提交
    • Y
      irq: only update affinity if ->set_affinity() is sucessfull · 57b150cc
      Yinghai Lu 提交于
      irq_set_affinity() and move_masked_irq() try to assign affinity
      before calling chip set_affinity(). Some archs are assigning it
      in ->set_affinity() again.
      
      We do something like:
      
       cpumask_cpy(desc->affinity, mask);
       desc->chip->set_affinity(mask);
      
      But in the failure path, affinity should not be touched - otherwise
      we'll end up with a different affinity mask despite the failure to
      migrate the IRQ.
      
      So try to update the afffinity only if set_affinity returns with 0.
      Also call irq_set_thread_affinity accordingly.
      
      v2: update after "irq, x86: Remove IRQ_DISABLED check in process context IRQ move"
      v3: according to Ingo, change set_affinity() in irq_chip should return int.
      v4: update comments by removing moving irq_desc code.
      
      [ Impact: fix /proc/irq/*/smp_affinity setting corner case bug ]
      Signed-off-by: NYinghai Lu <yinghai@kernel.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Suresh Siddha <suresh.b.siddha@intel.com>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      LKML-Reference: <49F65509.60307@kernel.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      57b150cc
  6. 14 4月, 2009 1 次提交
    • P
      x86, irq: Remove IRQ_DISABLED check in process context IRQ move · 6ec3cfec
      Pallipadi, Venkatesh 提交于
      As discussed in the thread here:
      
        http://marc.info/?l=linux-kernel&m=123964468521142&w=2
      
      Eric W. Biederman observed:
      
      > It looks like some additional bugs have slipped in since last I looked.
      >
      > set_irq_affinity does this:
      > ifdef CONFIG_GENERIC_PENDING_IRQ
      >        if (desc->status & IRQ_MOVE_PCNTXT || desc->status & IRQ_DISABLED) {
      >                cpumask_copy(desc->affinity, cpumask);
      >                desc->chip->set_affinity(irq, cpumask);
      >        } else {
      >                desc->status |= IRQ_MOVE_PENDING;
      >                cpumask_copy(desc->pending_mask, cpumask);
      >        }
      > #else
      >
      > That IRQ_DISABLED case is a software state and as such it has nothing to
      > do with how safe it is to move an irq in process context.
      
      [...]
      
      >
      > The only reason we migrate MSIs in interrupt context today is that there
      > wasn't infrastructure for support migration both in interrupt context
      > and outside of it.
      
      Yes. The idea here was to force the MSI migration to happen in process
      context. One of the patches in the series did
      
              disable_irq(dev->irq);
              irq_set_affinity(dev->irq, cpumask_of(dev->cpu));
              enable_irq(dev->irq);
      
      with the above patch adding irq/manage code check for interrupt disabled
      and moving the interrupt in process context.
      
      IIRC, there was no IRQ_MOVE_PCNTXT when we were developing this HPET
      code and we ended up having this ugly hack. IRQ_MOVE_PCNTXT was there
      when we eventually submitted the patch upstream. But, looks like I did a
      blind rebasing instead of using IRQ_MOVE_PCNTXT in hpet MSI code.
      
      Below patch fixes this. i.e., revert commit 932775a4
      and add PCNTXT to HPET MSI setup. Also removes copying of desc->affinity
      in generic code as set_affinity routines are doing it internally.
      Reported-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      Signed-off-by: NVenkatesh Pallipadi <venkatesh.pallipadi@intel.com>
      Acked-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      Cc: "Li Shaohua" <shaohua.li@intel.com>
      Cc: Gary Hade <garyhade@us.ibm.com>
      Cc: "lcm@us.ibm.com" <lcm@us.ibm.com>
      Cc: suresh.b.siddha@intel.com
      LKML-Reference: <20090413222058.GB8211@linux-os.sc.intel.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      6ec3cfec
  7. 31 3月, 2009 1 次提交
    • R
      PM: Introduce functions for suspending and resuming device interrupts · 0a0c5168
      Rafael J. Wysocki 提交于
      Introduce helper functions allowing us to prevent device drivers from
      getting any interrupts (without disabling interrupts on the CPU)
      during suspend (or hibernation) and to make them start to receive
      interrupts again during the subsequent resume.  These functions make it
      possible to keep timer interrupts enabled while the "late" suspend and
      "early" resume callbacks provided by device drivers are being
      executed.  In turn, this allows device drivers' "late" suspend and
      "early" resume callbacks to sleep, execute ACPI callbacks etc.
      
      The functions introduced here will be used to rework the handling of
      interrupts during suspend (hibernation) and resume.  Namely,
      interrupts will only be disabled on the CPU right before suspending
      sysdevs, while device drivers will be prevented from receiving
      interrupts, with the help of the new helper function, before their
      "late" suspend callbacks run (and analogously during resume).
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NIngo Molnar <mingo@elte.hu>
      0a0c5168
  8. 24 3月, 2009 2 次提交
    • T
      genirq: threaded irq handlers review fixups · f48fe81e
      Thomas Gleixner 提交于
      Delta patch to address the review comments.
      
            - Implement warning when IRQ_WAKE_THREAD is requested and no
              thread handler installed
            - coding style fixes
      Pointed-out-by: NChristoph Hellwig <hch@infradead.org>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      f48fe81e
    • T
      genirq: add threaded interrupt handler support · 3aa551c9
      Thomas Gleixner 提交于
      Add support for threaded interrupt handlers:
      
      A device driver can request that its main interrupt handler runs in a
      thread. To achive this the device driver requests the interrupt with
      request_threaded_irq() and provides additionally to the handler a
      thread function. The handler function is called in hard interrupt
      context and needs to check whether the interrupt originated from the
      device. If the interrupt originated from the device then the handler
      can either return IRQ_HANDLED or IRQ_WAKE_THREAD. IRQ_HANDLED is
      returned when no further action is required. IRQ_WAKE_THREAD causes
      the genirq code to invoke the threaded (main) handler. When
      IRQ_WAKE_THREAD is returned handler must have disabled the interrupt
      on the device level. This is mandatory for shared interrupt handlers,
      but we need to do it as well for obscure x86 hardware where disabling
      an interrupt on the IO_APIC level redirects the interrupt to the
      legacy PIC interrupt lines.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: NIngo Molnar <mingo@elte.hu>
      3aa551c9
  9. 13 3月, 2009 2 次提交
  10. 12 3月, 2009 3 次提交
  11. 18 2月, 2009 2 次提交
  12. 15 2月, 2009 2 次提交
  13. 13 2月, 2009 1 次提交
  14. 09 2月, 2009 1 次提交
  15. 28 1月, 2009 2 次提交
  16. 12 1月, 2009 1 次提交
    • M
      cpumask: update irq_desc to use cpumask_var_t · 7f7ace0c
      Mike Travis 提交于
      Impact: reduce memory usage, use new cpumask API.
      
      Replace the affinity and pending_masks with cpumask_var_t's.  This adds
      to the significant size reduction done with the SPARSE_IRQS changes.
      
      The added functions (init_alloc_desc_masks & init_copy_desc_masks) are
      in the include file so they can be inlined (and optimized out for the
      !CONFIG_CPUMASKS_OFFSTACK case.)  [Naming chosen to be consistent with
      the other init*irq functions, as well as the backwards arg declaration
      of "from, to" instead of the more common "to, from" standard.]
      
      Includes a slight change to the declaration of struct irq_desc to embed
      the pending_mask within ifdef(CONFIG_SMP) to be consistent with other
      references, and some small changes to Xen.
      
      Tested: sparse/non-sparse/cpumask_offstack/non-cpumask_offstack/nonuma/nosmp on x86_64
      Signed-off-by: NMike Travis <travis@sgi.com>
      Cc: Chris Wright <chrisw@sous-sol.org>
      Cc: Jeremy Fitzhardinge <jeremy@xensource.com>
      Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Cc: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
      Cc: virtualization@lists.osdl.org
      Cc: xen-devel@lists.xensource.com
      Cc: Yinghai Lu <yhlu.kernel@gmail.com>
      7f7ace0c
  17. 01 1月, 2009 1 次提交
  18. 29 12月, 2008 2 次提交
    • Y
      sparseirq: move __weak symbols into separate compilation unit · 43a25632
      Yinghai Lu 提交于
      GCC has a bug with __weak alias functions: if the functions are in
      the same compilation unit as their call site, GCC can decide to
      inline them - and thus rob the linker of the opportunity to override
      the weak alias with the real thing.
      
      So move all the IRQ handling related __weak symbols to kernel/irq/chip.c.
      Signed-off-by: NYinghai Lu <yinghai@kernel.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      43a25632
    • I
      sparseirq: work around __weak alias bug · b2e2fe99
      Ingo Molnar 提交于
      Impact: fix boot crash if the kernel is built with certain GCC versions
      
      GCC has a bug with __weak alias functions: if the functions are in
      the same compilation unit as their call site, GCC can decide to
      inline them - and thus rob the linker of the opportunity to override
      the weak alias with the real thing.
      
      This can lead to the boot crash reported by Kamalesh Babulal:
      
       ACPI: Core revision 20080926
       Setting APIC routing to flat
       BUG: unable to handle kernel NULL pointer dereference at
       0000000000000000
       IP: [<ffffffff8021f9a8>] add_pin_to_irq_cpu+0x14/0x74
       PGD 0
       Oops: 0000 [#1] SMP
       [...]
      
      So move the arch_init_chip_data() function from handle.c to manage.c.
      Reported-by: NKamalesh Babulal <kamalesh@linux.vnet.ibm.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      b2e2fe99
  19. 13 12月, 2008 1 次提交
  20. 02 12月, 2008 2 次提交
  21. 13 11月, 2008 1 次提交
    • M
      genirq: __irq_set_trigger: change pr_warning to pr_debug · 3ff68a6a
      Mark Nelson 提交于
      Commit 0c5d1eb7 (genirq: record trigger
      type) caused powerpc platforms that had no set_type() function in their
      struct irq_chip to spew out warnings about "No set_type function for
      IRQ...". This warning isn't necessarily justified though because the
      generic powerpc platform code calls set_irq_type() (which in turn calls
      __irq_set_trigger) with information from the device tree to establish
      the interrupt mappings, regardless of whether the PIC can actually set
      a type.
      
      A platform's irq_chip might not have a set_type function for a variety
      of reasons, for example: the platform may have the type essentially
      hard-coded, or as in the case for Cell interrupts are just messages
      past around that have no real concept of type, or the platform
      could even have a virtual PIC as on the PS3.
      Signed-off-by: NMark Nelson <markn@au1.ibm.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      3ff68a6a
  22. 10 11月, 2008 3 次提交
  23. 16 10月, 2008 7 次提交