1. 09 3月, 2016 1 次提交
    • C
      x86/ACPI/PCI: Recognize that Interrupt Line 255 means "not connected" · e237a551
      Chen Fan 提交于
      Per the x86-specific footnote to PCI spec r3.0, sec 6.2.4, the value 255 in
      the Interrupt Line register means "unknown" or "no connection."
      Previously, when we couldn't derive an IRQ from the _PRT, we fell back to
      using the value from Interrupt Line as an IRQ.  It's questionable whether
      we should do that at all, but the spec clearly suggests we shouldn't do it
      for the value 255 on x86.
      
      Calling request_irq() with IRQ 255 may succeed, but the driver won't
      receive any interrupts.  Or, if IRQ 255 is shared with another device, it
      may succeed, and the driver's ISR will be called at random times when the
      *other* device interrupts.  Or it may fail if another device is using IRQ
      255 with incompatible flags.  What we *want* is for request_irq() to fail
      predictably so the driver can fall back to polling.
      
      On x86, assume 255 in the Interrupt Line means the INTx line is not
      connected.  In that case, set dev->irq to IRQ_NOTCONNECTED so request_irq()
      will fail gracefully with -ENOTCONN.
      
      We found this problem on a system where Secure Boot firmware assigned
      Interrupt Line 255 to an i801_smbus device and another device was already
      using MSI-X IRQ 255.  This was in v3.10, where i801_probe() fails if
      request_irq() fails:
      
        i801_smbus 0000:00:1f.3: enabling device (0140 -> 0143)
        i801_smbus 0000:00:1f.3: can't derive routing for PCI INT C
        i801_smbus 0000:00:1f.3: PCI INT C: no GSI
        genirq: Flags mismatch irq 255. 00000080 (i801_smbus) vs. 00000000 (megasa)
        CPU: 0 PID: 2487 Comm: kworker/0:1 Not tainted 3.10.0-229.el7.x86_64 #1
        Hardware name: FUJITSU PRIMEQUEST 2800E2/D3736, BIOS PRIMEQUEST 2000 Serie5
        Call Trace:
          dump_stack+0x19/0x1b
          __setup_irq+0x54a/0x570
          request_threaded_irq+0xcc/0x170
          i801_probe+0x32f/0x508 [i2c_i801]
          local_pci_probe+0x45/0xa0
        i801_smbus 0000:00:1f.3: Failed to allocate irq 255: -16
        i801_smbus: probe of 0000:00:1f.3 failed with error -16
      
      After aeb8a3d1 ("i2c: i801: Check if interrupts are disabled"),
      i801_probe() will fall back to polling if request_irq() fails.  But we
      still need this patch because request_irq() may succeed or fail depending
      on other devices in the system.  If request_irq() fails, i801_smbus will
      work by falling back to polling, but if it succeeds, i801_smbus won't work
      because it expects interrupts that it may not receive.
      Signed-off-by: NChen Fan <chen.fan.fnst@cn.fujitsu.com>
      Acked-by: NThomas Gleixner <tglx@linutronix.de>
      Acked-by: NBjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      e237a551
  2. 14 12月, 2015 1 次提交
    • T
      genirq: Prevent chip buslock deadlock · abc7e40c
      Thomas Gleixner 提交于
      If a interrupt chip utilizes chip->buslock then free_irq() can
      deadlock in the following way:
      
      CPU0				CPU1
      				interrupt(X) (Shared or spurious)
      free_irq(X)			interrupt_thread(X)
      chip_bus_lock(X)
      				   irq_finalize_oneshot(X)
      				     chip_bus_lock(X)
      synchronize_irq(X)
      	
      synchronize_irq() waits for the interrupt thread to complete,
      i.e. forever.
      
      Solution is simple: Drop chip_bus_lock() before calling
      synchronize_irq() as we do with the irq_desc lock. There is nothing to
      be protected after the point where irq_desc lock has been released.
      
      This adds chip_bus_lock/unlock() to the remove_irq() code path, but
      that's actually correct in the case where remove_irq() is called on
      such an interrupt. The current users of remove_irq() are not affected
      as none of those interrupts is on a chip which requires buslock.
      Reported-by: NFredrik Markström <fredrik.markstrom@gmail.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: stable@vger.kernel.org
      abc7e40c
  3. 08 12月, 2015 1 次提交
    • T
      genirq: Implement irq_percpu_is_enabled() · f0cb3220
      Thomas Petazzoni 提交于
      Certain interrupt controller drivers have a register set that does not
      make it easy to save/restore the mask of enabled/disabled interrupts
      at suspend/resume time. At resume time, such drivers rely on the core
      kernel irq subsystem to tell whether such or such interrupt is enabled
      or not, in order to restore the proper state in the interrupt
      controller register.
      
      While the irqd_irq_disabled() provides the relevant information for
      global interrupts, there is no similar function to query the
      enabled/disabled state of a per-CPU interrupt.
      
      Therefore, this commit complements the percpu_irq API with an
      irq_percpu_is_enabled() function.
      
      [ tglx: Simplified the implementation and added kerneldoc ]
      Signed-off-by: NThomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: Tawfik Bayouk <tawfik@marvell.com>
      Cc: Nadav Haklai <nadavh@marvell.com>
      Cc: Lior Amsalem <alior@marvell.com>
      Cc: Andrew Lunn <andrew@lunn.ch>
      Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
      Cc: Gregory Clement <gregory.clement@free-electrons.com>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Link: http://lkml.kernel.org/r/1445347435-2333-2-git-send-email-thomas.petazzoni@free-electrons.comSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      f0cb3220
  4. 11 10月, 2015 1 次提交
    • T
      genirq: Add flag to force mask in disable_irq[_nosync]() · e9849777
      Thomas Gleixner 提交于
      If an irq chip does not implement the irq_disable callback, then we
      use a lazy approach for disabling the interrupt. That means that the
      interrupt is marked disabled, but the interrupt line is not
      immediately masked in the interrupt chip. It only becomes masked if
      the interrupt is raised while it's marked disabled. We use this to avoid
      possibly expensive mask/unmask operations for common case operations.
      
      Unfortunately there are devices which do not allow the interrupt to be
      disabled easily at the device level. They are forced to use
      disable_irq_nosync(). This can result in taking each interrupt twice.
      
      Instead of enforcing the non lazy mode on all interrupts of a irq
      chip, provide a settings flag, which can be set by the driver for that
      particular interrupt line.
      Reported-and-tested-by: NDuc Dang <dhdang@apm.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Link: http://lkml.kernel.org/r/alpine.DEB.2.11.1510092348370.6097@nanos
      e9849777
  5. 10 10月, 2015 1 次提交
  6. 30 9月, 2015 2 次提交
  7. 22 9月, 2015 1 次提交
    • T
      genirq: Handle force threading of irqs with primary and thread handler · 2a1d3ab8
      Thomas Gleixner 提交于
      Force threading of interrupts does not really deal with interrupts
      which are requested with a primary and a threaded handler. The current
      policy is to leave them alone and let the primary handler run in
      interrupt context, but we set the ONESHOT flag for those interrupts as
      well.
      
      Kohji Okuno debugged a problem with the SDHCI driver where the
      interrupt thread waits for a hardware interrupt to trigger, which can't
      work well because the hardware interrupt is masked due to the ONESHOT
      flag being set. He proposed to set the ONESHOT flag only if the
      interrupt does not provide a thread handler.
      
      Though that does not work either because these interrupts can be
      shared. So the other interrupt would rightfully get the ONESHOT flag
      set and therefor the same situation would happen again.
      
      To deal with this proper, we need to force thread the primary handler
      of such interrupts as well. That means that the primary interrupt
      handler is treated as any other primary interrupt handler which is not
      marked IRQF_NO_THREAD. The threaded handler becomes a separate thread
      so the SDHCI flow logic can be handled gracefully.
      
      The same issue was reported against 4.1-rt.
      Reported-and-tested-by: NKohji Okuno <okuno.kohji@jp.panasonic.com>
      Reported-By: NMichal Smucr <msmucr@gmail.com>
      Reported-and-tested-by: NNathan Sullivan <nathan.sullivan@ni.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
      Link: http://lkml.kernel.org/r/alpine.DEB.2.11.1509211058080.5606@nanosSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      2a1d3ab8
  8. 16 9月, 2015 1 次提交
  9. 27 7月, 2015 1 次提交
  10. 12 7月, 2015 5 次提交
  11. 12 6月, 2015 1 次提交
  12. 19 5月, 2015 1 次提交
    • J
      genirq: Introduce irq_set_vcpu_affinity() to target an interrupt to a VCPU · 0a4377de
      Jiang Liu 提交于
      With Posted-Interrupts support in Intel CPU and IOMMU, an external
      interrupt from assigned-devices could be directly delivered to a
      virtual CPU in a virtual machine. Instead of hacking KVM and Intel
      IOMMU drivers, we propose a platform independent interface to target
      an interrupt to a specific virtual CPU in a virtual machine, or set
      virtual CPU affinity for an interrupt.
      
      By adopting this new interface and the hierarchy irqdomain, we could
      easily support posted-interrupts on Intel platforms, and also provide
      flexible enough interfaces for other platforms to support similar
      features.
      
      Here is the usage scenario for this interface:
      Guest update MSI/MSI-X interrupt configuration
              -->QEMU and KVM handle this
              -->KVM call this interface (passing posted interrupts descriptor
                 and guest vector)
              -->irq core will transfer the control to IOMMU
              -->IOMMU will do the real work of updating IRTE (IRTE has new
                 format for VT-d Posted-Interrupts)
      Signed-off-by: NJiang Liu <jiang.liu@linux.intel.com>
      Signed-off-by: NFeng Wu <feng.wu@intel.com>
      Link: http://lkml.kernel.org/r/1432026437-16560-2-git-send-email-feng.wu@intel.comSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      0a4377de
  13. 09 4月, 2015 1 次提交
    • M
      genirq: Allow the irqchip state of an IRQ to be save/restored · 1b7047ed
      Marc Zyngier 提交于
      There is a number of cases where a kernel subsystem may want to
      introspect the state of an interrupt at the irqchip level:
      
      - When a peripheral is shared between virtual machines,
        its interrupt state becomes part of the guest's state,
        and must be switched accordingly. KVM on arm/arm64 requires
        this for its guest-visible timer
      - Some GPIO controllers seem to require peeking into the
        interrupt controller they are connected to to report
        their internal state
      
      This seem to be a pattern that is common enough for the core code
      to try and support this without too many horrible hacks. Introduce
      a pair of accessors (irq_get_irqchip_state/irq_set_irqchip_state)
      to retrieve the bits that can be of interest to another subsystem:
      pending, active, and masked.
      
      - irq_get_irqchip_state returns the state of the interrupt according
        to a parameter set to IRQCHIP_STATE_PENDING, IRQCHIP_STATE_ACTIVE,
        IRQCHIP_STATE_MASKED or IRQCHIP_STATE_LINE_LEVEL.
      - irq_set_irqchip_state similarly sets the state of the interrupt.
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Reviewed-by: NBjorn Andersson <bjorn.andersson@sonymobile.com>
      Tested-by: NBjorn Andersson <bjorn.andersson@sonymobile.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
      Cc: Stephen Boyd <sboyd@codeaurora.org>
      Cc: Phong Vo <pvo@apm.com>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: Tin Huynh <tnhuynh@apm.com>
      Cc: Y Vo <yvo@apm.com>
      Cc: Toan Le <toanle@apm.com>
      Cc: Bjorn Andersson <bjorn@kryo.se>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Link: http://lkml.kernel.org/r/1426676484-21812-2-git-send-email-marc.zyngier@arm.comSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      1b7047ed
  14. 05 3月, 2015 1 次提交
    • R
      genirq / PM: Add flag for shared NO_SUSPEND interrupt lines · 17f48034
      Rafael J. Wysocki 提交于
      It currently is required that all users of NO_SUSPEND interrupt
      lines pass the IRQF_NO_SUSPEND flag when requesting the IRQ or the
      WARN_ON_ONCE() in irq_pm_install_action() will trigger.  That is
      done to warn about situations in which unprepared interrupt handlers
      may be run unnecessarily for suspended devices and may attempt to
      access those devices by mistake.  However, it may cause drivers
      that have no technical reasons for using IRQF_NO_SUSPEND to set
      that flag just because they happen to share the interrupt line
      with something like a timer.
      
      Moreover, the generic handling of wakeup interrupts introduced by
      commit 9ce7a258 (genirq: Simplify wakeup mechanism) only works
      for IRQs without any NO_SUSPEND users, so the drivers of wakeup
      devices needing to use shared NO_SUSPEND interrupt lines for
      signaling system wakeup generally have to detect wakeup in their
      interrupt handlers.  Thus if they happen to share an interrupt line
      with a NO_SUSPEND user, they also need to request that their
      interrupt handlers be run after suspend_device_irqs().
      
      In both cases the reason for using IRQF_NO_SUSPEND is not because
      the driver in question has a genuine need to run its interrupt
      handler after suspend_device_irqs(), but because it happens to
      share the line with some other NO_SUSPEND user.  Otherwise, the
      driver would do without IRQF_NO_SUSPEND just fine.
      
      To make it possible to specify that condition explicitly, introduce
      a new IRQ action handler flag for shared IRQs, IRQF_COND_SUSPEND,
      that, when set, will indicate to the IRQ core that the interrupt
      user is generally fine with suspending the IRQ, but it also can
      tolerate handler invocations after suspend_device_irqs() and, in
      particular, it is capable of detecting system wakeup and triggering
      it as appropriate from its interrupt handler.
      
      That will allow us to work around a problem with a shared timer
      interrupt line on at91 platforms.
      
      Link: http://marc.info/?l=linux-kernel&m=142252777602084&w=2
      Link: http://marc.info/?t=142252775300011&r=1&w=2
      Link: https://lkml.org/lkml/2014/12/15/552Reported-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: NMark Rutland <mark.rutland@arm.com>
      17f48034
  15. 18 2月, 2015 1 次提交
    • P
      genirq: Provide disable_hardirq() · 02cea395
      Peter Zijlstra 提交于
      For things like netpoll there is a need to disable an interrupt from
      atomic context. Currently netpoll uses disable_irq() which will
      sleep-wait on threaded handlers and thus forced_irqthreads breaks
      things.
      
      Provide disable_hardirq(), which uses synchronize_hardirq() to only wait
      for active hardirq handlers; also change synchronize_hardirq() to
      return the status of threaded handlers.
      
      This will allow one to try-disable an interrupt from atomic context, or
      in case of request_threaded_irq() to only wait for the hardirq part.
      Suggested-by: NSabrina Dubroca <sd@queasysnail.net>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: David Miller <davem@davemloft.net>
      Cc: Eyal Perry <eyalpe@mellanox.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Quentin Lambert <lambert.quentin@gmail.com>
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Cc: Russell King <linux@arm.linux.org.uk>
      Link: http://lkml.kernel.org/r/20150205130623.GH5029@twins.programming.kicks-ass.net
      [ Fixed typos and such. ]
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      02cea395
  16. 10 2月, 2015 1 次提交
  17. 23 1月, 2015 1 次提交
    • J
      genirq: Set initial affinity in irq_set_affinity_hint() · e2e64a93
      Jesse Brandeburg 提交于
      Problem:
      The default behavior of the kernel is somewhat undesirable as all
      requested interrupts end up on CPU0 after registration.  A user can
      run irqbalance daemon, or can manually configure smp_affinity via the
      proc filesystem, but the default affinity of the interrupts for all
      devices is always CPU zero, this can cause performance problems or
      very heavy cpu use of only one core if not noticed and fixed by the
      user.
      
      Solution:
      Enable the setting of the initial affinity directly when the driver
      sets a hint.
      
      This enabling means that kernel drivers can include an initial
      affinity setting for the interrupt, instead of all interrupts starting
      out life on CPU0. Of course if irqbalance is still running then the
      interrupts will get moved as before.
      
      This function is currently called by drivers in block, crypto,
      infiniband, ethernet and scsi trees, but only a handful, so these will
      be the devices affected by this change.
      
      Tested on i40e, and default interrupts were spread across the CPUs
      according to the hint.
      
      drivers/block/mtip32xx/mtip32xx.c:3
      drivers/block/nvme-core.c:2
      drivers/crypto/qat/qat_dh895xcc/adf_isr.c:3
      drivers/infiniband/hw/qib/qib_iba7322.c:2
      drivers/net/ethernet/intel/i40e/i40e_main.c:3
      drivers/net/ethernet/intel/i40evf/i40evf_main.c:3
      drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:3
      drivers/net/ethernet/mellanox/mlx4/en_cq.c:2
      drivers/scsi/hpsa.c:3
      drivers/scsi/lpfc/lpfc_init.c:3
      drivers/scsi/megaraid/megaraid_sas_base.c:8
      drivers/soc/ti/knav_qmss_acc.c:1
      drivers/soc/ti/knav_qmss_queue.c:2
      drivers/virtio/virtio_pci_common.c:2
      Signed-off-by: NJesse Brandeburg <jesse.brandeburg@intel.com>
      Cc: netdev@vger.kernel.org
      Link: http://lkml.kernel.org/r/20141219012206.4220.27491.stgit@jbrandeb-cp2.jf.intel.comSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      e2e64a93
  18. 23 11月, 2014 1 次提交
    • J
      genirq: Add IRQ_SET_MASK_OK_DONE to support stacked irqchip · 2cb62547
      Jiang Liu 提交于
      Add IRQ_SET_MASK_OK_DONE in addition to IRQ_SET_MASK_OK and
      IRQ_SET_MASK_OK_NOCOPY to support stacked irqchip. IRQ_SET_MASK_OK_DONE
      is the same as IRQ_SET_MASK_OK to irq core. To stacked irqchip, it means
      that ascendant irqchips have done all the work and no more handling
      needed in descendant irqchips.
      Signed-off-by: NJiang Liu <jiang.liu@linux.intel.com>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Grant Likely <grant.likely@linaro.org>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Yingjoe Chen <yingjoe.chen@mediatek.com>
      Cc: Yijing Wang <wangyijing@huawei.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      2cb62547
  19. 01 9月, 2014 2 次提交
  20. 01 8月, 2014 2 次提交
  21. 24 7月, 2014 1 次提交
  22. 15 7月, 2014 1 次提交
    • R
      PM / sleep / irq: Do not suspend wakeup interrupts · d709f7bc
      Rafael J. Wysocki 提交于
      If an IRQ has been configured for wakeup via enable_irq_wake(), the
      driver who has done that must be prepared for receiving interrupts
      after suspend_device_irqs() has returned, so there is no need to
      "suspend" such IRQs.  Moreover, if drivers using enable_irq_wake()
      actually want to receive interrupts after suspend_device_irqs() has
      returned, they need to add IRQF_NO_SUSPEND to the IRQ flags while
      requesting the IRQs, which shouldn't be necessary (it also goes a bit
      too far, as IRQF_NO_SUSPEND causes the IRQ to be ignored by
      suspend_device_irqs() all the time regardless of whether or not it
      has been configured for signaling wakeup).
      
      For the above reasons, make __disable_irq() ignore IRQ descriptors
      with IRQD_WAKEUP_STATE set when its suspend argument is true which
      effectively causes them to behave like IRQs with IRQF_NO_SUSPEND
      set.
      
      This also allows IRQs configured for wakeup via enable_irq_wake()
      to work as wakeup interrupts for the "freeze" (suspend-to-idle)
      sleep mode automatically just like for any other sleep states.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Cc: Li Aubrey <aubrey.li@linux.intel.com>
      Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
      Cc: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
      Link: http://lkml.kernel.org/r/4679574.kGUnqAuNl9@vostro.rjw.lanSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      d709f7bc
  23. 04 5月, 2014 1 次提交
    • T
      genirq: Sanitize spurious interrupt detection of threaded irqs · 1e77d0a1
      Thomas Gleixner 提交于
      Till reported that the spurious interrupt detection of threaded
      interrupts is broken in two ways:
      
      - note_interrupt() is called for each action thread of a shared
        interrupt line. That's wrong as we are only interested whether none
        of the device drivers felt responsible for the interrupt, but by
        calling multiple times for a single interrupt line we account
        IRQ_NONE even if one of the drivers felt responsible.
      
      - note_interrupt() when called from the thread handler is not
        serialized. That leaves the members of irq_desc which are used for
        the spurious detection unprotected.
      
      To solve this we need to defer the spurious detection of a threaded
      interrupt to the next hardware interrupt context where we have
      implicit serialization.
      
      If note_interrupt is called with action_ret == IRQ_WAKE_THREAD, we
      check whether the previous interrupt requested a deferred check. If
      not, we request a deferred check for the next hardware interrupt and
      return. 
      
      If set, we check whether one of the interrupt threads signaled
      success. Depending on this information we feed the result into the
      spurious detector.
      
      If one primary handler of a shared interrupt returns IRQ_HANDLED we
      disable the deferred check of irq threads on the same line, as we have
      found at least one device driver who cared.
      Reported-by: NTill Straumann <strauman@slac.stanford.edu>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Tested-by: NAustin Schuh <austin@peloton-tech.com>
      Cc: Oliver Hartkopp <socketcan@hartkopp.net>
      Cc: Wolfgang Grandegger <wg@grandegger.com>
      Cc: Pavel Pisa <pisa@cmp.felk.cvut.cz>
      Cc: Marc Kleine-Budde <mkl@pengutronix.de>
      Cc: linux-can@vger.kernel.org
      Cc: stable@vger.kernel.org
      Link: http://lkml.kernel.org/r/alpine.LFD.2.02.1303071450130.22263@ionos
      1e77d0a1
  24. 18 4月, 2014 1 次提交
    • T
      genirq: Allow forcing cpu affinity of interrupts · 01f8fa4f
      Thomas Gleixner 提交于
      The current implementation of irq_set_affinity() refuses rightfully to
      route an interrupt to an offline cpu.
      
      But there is a special case, where this is actually desired. Some of
      the ARM SoCs have per cpu timers which require setting the affinity
      during cpu startup where the cpu is not yet in the online mask.
      
      If we can't do that, then the local timer interrupt for the about to
      become online cpu is routed to some random online cpu.
      
      The developers of the affected machines tried to work around that
      issue, but that results in a massive mess in that timer code.
      
      We have a yet unused argument in the set_affinity callbacks of the irq
      chips, which I added back then for a similar reason. It was never
      required so it got not used. But I'm happy that I never removed it.
      
      That allows us to implement a sane handling of the above scenario. So
      the affected SoC drivers can add the required force handling to their
      interrupt chip, switch the timer code to irq_force_affinity() and
      things just work.
      
      This does not affect any existing user of irq_set_affinity().
      
      Tagged for stable to allow a simple fix of the affected SoC clock
      event drivers.
      Reported-and-tested-by: NKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Kyungmin Park <kyungmin.park@samsung.com>
      Cc: Marek Szyprowski <m.szyprowski@samsung.com>
      Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
      Cc: Tomasz Figa <t.figa@samsung.com>,
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>,
      Cc: Kukjin Kim <kgene.kim@samsung.com>
      Cc: linux-arm-kernel@lists.infradead.org,
      Cc: stable@vger.kernel.org
      Link: http://lkml.kernel.org/r/20140416143315.717251504@linutronix.deSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      01f8fa4f
  25. 14 3月, 2014 1 次提交
  26. 12 3月, 2014 1 次提交
  27. 27 2月, 2014 1 次提交
    • C
      genirq: Remove racy waitqueue_active check · c685689f
      Chuansheng Liu 提交于
      We hit one rare case below:
      
      T1 calling disable_irq(), but hanging at synchronize_irq()
      always;
      The corresponding irq thread is in sleeping state;
      And all CPUs are in idle state;
      
      After analysis, we found there is one possible scenerio which
      causes T1 is waiting there forever:
      CPU0                                       CPU1
       synchronize_irq()
        wait_event()
          spin_lock()
                                                 atomic_dec_and_test(&threads_active)
            insert the __wait into queue
          spin_unlock()
                                                 if(waitqueue_active)
          atomic_read(&threads_active)
                                                   wake_up()
      
      Here after inserted the __wait into queue on CPU0, and before
      test if queue is empty on CPU1, there is no barrier, it maybe
      cause it is not visible for CPU1 immediately, although CPU0 has
      updated the queue list.
      It is similar for CPU0 atomic_read() threads_active also.
      
      So we'd need one smp_mb() before waitqueue_active.that, but removing
      the waitqueue_active() check solves it as wel l and it makes
      things simple and clear.
      Signed-off-by: NChuansheng Liu <chuansheng.liu@intel.com>
      Cc: Xiaoming Wang <xiaoming.wang@intel.com>
      Link: http://lkml.kernel.org/r/1393212590-32543-1-git-send-email-chuansheng.liu@intel.com
      Cc: stable@vger.kernel.org
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      c685689f
  28. 20 2月, 2014 3 次提交
    • C
      b04c644e
    • T
      genirq: Provide irq_wake_thread() · a92444c6
      Thomas Gleixner 提交于
      In course of the sdhci/sdio discussion with Russell about killing the
      sdio kthread hackery we discovered the need to be able to wake an
      interrupt thread from software.
      
      The rationale for this is, that sdio hardware can lack proper
      interrupt support for certain features. So the driver needs to poll
      the status registers, but at the same time it needs to be woken up by
      an hardware interrupt.
      
      To be able to get rid of the home brewn kthread construct of sdio we
      need a way to wake an irq thread independent of an actual hardware
      interrupt.
      
      Provide an irq_wake_thread() function which wakes up the thread which
      is associated to a given dev_id. This allows sdio to invoke the irq
      thread from the hardware irq handler via the IRQ_WAKE_THREAD return
      value and provides a possibility to wake it via a timer for the
      polling scenarios. That allows to simplify the sdio logic
      significantly.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Chris Ball <chris@printf.net>
      Acked-by: NPeter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20140215003823.772565780@linutronix.de
      a92444c6
    • T
      genirq: Provide synchronize_hardirq() · 18258f72
      Thomas Gleixner 提交于
      synchronize_irq() waits for hard irq and threaded handlers to complete
      before returning. For some special cases we only need to make sure
      that the hard interrupt part of the irq line is not in progress when
      we disabled the - possibly shared - interrupt at the device level.
      
      A proper use case for this was provided by Russell. The sdhci driver
      requires some irq triggered functions to be run in thread context. The
      current implementation of the thread context is a sdio private kthread
      construct, which has quite some shortcomings. These can be avoided
      when the thread is directly associated to the device interrupt via the
      generic threaded irq infrastructure.
      
      Though there is a corner case related to run time power management
      where one side disables the device interrupts at the device level and
      needs to make sure, that an already running hard interrupt handler has
      completed before proceeding further. Though that hard interrupt
      handler might wake the associated thread, which in turn can request
      the runtime PM to reenable the device. Using synchronize_irq() leads
      to an immediate deadlock of the irq thread waiting for the PM lock and
      the synchronize_irq() waiting for the irq thread to complete.
      
      Due to the fact that it is sufficient for this case to ensure that no
      hard irq handler is executing a new function which avoids the check
      for the thread is required.
      
      Add a function, which just monitors the hard irq parts and ignores the
      threaded handlers.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Tested-by: NRussell King <linux@arm.linux.org.uk>
      Cc: Chris Ball <chris@printf.net>
      Acked-by: NPeter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20140215003823.653236081@linutronix.de
      18258f72
  29. 28 10月, 2013 1 次提交
  30. 18 10月, 2013 1 次提交
  31. 28 6月, 2013 1 次提交