Re: [GIT pull] irq updates for 4.13

From: Sebastian Reichel
Date: Mon Jul 10 2017 - 09:35:14 EST


Hi,

On Sun, Jul 09, 2017 at 10:49:57AM +0200, Thomas Gleixner wrote:
> - Move the interrupt resource management logic out of the spin locked,
> irq disabled region to avoid unnecessary restrictions of the resource
> callbacks

This patch apparently breaks OMAP platform:

46e48e257360f0845fe17089713cbad4db611e70 is the first bad commit
commit 46e48e257360f0845fe17089713cbad4db611e70
Author: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Date: Thu Jun 29 23:33:38 2017 +0200

genirq: Move irq resource handling out of spinlocked region

Boot failure log from Droid 4:

[ 1.346984] cpcap-core spi1.0: CPCAP vendor: ST rev: 2.10 (1a)
[ 1.354766] Unhandled fault: imprecise external abort (0x1406) at 0xfeffffff
[ 1.354797] ------------[ cut here ]------------
[ 1.354827] WARNING: CPU: 0 PID: 0 at drivers/bus/omap_l3_noc.c:147 l3_interrupt_handler+0x21c/0x348
[ 1.354827] 44000000.ocp:L3 Custom Error: MASTER MPU TARGET L4CFG (Read): Data Access in User mode during Functional access
[ 1.354827] Modules linked in:
[ 1.354858] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.12.0-10335-gb8c0c26d6667 #516
[ 1.354858] Hardware name: Generic OMAP4 (Flattened Device Tree)
[ 1.354888] [<c0110460>] (unwind_backtrace) from [<c010c4ac>] (show_stack+0x10/0x14)
[ 1.354888] [<c010c4ac>] (show_stack) from [<c0adca28>] (dump_stack+0xac/0xe0)
[ 1.354919] [<c0adca28>] (dump_stack) from [<c013a940>] (__warn+0xd8/0x104)
[ 1.354919] [<c013a940>] (__warn) from [<c013a9a0>] (warn_slowpath_fmt+0x34/0x44)
[ 1.354919] [<c013a9a0>] (warn_slowpath_fmt) from [<c0508324>] (l3_interrupt_handler+0x21c/0x348)
[ 1.354949] [<c0508324>] (l3_interrupt_handler) from [<c01aa1b4>] (__handle_irq_event_percpu+0x48/0x3b4)
[ 1.354949] [<c01aa1b4>] (__handle_irq_event_percpu) from [<c01aa53c>] (handle_irq_event_percpu+0x1c/0x58)
[ 1.354949] [<c01aa53c>] (handle_irq_event_percpu) from [<c01aa5b0>] (handle_irq_event+0x38/0x5c)
[ 1.354980] [<c01aa5b0>] (handle_irq_event) from [<c01adb30>] (handle_fasteoi_irq+0xb4/0x178)
[ 1.354980] [<c01adb30>] (handle_fasteoi_irq) from [<c01a94a8>] (generic_handle_irq+0x20/0x34)
[ 1.354980] [<c01a94a8>] (generic_handle_irq) from [<c01a9a18>] (__handle_domain_irq+0x64/0xe0)
[ 1.354980] [<c01a9a18>] (__handle_domain_irq) from [<c010155c>] (gic_handle_irq+0x54/0xb8)
[ 1.355010] [<c010155c>] (gic_handle_irq) from [<c0af7e30>] (__irq_svc+0x70/0x98)
[ 1.355010] Exception stack(0xc1001f38 to 0xc1001f80)
[ 1.355010] 1f20: 00000001 00000001
[ 1.355041] 1f40: 00000000 c100abc0 c1000000 c1007bcc c1007b68 c0f8a938 c1007f68 c1046133
[ 1.355041] 1f60: 00000000 00000000 00000000 c1001f88 c019a828 c010822c 20000013 ffffffff
[ 1.355041] [<c0af7e30>] (__irq_svc) from [<c010822c>] (arch_cpu_idle+0x20/0x3c)
[ 1.355072] [<c010822c>] (arch_cpu_idle) from [<c018b6b4>] (do_idle+0x168/0x21c)
[ 1.355072] [<c018b6b4>] (do_idle) from [<c018bad4>] (cpu_startup_entry+0x18/0x1c)
[ 1.355072] [<c018bad4>] (cpu_startup_entry) from [<c0f00c2c>] (start_kernel+0x348/0x3c0)
[ 1.355102] [<c0f00c2c>] (start_kernel) from [<8000807c>] (0x8000807c)
[ 1.355133] ---[ end trace 03269d8f047e066b ]---
[ 1.584167] pgd = c0004000
[ 1.586914] [feffffff] *pgd=00000000
[ 1.590515] Internal error: : 1406 [#1] SMP ARM
[ 1.595062] Modules linked in:
[ 1.598144] CPU: 1 PID: 1 Comm: swapper/0 Tainted: G W 4.12.0-10335-gb8c0c26d6667 #516
[ 1.607238] Hardware name: Generic OMAP4 (Flattened Device Tree)
[ 1.613281] task: ee8aae00 task.stack: ee8ac000
[ 1.617858] PC is at debug_lockdep_rcu_enabled+0x38/0x48
[ 1.623199] LR is at lock_release+0x25c/0x360
[ 1.627593] pc : [<c01b3788>] lr : [<c019cc58>] psr: 20000093
[ 1.633880] sp : ee8adb80 ip : c10fe40c fp : eea0fc10
[ 1.639160] r10: 00000001 r9 : c10f4230 r8 : 60000093
[ 1.644409] r7 : c1007b68 r6 : c051b3f8 r5 : eea0ce74 r4 : a0000013
[ 1.650970] r3 : ee8aae00 r2 : 00000001 r1 : 00000003 r0 : 0000001f
[ 1.657531] Flags: nzCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment none
[ 1.664825] Control: 10c5387d Table: 8000404a DAC: 00000051
[ 1.670593] Process swapper/0 (pid: 1, stack limit = 0xee8ac218)
[ 1.676635] Stack: (0xee8adb80 to 0xee8ae000)
[ 1.681030] db80: a0000013 c051b3e8 00000007 a0000013 eea0ce64 eea0ce64 00000007 eea0fd04
[ 1.689270] dba0: c06208d8 eea0fc00 eea0fc10 c0af76ec 00000000 fc310134 eea0ce64 c051b3f8
[ 1.697479] dbc0: 00000020 eea0cea4 eea0cc70 00000000 eea0fd04 c0514430 eea0cea4 eea0fc10
[ 1.705718] dbe0: eef44cc0 c0514960 eea0fc00 00000021 eef44cc0 c01ac370 ee8000c0 60000013
[ 1.713958] dc00: eed2d57c eef44cc0 00000000 c01aa628 eef42000 00000021 c06208d8 eea0fc00
[ 1.722198] dc20: eea0fc10 c01ac73c 00002084 eef42000 00000204 c10a88cc 00000001 eee8a200
[ 1.730407] dc40: 00000000 00000000 00000010 c0621460 c0da9f6c eef42000 00000000 00000111
[ 1.738647] dc60: 00000021 00000084 00000084 eee8a200 eef22610 00000021 00000084 eef23800
[ 1.746887] dc80: 00000010 eef2513c c0b69968 c0621618 c10a88cc ee8adc9c 00000004 eef23800
[ 1.755126] dca0: eef23800 eee8a200 00000021 eef22710 eef25010 c062d618 ffffffff c10a88cc
[ 1.763366] dcc0: eef22718 ee8aae00 00000001 00000000 c10a88cc 00000010 00000000 00000000
[ 1.771575] dce0: eef23800 0000001a eef22710 00000000 00000010 00000013 00000000 00000000
[ 1.779815] dd00: c0dba8a8 c062d7a0 0000000a 0000001a 00000000 00000013 eef23800 c10a887c
[ 1.788055] dd20: 00000000 c10a888c 00000000 c06a2784 eef23800 c18c195c 00000000 c05fdd00
[ 1.796295] dd40: 00000000 ee8add78 c05fde4c 00000001 00000000 c18c1918 00000000 c05fc374
[ 1.804534] dd60: ee9f2ad4 eee7e154 eef23800 eef23834 c10b0dbc c05fd9bc eef23800 00000001
[ 1.812744] dd80: c18c1918 eef23808 eef23800 c10b0dbc 00000000 c05fd044 eef23808 eef25800
[ 1.820983] dda0: eef23800 c05fb4d0 00000000 eef23800 eef23a64 00000000 eef23800 eef25800
[ 1.829223] ddc0: 00000000 eea6cc10 00000000 c0dba89c 00000000 c06a3958 eef25800 ef6e7b80
[ 1.837463] dde0: eef23800 ef6e7bd0 00000000 c06a41a4 00000000 00000000 c06a3dc4 002dc6c0
[ 1.845672] de00: eea6cc10 eef22990 eef25800 eef25800 eea6cc10 eea6cc10 c0dbaf80 c0dbaf78
[ 1.853912] de20: 000001f0 c06a4670 00000000 eef25ce8 eef25800 eef25800 eea6cc10 c06a8090
[ 1.862152] de40: 00000000 60000013 c1899108 00000004 21547a13 eea6cc10 ffffffed c10b1acc
[ 1.870391] de60: fffffdfb 00000000 00000000 c0f67858 c0f005a8 c05ffb34 eea6cc10 c18c195c
[ 1.878631] de80: 00000000 c10b1acc 00000000 c05fdd00 eea6cc10 c10b1acc eea6cc44 00000000
[ 1.886840] dea0: c10fa000 00000007 c0f67858 c05fde48 00000000 c10b1acc c05fdd88 c05fc2c8
[ 1.895080] dec0: ee8a46a4 eea67dd0 c10b1acc eee8ea00 c10a6210 c05fd248 c0dbaf88 c0f40af8
[ 1.903320] dee0: 00000000 c10b1acc c0f40af8 00000000 c0e68a14 c05fec8c ffffe000 c0f40af8
[ 1.911560] df00: 00000000 c0101874 00000138 00000000 efffec00 efffecdd c0e6a274 00000138
[ 1.919769] df20: 00000138 c015f0b8 c0e68a14 00000000 00000006 00000006 efffecdd 00000000
[ 1.928009] df40: c0f806b0 00000006 c10fa000 c0f6784c c0f80d58 c10fa000 c0f67850 c10fa000
[ 1.936248] df60: 00000007 c0f00ea0 00000006 00000006 00000000 c0f005a8 c0af025c 00000138
[ 1.944488] df80: 00000000 00000000 c0af025c 00000000 00000000 00000000 00000000 00000000
[ 1.952728] dfa0: 00000000 c0af0264 00000000 c01077b0 00000000 00000000 00000000 00000000
[ 1.960937] dfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1.969177] dfe0: 00000000 00000000 00000000 00000000 00000013 00000000 c0c0c0c0 c0c0c0c0
[ 1.977416] [<c01b3788>] (debug_lockdep_rcu_enabled) from [<c019cc58>] (lock_release+0x25c/0x360)
[ 1.986358] [<c019cc58>] (lock_release) from [<c0af76ec>] (_raw_spin_unlock_irqrestore+0x1c/0x44)
[ 1.995300] [<c0af76ec>] (_raw_spin_unlock_irqrestore) from [<c051b3f8>] (omap_gpio_get_direction+0x38/0x44)
[ 2.005187] [<c051b3f8>] (omap_gpio_get_direction) from [<c0514430>] (gpiochip_lock_as_irq+0x98/0xe4)
[ 2.014495] [<c0514430>] (gpiochip_lock_as_irq) from [<c0514960>] (gpiochip_irq_reqres+0x2c/0x6c)
[ 2.023406] [<c0514960>] (gpiochip_irq_reqres) from [<c01ac370>] (__setup_irq+0x478/0x6ec)
[ 2.031738] [<c01ac370>] (__setup_irq) from [<c01ac73c>] (request_threaded_irq+0xcc/0x14c)
[ 2.040069] [<c01ac73c>] (request_threaded_irq) from [<c0621460>] (regmap_add_irq_chip+0x740/0x8a0)
[ 2.049194] [<c0621460>] (regmap_add_irq_chip) from [<c0621618>] (devm_regmap_add_irq_chip+0x58/0xb4)
[ 2.058471] [<c0621618>] (devm_regmap_add_irq_chip) from [<c062d618>] (cpcap_init_irq_chip+0x138/0x16c)
[ 2.067932] [<c062d618>] (cpcap_init_irq_chip) from [<c062d7a0>] (cpcap_probe+0x154/0x258)
[ 2.076263] [<c062d7a0>] (cpcap_probe) from [<c06a2784>] (spi_drv_probe+0x7c/0xac)
[ 2.083892] [<c06a2784>] (spi_drv_probe) from [<c05fdd00>] (driver_probe_device+0x260/0x2e8)
[ 2.092407] [<c05fdd00>] (driver_probe_device) from [<c05fc374>] (bus_for_each_drv+0x64/0x98)
[ 2.100982] [<c05fc374>] (bus_for_each_drv) from [<c05fd9bc>] (__device_attach+0xb0/0x118)
[ 2.109313] [<c05fd9bc>] (__device_attach) from [<c05fd044>] (bus_probe_device+0x88/0x90)
[ 2.117523] [<c05fd044>] (bus_probe_device) from [<c05fb4d0>] (device_add+0x3c8/0x57c)
[ 2.125518] [<c05fb4d0>] (device_add) from [<c06a3958>] (spi_add_device+0x90/0x134)
[ 2.133209] [<c06a3958>] (spi_add_device) from [<c06a41a4>] (spi_register_controller+0x350/0x7ec)
[ 2.142150] [<c06a41a4>] (spi_register_controller) from [<c06a4670>] (devm_spi_register_controller+0x30/0x70)
[ 2.152130] [<c06a4670>] (devm_spi_register_controller) from [<c06a8090>] (omap2_mcspi_probe+0x27c/0x358)
[ 2.161773] [<c06a8090>] (omap2_mcspi_probe) from [<c05ffb34>] (platform_drv_probe+0x50/0xb0)
[ 2.170349] [<c05ffb34>] (platform_drv_probe) from [<c05fdd00>] (driver_probe_device+0x260/0x2e8)
[ 2.179290] [<c05fdd00>] (driver_probe_device) from [<c05fde48>] (__driver_attach+0xc0/0xc4)
[ 2.187805] [<c05fde48>] (__driver_attach) from [<c05fc2c8>] (bus_for_each_dev+0x6c/0xa0)
[ 2.196014] [<c05fc2c8>] (bus_for_each_dev) from [<c05fd248>] (bus_add_driver+0x100/0x210)
[ 2.204345] [<c05fd248>] (bus_add_driver) from [<c05fec8c>] (driver_register+0x78/0xf4)
[ 2.212402] [<c05fec8c>] (driver_register) from [<c0101874>] (do_one_initcall+0x3c/0x16c)
[ 2.220642] [<c0101874>] (do_one_initcall) from [<c0f00ea0>] (kernel_init_freeable+0x1fc/0x2c4)
[ 2.229400] [<c0f00ea0>] (kernel_init_freeable) from [<c0af0264>] (kernel_init+0x8/0x114)
[ 2.237640] [<c0af0264>] (kernel_init) from [<c01077b0>] (ret_from_fork+0x14/0x24)
[ 2.245269] Code: e3c3303f e593300c e59305ec e16f0f10 (e1a002a0)
[ 2.251403] ---[ end trace 03269d8f047e066c ]---
[ 2.256134] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
[ 2.256134]
[ 2.265350] CPU0: stopping
[ 2.268096] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G D W 4.12.0-10335-gb8c0c26d6667 #516
[ 2.277221] Hardware name: Generic OMAP4 (Flattened Device Tree)
[ 2.283294] [<c0110460>] (unwind_backtrace) from [<c010c4ac>] (show_stack+0x10/0x14)
[ 2.291107] [<c010c4ac>] (show_stack) from [<c0adca28>] (dump_stack+0xac/0xe0)
[ 2.298400] [<c0adca28>] (dump_stack) from [<c010e920>] (handle_IPI+0x300/0x408)
[ 2.305847] [<c010e920>] (handle_IPI) from [<c01015a4>] (gic_handle_irq+0x9c/0xb8)
[ 2.313476] [<c01015a4>] (gic_handle_irq) from [<c0af7e30>] (__irq_svc+0x70/0x98)
[ 2.321044] Exception stack(0xc1001f38 to 0xc1001f80)
[ 2.326141] 1f20: c0108228 00000000
[ 2.334381] 1f40: 00000000 00000000 c1000000 c1007bcc c1007b68 c0f8a938 c1007f68 c1046133
[ 2.342620] 1f60: 00000000 00000000 000006c8 c1001f88 c0108228 c010822c 60000013 ffffffff
[ 2.350860] [<c0af7e30>] (__irq_svc) from [<c010822c>] (arch_cpu_idle+0x20/0x3c)
[ 2.358337] [<c010822c>] (arch_cpu_idle) from [<c018b6b4>] (do_idle+0x168/0x21c)
[ 2.365814] [<c018b6b4>] (do_idle) from [<c018bad4>] (cpu_startup_entry+0x18/0x1c)
[ 2.373443] [<c018bad4>] (cpu_startup_entry) from [<c0f00c2c>] (start_kernel+0x348/0x3c0)
[ 2.381683] [<c0f00c2c>] (start_kernel) from [<8000807c>] (0x8000807c)
[ 2.388275] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b

Droid 4 boots current master again after applying the patch below
(which is git revet of above patch, but I provide the patch, since
it did not revet cleanly).

-- Sebastian

From 0f1adf86f7e526e655f39964ca987fc42911bd96 Mon Sep 17 00:00:00 2001
From: Sebastian Reichel <sre@xxxxxxxxxx>
Date: Mon, 10 Jul 2017 14:52:50 +0200
Subject: [PATCH] Revert "genirq: Move irq resource handling out of spinlocked
region"

This reverts commit 46e48e257360f0845fe17089713cbad4db611e70.
---
kernel/irq/manage.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 5624b2dd6b58..528bfc39042b 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -1168,14 +1168,6 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
new->flags &= ~IRQF_ONESHOT;

mutex_lock(&desc->request_mutex);
- if (!desc->action) {
- ret = irq_request_resources(desc);
- if (ret) {
- pr_err("Failed to request resources for %s (irq %d) on irqchip %s\n",
- new->name, irq, desc->irq_data.chip->name);
- goto out_mutex;
- }
- }

chip_bus_lock(desc);

@@ -1279,6 +1271,13 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
}

if (!shared) {
+ ret = irq_request_resources(desc);
+ if (ret) {
+ pr_err("Failed to request resources for %s (irq %d) on irqchip %s\n",
+ new->name, irq, desc->irq_data.chip->name);
+ goto out_unlock;
+ }
+
init_waitqueue_head(&desc->wait_for_threads);

/* Setup the type (level, edge polarity) if configured: */
@@ -1387,10 +1386,6 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)

chip_bus_sync_unlock(desc);

- if (!desc->action)
- irq_release_resources(desc);
-
-out_mutex:
mutex_unlock(&desc->request_mutex);

out_thread:
--
2.13.2

Attachment: signature.asc
Description: PGP signature