From: Julia Cartwright <julia@ni.com>
To: <linux-kernel@vger.kernel.org>
Cc: <linux-rt-users@vger.kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Linus Walleij <linus.walleij@linaro.org>,
Julia Lawall <Julia.Lawall@lip6.fr>,
"Gilles Muller" <Gilles.Muller@lip6.fr>,
Nicolas Palix <nicolas.palix@imag.fr>,
"Michal Marek" <mmarek@suse.com>,
Lee Jones <lee.jones@linaro.org>, <cocci@systeme.lip6.fr>
Subject: [PATCH v2 0/9] fixup usage of non-raw spinlocks in irqchips
Date: Tue, 21 Mar 2017 17:43:00 -0500 [thread overview]
Message-ID: <cover.1490135047.git.julia@ni.com> (raw)
Changes since v1[1]:
- Dropped already applied patches in pinctrl, gpio, and mux trees.
- Gained three new patches destined for gpio tree, due to loosening constraints in
the semantic patch.
The following patchset introduces a new coccinelle patch,
irq_chip_raw_spinlock.cocci, which is used to identify irq_chip implementors
which acquire/release non-raw spinlocks, and in addition, a set of generated
patches for most cases identified.
On mainline builds, there exists no functional difference between
raw_spinlock_t and spinlock_t. However, w/ PREEMPT_RT, the spinlock_t will
cause the calling thread to sleep when the lock is contended. Because sleeping
is illegal in hardirq context, and because the irqchip callbacks are invoked in
hardirq context, irqchip implementations must not use spin_lock_t for
synchronization.
Patches build tested only. All patches are independent of one another and can
be applied to the relevant trees.
Some notes:
- In order to ensure that latency problems are not introduced for realtime
kernels, the generated patches need to be hand audited to ensure that
raw-spinlock protected regions are bounded and minimal. I've done a quick
audit for each of the modified drivers in this series, but please check my
work.
- There are a couple of matches which will require further intervention to
fully fix. Namely the Intel LPE Audio driver:
drivers/gpu/drm/i915/intel_lpe_audio.c:169:30-38: Use of non-raw spinlock is illegal in this context (struct drm_i915_private::irq_lock)
and the adi2 pinctrl driver:
drivers/pinctrl/pinctrl-adi2.c:308:26-30: Use of non-raw spinlock is illegal in this context (struct gpio_port::lock)
- This semantic patch is not comprehensive, there are other equally broken
usecases which are not properly identified yet, such as the use of a single
global spinlock_t declared via DEFINE_SPINLOCK() (found in arch/alpha, and
perhaps elsewhere).
An additional currently unhandled case is the irq_chip_generic callbacks.
Julia
[1]: http://lkml.kernel.org/r/cover.1489015238.git.julia@ni.com
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: Gilles Muller <Gilles.Muller@lip6.fr>
Cc: Nicolas Palix <nicolas.palix@imag.fr>
Cc: Michal Marek <mmarek@suse.com>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: cocci@systeme.lip6.fr
--------------
Julia Cartwright (9):
Coccinelle: locks: identify callers of spin_lock{,_irq,_irqsave}() in
irqchip implementations
alpha: marvel: make use of raw_spinlock variants
powerpc: mpc52xx_gpt: make use of raw_spinlock variants
mfd: asic3: make use of raw_spinlock variants
mfd: t7l66xb: make use of raw_spinlock variants
mfd: tc6393xb: make use of raw_spinlock variants
gpio: 104-idi-48: make use of raw_spinlock variants
gpio: 104-idio-16: make use of raw_spinlock variants
gpio: pci-idio-16: make use of raw_spinlock variants
arch/alpha/include/asm/core_marvel.h | 2 +-
arch/alpha/kernel/core_marvel.c | 2 +-
arch/alpha/kernel/sys_marvel.c | 12 +--
arch/powerpc/platforms/52xx/mpc52xx_gpt.c | 52 ++++++------
drivers/gpio/gpio-104-idi-48.c | 18 ++--
drivers/gpio/gpio-104-idio-16.c | 24 +++---
drivers/gpio/gpio-pci-idio-16.c | 28 +++----
drivers/mfd/asic3.c | 56 ++++++-------
drivers/mfd/t7l66xb.c | 20 ++---
drivers/mfd/tc6393xb.c | 52 ++++++------
.../coccinelle/locks/irq_chip_raw_spinlock.cocci | 96 ++++++++++++++++++++++
11 files changed, 230 insertions(+), 132 deletions(-)
create mode 100644 scripts/coccinelle/locks/irq_chip_raw_spinlock.cocci
--
2.12.0
next reply other threads:[~2017-03-21 23:57 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-21 22:43 Julia Cartwright [this message]
2017-03-21 22:43 ` [PATCH v2 1/9] Coccinelle: locks: identify callers of spin_lock{,_irq,_irqsave}() in irqchip implementations Julia Cartwright
2017-03-22 9:54 ` Julia Lawall
2017-03-22 16:18 ` Julia Cartwright
2017-03-22 21:45 ` Julia Lawall
2017-03-21 22:43 ` [PATCH v2 2/9] alpha: marvel: make use of raw_spinlock variants Julia Cartwright
2017-03-21 22:43 ` [PATCH v2 3/9] powerpc: mpc52xx_gpt: " Julia Cartwright
2018-01-29 4:13 ` [v2,3/9] " Michael Ellerman
2017-03-21 22:43 ` [PATCH v2 4/9] mfd: asic3: " Julia Cartwright
2017-03-23 13:42 ` Lee Jones
2017-03-21 22:43 ` [PATCH v2 5/9] mfd: t7l66xb: " Julia Cartwright
2017-03-23 13:42 ` Lee Jones
2017-03-21 22:43 ` [PATCH v2 6/9] mfd: tc6393xb: " Julia Cartwright
2017-03-23 13:42 ` Lee Jones
2017-03-21 22:43 ` [PATCH v2 7/9] gpio: 104-idi-48: " Julia Cartwright
2017-03-22 12:44 ` William Breathitt Gray
2017-03-22 16:11 ` Julia Cartwright
2017-03-28 9:11 ` Linus Walleij
2017-03-28 11:40 ` William Breathitt Gray
2017-03-28 12:55 ` Linus Walleij
2017-03-21 22:43 ` [PATCH v2 8/9] gpio: 104-idio-16: " Julia Cartwright
2017-03-22 12:45 ` William Breathitt Gray
2017-03-28 9:13 ` Linus Walleij
2017-03-21 22:43 ` [PATCH v2 9/9] gpio: pci-idio-16: " Julia Cartwright
2017-03-22 12:46 ` William Breathitt Gray
2017-03-28 9:14 ` Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1490135047.git.julia@ni.com \
--to=julia@ni.com \
--cc=Gilles.Muller@lip6.fr \
--cc=Julia.Lawall@lip6.fr \
--cc=bigeasy@linutronix.de \
--cc=cocci@systeme.lip6.fr \
--cc=lee.jones@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=mmarek@suse.com \
--cc=nicolas.palix@imag.fr \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).