From: Linus Walleij <linus.walleij@linaro.org>
To: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] pinctrl: cherryview: Use raw_spinlock for locking
Date: Wed, 26 Aug 2015 09:28:48 +0200 [thread overview]
Message-ID: <CACRpkdbfPpe1gR1SBzp9PxznB9NCcMRU7DU7EE9mHsJE2pb2=g@mail.gmail.com> (raw)
In-Reply-To: <1439817210-38828-1-git-send-email-mika.westerberg@linux.intel.com>
On Mon, Aug 17, 2015 at 3:13 PM, Mika Westerberg
<mika.westerberg@linux.intel.com> wrote:
> When running -rt kernel and an interrupt happens on a GPIO line controlled by
> Intel Cherryview/Braswell pinctrl driver we get:
>
> BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:917
> in_atomic(): 1, irqs_disabled(): 1, pid: 0, name: swapper/0
> Preemption disabled at:[<ffffffff81092e9f>] cpu_startup_entry+0x17f/0x480
>
> CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.1.5-rt5 #16
> ...
> Call Trace:
> <IRQ> [<ffffffff816283c6>] dump_stack+0x4a/0x61
> [<ffffffff81077e17>] ___might_sleep+0xe7/0x170
> [<ffffffff8162d6cf>] rt_spin_lock+0x1f/0x50
> [<ffffffff812e52ed>] chv_gpio_irq_ack+0x3d/0xa0
> [<ffffffff810a72f5>] handle_edge_irq+0x75/0x180
> [<ffffffff810a3457>] generic_handle_irq+0x27/0x40
> [<ffffffff812e57de>] chv_gpio_irq_handler+0x7e/0x110
> [<ffffffff810050aa>] handle_irq+0xaa/0x190
> ...
>
> This is because desc->lock is raw_spinlock and is held when chv_gpio_irq_ack()
> is called by the genirq core. chv_gpio_irq_ack() in turn takes pctrl->lock
> which in -rt is an rt-mutex causing might_sleep() rightfully to complain about
> sleeping function called from invalid context.
>
> In order to keep -rt happy but at the same time make sure that register
> accesses get serialized, convert the driver to use raw_spinlock instead.
>
> Suggested-by: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Patch applied. Again splendid job here.
Yours,
Linus Walleij
prev parent reply other threads:[~2015-08-26 7:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-17 13:13 [PATCH] pinctrl: cherryview: Use raw_spinlock for locking Mika Westerberg
2015-08-26 7:28 ` Linus Walleij [this message]
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='CACRpkdbfPpe1gR1SBzp9PxznB9NCcMRU7DU7EE9mHsJE2pb2=g@mail.gmail.com' \
--to=linus.walleij@linaro.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
/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).