Re: [Regression] "irqdomain: Don't set type when mapping an IRQ" breaks nexus7 gpio buttons

From: Marc Zyngier
Date: Wed Aug 10 2016 - 14:41:24 EST


On 10/08/16 10:56, Jon Hunter wrote:
> Hi Marc, Linus,
>
> On 10/08/16 10:41, Marc Zyngier wrote:
>> Hi Linus,
>>
>> On 10/08/16 00:03, Linus Walleij wrote:
>>> On Tue, Aug 9, 2016 at 3:20 PM, Jon Hunter <jonathanh@xxxxxxxxxx> wrote:
>>>
>>>> If that works, then does the following also work (without the above) ...
>>>>
>>>> diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
>>>> index b4c1bc7c9ca2..e111b72e3162 100644
>>>> --- a/kernel/irq/chip.c
>>>> +++ b/kernel/irq/chip.c
>>>> @@ -824,6 +824,7 @@ __irq_do_set_handler(struct irq_desc *desc, irq_flow_handler_t handle,
>>>> irq_settings_set_norequest(desc);
>>>> irq_settings_set_nothread(desc);
>>>> desc->action = &chained_action;
>>>> + __irq_set_trigger(desc, irqd_get_trigger_type(&desc->irq_data));
>>>> irq_startup(desc, true);
>>>> }
>>>> }
>>>>
>>>> It looks like there is a path for parent interrupts where the type
>>>> is not getting set. If the above works then we can discuss with Thomas
>>>> and Marc on the correct fix.
>>>
>>> I tried this on my problematic platform and then this happens:
>>>
>>> preparing networking...
>>> [ 2.628246] ------------[ cut here ]------------
>>> [ 2.628303] WARNING: CPU: 0 PID: 92 at ../kernel/irq/chip.c:26
>>> bad_chained_irq+0x44/0x4c
>>> [ 2.631939] Chained irq 109 should not call an action
>>> [ 2.640008] Modules linked in:
>>> [ 2.647909] CPU: 0 PID: 92 Comm: ip Not tainted
>>> 4.8.0-rc1-00011-ga21e27b4cb66 #194
>>> [ 2.647996] Hardware name: Generic DT based system
>>> [ 2.655486] [<c030f8c8>] (unwind_backtrace) from [<c030c714>]
>>> (show_stack+0x10/0x14)
>>> [ 2.660254] [<c030c714>] (show_stack) from [<c05df420>]
>>> (dump_stack+0x78/0x8c)
>>> [ 2.668147] [<c05df420>] (dump_stack) from [<c031cef4>] (__warn+0xec/0x104)
>>> [ 2.675173] [<c031cef4>] (__warn) from [<c031cf44>]
>>> (warn_slowpath_fmt+0x38/0x48)
>>> [ 2.682033] [<c031cf44>] (warn_slowpath_fmt) from [<c0369160>]
>>> (bad_chained_irq+0x44/0x4c)
>>> [ 2.689687] [<c0369160>] (bad_chained_irq) from [<c0365e28>]
>>> (__handle_irq_event_percpu+0x5c/0x290)
>>> [ 2.697836] [<c0365e28>] (__handle_irq_event_percpu) from
>>> [<c0366078>] (handle_irq_event_percpu+0x1c/0x58)
>>> [ 2.706778] [<c0366078>] (handle_irq_event_percpu) from
>>> [<c03660ec>] (handle_irq_event+0x38/0x5c)
>>> [ 2.716498] [<c03660ec>] (handle_irq_event) from [<c03693f0>]
>>> (handle_level_irq+0xc4/0x150)
>>> [ 2.725438] [<c03693f0>] (handle_level_irq) from [<c036542c>]
>>> (generic_handle_irq+0x24/0x34)
>>> [ 2.733602] [<c036542c>] (generic_handle_irq) from [<c06127d4>]
>>> (msm_gpio_irq_handler+0xc8/0x150)
>>> [ 2.742280] [<c06127d4>] (msm_gpio_irq_handler) from [<c036542c>]
>>> (generic_handle_irq+0x24/0x34)
>>> [ 2.751048] [<c036542c>] (generic_handle_irq) from [<c0365720>]
>>> (__handle_domain_irq+0x7c/0xec)
>>> [ 2.759901] [<c0365720>] (__handle_domain_irq) from [<c0301464>]
>>> (gic_handle_irq+0x48/0x8c)
>>> [ 2.768323] [<c0301464>] (gic_handle_irq) from [<c08b8e4c>]
>>> (__irq_svc+0x6c/0xa8)
>>> [ 2.776644] Exception stack(0xdeca1d48 to 0xdeca1d90)
>>> [ 2.784284] 1d40: deca1dc0 00000000 00000000
>>> deca0018 ffff8bd6 deca1dc0
>>> [ 2.789324] 1d60: 00000000 c0378ad0 60070013 00000000 00000000
>>> 001f3df8 c108fa04 deca1d98
>>> [ 2.797481] 1d80: c08b77fc c0377930 60070013 ffffffff
>>> [ 2.805651] [<c08b8e4c>] (__irq_svc) from [<c0377930>]
>>> (init_timer_key+0x28/0x104)
>>> [ 2.810679] [<c0377930>] (init_timer_key) from [<c08b77fc>]
>>> (schedule_timeout+0x48/0x410)
>>> [ 2.818145] [<c08b77fc>] (schedule_timeout) from [<c0378ad0>]
>>> (msleep+0x2c/0x38)
>>> [ 2.826399] [<c0378ad0>] (msleep) from [<c06c2980>]
>>> (smsc911x_open+0x268/0x50c)
>>> [ 2.833859] [<c06c2980>] (smsc911x_open) from [<c07c1994>]
>>> (__dev_open+0xa8/0x10c)
>>> [ 2.840887] [<c07c1994>] (__dev_open) from [<c07c1c1c>]
>>> (__dev_change_flags+0x94/0x144)
>>> [ 2.848525] [<c07c1c1c>] (__dev_change_flags) from [<c07c1ce4>]
>>> (dev_change_flags+0x18/0x48)
>>> [ 2.856428] [<c07c1ce4>] (dev_change_flags) from [<c0823048>]
>>> (devinet_ioctl+0x6b0/0x768)
>>> [ 2.865120] [<c0823048>] (devinet_ioctl) from [<c07a4ac4>]
>>> (sock_ioctl+0x1f4/0x2c8)
>>> [ 2.873186] [<c07a4ac4>] (sock_ioctl) from [<c0432678>]
>>> (do_vfs_ioctl+0x9c/0x910)
>>> [ 2.880645] [<c0432678>] (do_vfs_ioctl) from [<c0432f20>]
>>> (SyS_ioctl+0x34/0x5c)
>>> [ 2.888290] [<c0432f20>] (SyS_ioctl) from [<c0308480>]
>>> (ret_fast_syscall+0x0/0x3c)
>>> [ 2.895395] ---[ end trace a53e1e63b7bdfc4a ]---
>>> [ 2.903917] random: fast init done
>>> [ 3.036378] random: crng init done
>>> [ 3.883906] irq 109: nobody cared (try booting with the "irqpoll" option)
>>> [ 3.883940] CPU: 0 PID: 92 Comm: ip Tainted: G W
>>> 4.8.0-rc1-00011-ga21e27b4cb66 #194
>>> [ 3.889673] Hardware name: Generic DT based system
>>> [ 3.898538] [<c030f8c8>] (unwind_backtrace) from [<c030c714>]
>>> (show_stack+0x10/0x14)
>>> [ 3.903137] [<c030c714>] (show_stack) from [<c05df420>]
>>> (dump_stack+0x78/0x8c)
>>> [ 3.911034] [<c05df420>] (dump_stack) from [<c0368804>]
>>> (__report_bad_irq+0x28/0xcc)
>>> [ 3.918065] [<c0368804>] (__report_bad_irq) from [<c0368c18>]
>>> (note_interrupt+0x298/0x2e8)
>>> [ 3.925971] [<c0368c18>] (note_interrupt) from [<c03660a8>]
>>> (handle_irq_event_percpu+0x4c/0x58)
>>> [ 3.934040] [<c03660a8>] (handle_irq_event_percpu) from
>>> [<c03660ec>] (handle_irq_event+0x38/0x5c)
>>> [ 3.942634] [<c03660ec>] (handle_irq_event) from [<c03693f0>]
>>> (handle_level_irq+0xc4/0x150)
>>> [ 3.951660] [<c03693f0>] (handle_level_irq) from [<c036542c>]
>>> (generic_handle_irq+0x24/0x34)
>>> [ 3.959821] [<c036542c>] (generic_handle_irq) from [<c06127d4>]
>>> (msm_gpio_irq_handler+0xc8/0x150)
>>> [ 3.968502] [<c06127d4>] (msm_gpio_irq_handler) from [<c036542c>]
>>> (generic_handle_irq+0x24/0x34)
>>> [ 3.977269] [<c036542c>] (generic_handle_irq) from [<c0365720>]
>>> (__handle_domain_irq+0x7c/0xec)
>>> [ 3.986122] [<c0365720>] (__handle_domain_irq) from [<c0301464>]
>>> (gic_handle_irq+0x48/0x8c)
>>> [ 3.994541] [<c0301464>] (gic_handle_irq) from [<c08b8e4c>]
>>> (__irq_svc+0x6c/0xa8)
>>> [ 4.002865] Exception stack(0xdeca1c60 to 0xdeca1ca8)
>>> [ 4.010507] 1c60: 00000000 c0abce68 c109f9c0 00000000 c109f9c0
>>> 00000000 deca0000 00000000
>>> [ 4.015546] 1c80: 00000282 deca1d48 c0210800 001f3df8 e080400c
>>> deca1cb0 c0322330 c0322340
>>> [ 4.023701] 1ca0: 20070113 ffffffff
>>> [ 4.031868] [<c08b8e4c>] (__irq_svc) from [<c0322340>]
>>> (__do_softirq+0x9c/0x388)
>>> [ 4.035166] [<c0322340>] (__do_softirq) from [<c03228f0>]
>>> (irq_exit+0xc0/0xfc)
>>> [ 4.042805] [<c03228f0>] (irq_exit) from [<c0365724>]
>>> (__handle_domain_irq+0x80/0xec)
>>> [ 4.049835] [<c0365724>] (__handle_domain_irq) from [<c0301464>]
>>> (gic_handle_irq+0x48/0x8c)
>>> [ 4.057735] [<c0301464>] (gic_handle_irq) from [<c08b8e4c>]
>>> (__irq_svc+0x6c/0xa8)
>>> [ 4.065887] Exception stack(0xdeca1d48 to 0xdeca1d90)
>>> [ 4.073528] 1d40: deca1dc0 00000000 00000000
>>> deca0018 ffff8bd6 deca1dc0
>>> [ 4.078566] 1d60: 00000000 c0378ad0 60070013 00000000 00000000
>>> 001f3df8 c108fa04 deca1d98
>>> [ 4.086723] 1d80: c08b77fc c0377930 60070013 ffffffff
>>> [ 4.094889] [<c08b8e4c>] (__irq_svc) from [<c0377930>]
>>> (init_timer_key+0x28/0x104)
>>> [ 4.099921] [<c0377930>] (init_timer_key) from [<c08b77fc>]
>>> (schedule_timeout+0x48/0x410)
>>> [ 4.107389] [<c08b77fc>] (schedule_timeout) from [<c0378ad0>]
>>> (msleep+0x2c/0x38)
>>> [ 4.115640] [<c0378ad0>] (msleep) from [<c06c2980>]
>>> (smsc911x_open+0x268/0x50c)
>>> [ 4.123100] [<c06c2980>] (smsc911x_open) from [<c07c1994>]
>>> (__dev_open+0xa8/0x10c)
>>> [ 4.130128] [<c07c1994>] (__dev_open) from [<c07c1c1c>]
>>> (__dev_change_flags+0x94/0x144)
>>> [ 4.137769] [<c07c1c1c>] (__dev_change_flags) from [<c07c1ce4>]
>>> (dev_change_flags+0x18/0x48)
>>> [ 4.145670] [<c07c1ce4>] (dev_change_flags) from [<c0823048>]
>>> (devinet_ioctl+0x6b0/0x768)
>>> [ 4.154357] [<c0823048>] (devinet_ioctl) from [<c07a4ac4>]
>>> (sock_ioctl+0x1f4/0x2c8)
>>> [ 4.162425] [<c07a4ac4>] (sock_ioctl) from [<c0432678>]
>>> (do_vfs_ioctl+0x9c/0x910)
>>> [ 4.169887] [<c0432678>] (do_vfs_ioctl) from [<c0432f20>]
>>> (SyS_ioctl+0x34/0x5c)
>>> [ 4.177529] [<c0432f20>] (SyS_ioctl) from [<c0308480>]
>>> (ret_fast_syscall+0x0/0x3c)
>>> [ 4.184635] handlers:
>>> [ 4.192273] [<c036911c>] bad_chained_irq
>>> [ 4.198255] Disabling IRQ #109
>>> (...)
>>> [ 34.170316] smsc911x 1b800000.ethernet-ebi2 eth0: ISR failed
>>> signaling test (IRQ 208)
>>
>> Is this platform related to the Dragonboard 410C? I've got one from
>> Sudeep, and it seems to work fine (though I've spotted a couple of
>> gotchas in the DT).
>
> Just to confirm is that with or without the proposed change?

The proposed change didn't have any impact on this board, but it may
just be that the firmware had done the right thing...

> Linus, I have been trying to find out which qcom board has this smsc911x
> but I was unable to find any, so more info on the platform would be great!
>
> I have been testing this on various Tegra boards that use gpio irqchips
> for various external functions and have not seen any such problems so far.

I'm also struggling to reproduce this issue, so any pointer to an easy
to source board would be appreciated (I can trade in Versatile/Realview
HW...).

Thanks,

M.
--
Jazz is not dead. It just smells funny...