linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/26] genirq: fix use of irq_find_mapping outside of legal RCU context
@ 2014-08-26 10:03 Marc Zyngier
  2014-08-26 10:03 ` [PATCH v2 01/26] genirq: add irq_domain-aware core IRQ handler Marc Zyngier
                   ` (27 more replies)
  0 siblings, 28 replies; 54+ messages in thread
From: Marc Zyngier @ 2014-08-26 10:03 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel, linux-omap, linux
  Cc: linux, shawn.guo, kernel, tony, catalin.marinas, will.deacon,
	jonas, tglx, jason, shc_work, baohua, maxime.ripard,
	marc.zyngier, khilman, sboyd, lorenzo.pieralisi, larry.bassel,
	mark.rutland, sudeep.holla, stefan.kristiansson, vkale,
	schwidefsky

A number of irqchip drivers are directly calling irq_find_mapping,
which may use a rcu_read_lock call when walking the radix tree.

Turns out that if you hit that point with CONFIG_PROVE_RCU enabled,
the kernel will shout at you, as using RCU in this context may be
illegal (specially if coming from the idle state, where RCU would be
in a quiescent state).

A possible fix would be to wrap calls to irq_find_mapping into a
RCU_NONIDLE macro, but that really looks ugly.

This patch series introduce another generic IRQ entry point
(handle_domain_irq), which has the exact same behaviour as handle_IRQ
(as defined on arm, arm64 and openrisc), except that it also takes a
irq_domain pointer. This allows the logical IRQ lookup to be done
inside the irq_{enter,exit} section, which contains a
rcu_irq_{enter,exit}, making it safe.

A number of irqchips are then converted to this new entry point. I've
converted all the direct users of irq_find_mapping, except for the
cases where it was used as a chained handler (chained_irq_{enter,exit}
makes it safe). Users of irq_linear_revmap are safe as well. I've
given it some light testing on arm64.

The series is also available in my tree:

git://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git handle_domain_irq

>From v1 [1]:
- Made handle_domain_irq a generic function
- Added OpenRISC to the list of affected architectures
- Converted more interrupt controllers
- Rebased on v3.17-rc1

[1]: https://lkml.org/lkml/2014/7/8/381

Marc Zyngier (26):
  genirq: add irq_domain-aware core IRQ handler
  arm64: convert handle_IRQ to use __handle_domain_irq
  ARM: convert handle_IRQ to use __handle_domain_irq
  openrisc: convert handle_IRQ to use __handle_domain_irq
  irqchip: GIC: convert to handle_domain_irq
  irqchip: armada-370-xp: convert to handle_domain_irq
  irqchip: clps711x: convert to handle_domain_irq
  irqchip: mmp: convert to handle_domain_irq
  irqchip: mxs: convert to handle_domain_irq
  irqchip: orion: convert to handle_domain_irq
  irqchip: s3c24xx: convert to handle_domain_irq
  irqchip: sirfsoc: convert to handle_domain_irq
  irqchip: sun4i: convert to handle_domain_irq
  irqchip: versatile-fpga: convert to handle_domain_irq
  irqchip: vic: convert to handle_domain_irq
  irqchip: vt8500: convert to handle_domain_irq
  irqchip: zevio: convert to handle_domain_irq
  irqchip: GICv3: convert to handle_domain_irq
  irqchip: atmel-aic: convert to handle_domain_irq
  irqchip: atmel-aic5: convert to handle_domain_irq
  irqchip: or1k-pic: convert to handle_domain_irq
  ARM: imx: avic: convert to handle_domain_irq
  ARM: imx: tzic: convert to handle_domain_irq
  ARM: omap2: irq: convert to handle_domain_irq
  arm64: get rid of handle_IRQ
  openrisc: get rid of handle_IRQ

 arch/arm/Kconfig                     |  1 +
 arch/arm/kernel/irq.c                | 19 +---------------
 arch/arm/mach-imx/avic.c             |  2 +-
 arch/arm/mach-imx/tzic.c             |  3 +--
 arch/arm/mach-omap2/irq.c            |  3 +--
 arch/arm64/Kconfig                   |  1 +
 arch/arm64/include/asm/hardirq.h     |  2 --
 arch/arm64/kernel/irq.c              | 27 -----------------------
 arch/openrisc/Kconfig                |  1 +
 arch/openrisc/include/asm/irq.h      |  1 -
 arch/openrisc/kernel/irq.c           | 12 -----------
 drivers/irqchip/irq-armada-370-xp.c  | 19 ++++++++--------
 drivers/irqchip/irq-atmel-aic.c      |  4 +---
 drivers/irqchip/irq-atmel-aic5.c     |  4 +---
 drivers/irqchip/irq-clps711x.c       | 18 ++++++----------
 drivers/irqchip/irq-gic-v3.c         | 13 ++++++-----
 drivers/irqchip/irq-gic.c            |  3 +--
 drivers/irqchip/irq-mmp.c            | 10 ++++-----
 drivers/irqchip/irq-mxs.c            |  3 +--
 drivers/irqchip/irq-or1k-pic.c       |  4 ++--
 drivers/irqchip/irq-orion.c          |  5 ++---
 drivers/irqchip/irq-s3c24xx.c        |  4 +---
 drivers/irqchip/irq-sirfsoc.c        |  6 ++----
 drivers/irqchip/irq-sun4i.c          |  5 ++---
 drivers/irqchip/irq-versatile-fpga.c |  2 +-
 drivers/irqchip/irq-vic.c            |  2 +-
 drivers/irqchip/irq-vt8500.c         |  5 ++---
 drivers/irqchip/irq-zevio.c          |  3 +--
 include/linux/irqdesc.h              | 19 ++++++++++++++++
 kernel/irq/Kconfig                   |  3 +++
 kernel/irq/irqdesc.c                 | 42 ++++++++++++++++++++++++++++++++++++
 31 files changed, 116 insertions(+), 130 deletions(-)

-- 
2.0.4


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

end of thread, other threads:[~2014-09-03 13:18 UTC | newest]

Thread overview: 54+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-26 10:03 [PATCH v2 00/26] genirq: fix use of irq_find_mapping outside of legal RCU context Marc Zyngier
2014-08-26 10:03 ` [PATCH v2 01/26] genirq: add irq_domain-aware core IRQ handler Marc Zyngier
2014-08-26 17:42   ` Stephen Boyd
2014-08-26 18:07     ` Marc Zyngier
2014-08-26 18:46       ` Stephen Boyd
2014-08-26 19:05         ` Stephen Boyd
2014-09-01 15:22         ` Russell King - ARM Linux
2014-08-26 10:03 ` [PATCH v2 02/26] arm64: convert handle_IRQ to use __handle_domain_irq Marc Zyngier
2014-08-26 16:51   ` Catalin Marinas
2014-08-26 16:58     ` Marc Zyngier
2014-08-26 10:03 ` [PATCH v2 03/26] ARM: " Marc Zyngier
2014-08-26 10:03 ` [PATCH v2 04/26] openrisc: " Marc Zyngier
2014-08-26 10:03 ` [PATCH v2 05/26] irqchip: GIC: convert to handle_domain_irq Marc Zyngier
2014-08-26 10:03 ` [PATCH v2 06/26] irqchip: armada-370-xp: " Marc Zyngier
2014-08-26 10:03 ` [PATCH v2 07/26] irqchip: clps711x: " Marc Zyngier
2014-08-26 10:03 ` [PATCH v2 08/26] irqchip: mmp: " Marc Zyngier
2014-08-26 10:03 ` [PATCH v2 09/26] irqchip: mxs: " Marc Zyngier
2014-08-27  6:38   ` Shawn Guo
2014-08-26 10:03 ` [PATCH v2 10/26] irqchip: orion: " Marc Zyngier
2014-08-26 10:03 ` [PATCH v2 11/26] irqchip: s3c24xx: " Marc Zyngier
2014-08-26 10:03 ` [PATCH v2 12/26] irqchip: sirfsoc: " Marc Zyngier
2014-08-26 10:03 ` [PATCH v2 13/26] irqchip: sun4i: " Marc Zyngier
2014-08-26 10:03 ` [PATCH v2 14/26] irqchip: versatile-fpga: " Marc Zyngier
2014-08-26 10:03 ` [PATCH v2 15/26] irqchip: vic: " Marc Zyngier
2014-08-26 10:03 ` [PATCH v2 16/26] irqchip: vt8500: " Marc Zyngier
2014-08-26 10:03 ` [PATCH v2 17/26] irqchip: zevio: " Marc Zyngier
2014-08-26 10:03 ` [PATCH v2 18/26] irqchip: GICv3: " Marc Zyngier
2014-08-26 10:03 ` [PATCH v2 19/26] irqchip: atmel-aic: " Marc Zyngier
2014-09-01  9:32   ` Nicolas Ferre
2014-09-01 10:16   ` Boris BREZILLON
2014-08-26 10:03 ` [PATCH v2 20/26] irqchip: atmel-aic5: " Marc Zyngier
2014-09-01  9:33   ` Nicolas Ferre
2014-09-01  9:51   ` Boris BREZILLON
2014-08-26 10:03 ` [PATCH v2 21/26] irqchip: or1k-pic: " Marc Zyngier
2014-08-27 17:09   ` Stefan Kristiansson
2014-08-26 10:03 ` [PATCH v2 22/26] ARM: imx: avic: " Marc Zyngier
2014-08-27  6:40   ` Shawn Guo
2014-08-26 10:03 ` [PATCH v2 23/26] ARM: imx: tzic: " Marc Zyngier
2014-08-27  6:40   ` Shawn Guo
2014-08-26 10:03 ` [PATCH v2 24/26] ARM: omap2: irq: " Marc Zyngier
2014-08-26 20:57   ` Tony Lindgren
2014-08-26 10:03 ` [PATCH v2 25/26] arm64: get rid of handle_IRQ Marc Zyngier
2014-08-26 16:53   ` Catalin Marinas
2014-08-26 10:03 ` [PATCH v2 26/26] openrisc: " Marc Zyngier
2014-08-26 21:34 ` [PATCH v2 00/26] genirq: fix use of irq_find_mapping outside of legal RCU context Thomas Gleixner
2014-08-27  9:33   ` Marc Zyngier
2014-09-03 12:04     ` Jason Cooper
2014-09-03 12:09       ` Thomas Gleixner
2014-09-03 12:21         ` Marc Zyngier
2014-09-03 12:25           ` Thomas Gleixner
2014-09-03 12:37             ` Jason Cooper
2014-09-03 12:40               ` Marc Zyngier
2014-09-03 12:37             ` Marc Zyngier
2014-09-03 13:18 ` Jason Cooper

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).