Re: [PATCH 4.2.y-ckt 007/218] gpio: rcar: Add Runtime PM handling for interrupts
From: Geert Uytterhoeven
Date: Tue May 03 2016 - 02:58:49 EST
Hi Kamal et al,
On Thu, Mar 31, 2016 at 10:13 PM, Kamal Mostafa <kamal@xxxxxxxxxxxxx> wrote:
> 4.2.8-ckt7 -stable review patch. If anyone has any objections, please let me know.
>
> ---8<------------------------------------------------------------
>
> From: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
>
> commit b26a719bdba9aa926ceaadecc66e07623d2b8a53 upstream.
>
> The R-Car GPIO driver handles Runtime PM for requested GPIOs only.
>
> When using a GPIO purely as an interrupt source, no Runtime PM handling
> is done, and the GPIO module's clock may not be enabled.
>
> To fix this:
> - Add .irq_request_resources() and .irq_release_resources() callbacks
> to handle Runtime PM when an interrupt is requested,
> - Add irq_bus_lock() and sync_unlock() callbacks to handle Runtime PM
> when e.g. disabling/enabling an interrupt, or configuring the
> interrupt type.
>
> Fixes: d5c3d84657db57bd "net: phy: Avoid polling PHY with PHY_IGNORE_INTERRUPTS"
> Signed-off-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
> Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
> Signed-off-by: Kamal Mostafa <kamal@xxxxxxxxxxxxx>
This patch, which has been applied to the following stable trees:
- 3.16.7-ckt26,
- 3.19.8-ckt17,
- 4.2.8-ckt7,
has been reverted in mainline:
commit ce0e2c60e69e5f87ab4ac10c935d8bd85d4d11f7
Author: Linus Walleij <linus.walleij@xxxxxxxxxx>
Date: Tue Apr 12 10:05:22 2016 +0200
Revert "gpio: rcar: Fine-grained Runtime PM support"
This reverts commit 65194cb174b873448b208eb6e04ecb72237af76e.
commit 42c25013ca95ce79b4ed192188ca843ae48f8c71
Author: Linus Walleij <linus.walleij@xxxxxxxxxx>
Date: Tue Apr 12 10:00:34 2016 +0200
Revert "gpio: rcar: Add Runtime PM handling for interrupts"
This reverts commit b26a719bdba9aa926ceaadecc66e07623d2b8a53.
Please apply the two reverts where appropriate.
Unfortunately these reverts don't have much context in their descriptions.
What may happen is:
BUG: sleeping function called from invalid context at
/home/laurent/src/iob/renesas/linux/drivers/base/power/runtime.c:955
in_atomic(): 1, irqs_disabled(): 128, pid: 658, name: udevd
CPU: 3 PID: 658 Comm: udevd Tainted: P 4.6.0-rc3 #756
Hardware name: Generic R8A7790 (Flattened Device Tree)
Backtrace:
[<c0014c98>] (dump_backtrace) from [<c0014fb0>] (show_stack+0x20/0x24)
r6:00000000 r5:00000000 r4:60000093 r3:00000000
[<c0014f90>] (show_stack) from [<c01f614c>] (dump_stack+0x8c/0xac)
[<c01f60c0>] (dump_stack) from [<c00510c8>] (___might_sleep+0x100/0x158)
r5:000003bb r4:c06ca340
[<c0050fc8>] (___might_sleep) from [<c005118c>] (__might_sleep+0x6c/0xa8)
r4:c05b6a24
[<c0051120>] (__might_sleep) from [<c02d971c>]
(__pm_runtime_resume+0x98/0xa0)
r6:000000dc r5:00000004 r4:ea280010
[<c02d9684>] (__pm_runtime_resume) from [<c02282c8>]
(gpio_rcar_irq_request_resources+0x2c/0x34)
r7:00000000 r6:000000dc r5:e95b3c00 r4:e99f3c00
[<c022829c>] (gpio_rcar_irq_request_resources) from [<c0077a88>]
(__setup_irq+0x24c/0x5dc)
[<c007783c>] (__setup_irq) from [<c0077ff4>]
(request_threaded_irq+0xdc/0x180)
r10:bf0aabc8 r9:000000dc r8:e9bc3000 r7:c0075be8 r6:e99f3c00 r5:00002003
r4:e95b3c00
[<c0077f18>] (request_threaded_irq) from [<c007a758>]
(devm_request_threaded_irq+0x6c/0xac)
r10:ea2db810 r9:ea2db810 r8:00000000 r7:bf0aabc8 r6:000000dc r5:e9bc3000
r4:e95b3b50 r3:00002003
[<c007a6ec>] (devm_request_threaded_irq) from [<bf0aab9c>]
(mmc_gpiod_request_cd_irq+0xa4/0xd0 [mmc_core])
r10:ea2db800 r8:e9bc3000 r7:e9bed598 r6:000000dc r5:e9bed524 r4:e9bc3000
[<bf0aaaf8>] (mmc_gpiod_request_cd_irq [mmc_core]) from
[<bf09f3bc>] (mmc_start_host+0x70/0x90 [mmc_core])
r6:e9bc3300 r5:00000000 r4:e9bc3000
[<bf09f34c>] (mmc_start_host [mmc_core]) from [<bf0a061c>]
(mmc_add_host+0x54/0x78 [mmc_core])
r4:e9bc3000 r3:00000001
[<bf0a05c8>] (mmc_add_host [mmc_core]) from [<bf134b3c>]
(tmio_mmc_host_probe+0x3ac/0x450 [tmio_mmc_core])
r5:ffffffe0 r4:00000000
[<bf134790>] (tmio_mmc_host_probe [tmio_mmc_core]) from
[<bf1501e8>] (sh_mobile_sdhi_probe+0x198/0x414 [sh_mobile_sdhi])
r10:bf150d04 r9:e9bed598 r8:00000001 r7:ea2db810 r6:ea2db800 r5:e9bc3300
r4:e9bed590
[<bf150050>] (sh_mobile_sdhi_probe [sh_mobile_sdhi]) from
[<c02cf220>] (platform_drv_probe+0x60/0xc0)
r10:00000011 r9:00000000 r8:bf151464 r7:bf151464 r6:fffffdfb r5:ea2db810
r4:00000000
[<c02cf1c0>] (platform_drv_probe) from [<c02ccf80>]
(driver_probe_device+0x224/0x440)
r7:c06c45f8 r6:c08e2b44 r5:c08e2b3c r4:ea2db810
To fix this, we decided to keep gpio-rcar runtime-resumed all the time,
i.e. revert both of
b26a719bdb ("gpio: rcar: Add Runtime PM handling for interrupts")
65194cb174 ("gpio: rcar: Fine-grained Runtime PM support")
until the irqchip subsystem has support for Runtime PM.
Cfr. the thread at http://www.spinics.net/lists/linux-renesas-soc/msg02710.html
Sorry for the inconvenience.
Thanks!
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds