diff options
author | Hoan Tran <hotran@apm.com> | 2016-11-14 14:19:02 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-11-14 16:07:38 -0500 |
commit | 6ca595a70bc46e1a0eea3ee0681360f41555bfd9 (patch) | |
tree | a74be329aa0d01356b89cbf2e5a243b0c53759fc | |
parent | a25f0944ba9b1d8a6813fd6f1a86f1bd59ac25a6 (diff) |
mailbox: PCC: Fix lockdep warning when request PCC channel
This patch fixes the lockdep warning below
DEBUG_LOCKS_WARN_ON(irqs_disabled_flags(flags))
------------[ cut here ]------------
WARNING: CPU: 1 PID: 1 at linux-next/kernel/locking/lockdep.c:2876 lockdep_trace_alloc+0xe0/0xf0
Modules linked in:
CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.8.0-11756-g86c5152 #46
...
Call trace:
Exception stack(0xffff8007da837890 to 0xffff8007da8379c0)
7880: ffff8007da834000 0001000000000000
78a0: ffff8007da837a70 ffff0000081111a0 00000000600000c5 000000000000003d
78c0: 9374bc6a7f3c7832 0000000000381878 ffff000009db7ab8 000000000000002f
78e0: ffff00000811aabc ffff000008be2548 ffff8007da837990 ffff00000811adf8
7900: ffff8007da834000 00000000024080c0 00000000000000c0 ffff000009021000
7920: 0000000000000000 0000000000000000 ffff000008c8f7c8 ffff8007da579810
7940: 000000000000002f ffff8007da858000 0000000000000000 0000000000000001
7960: 0000000000000001 0000000000000000 ffff00000811a468 0000000000000002
7980: 656c62617369645f 0000000000038187 00000000000000ee ffff8007da837850
79a0: ffff000009db50c0 ffff000009db569d 0000000000000006 ffff000089db568f
[<ffff0000081111a0>] lockdep_trace_alloc+0xe0/0xf0
[<ffff0000081f4950>] __kmalloc_track_caller+0x50/0x250
[<ffff00000857c088>] devres_alloc_node+0x28/0x60
[<ffff0000081220e0>] devm_request_threaded_irq+0x50/0xe0
[<ffff0000087e6220>] pcc_mbox_request_channel+0x110/0x170
[<ffff0000084b2660>] acpi_cppc_processor_probe+0x264/0x414
[<ffff0000084ae9f4>] __acpi_processor_start+0x28/0xa0
[<ffff0000084aeab0>] acpi_processor_start+0x44/0x54
[<ffff00000857897c>] driver_probe_device+0x1fc/0x2b0
[<ffff000008578ae4>] __driver_attach+0xb4/0xc0
[<ffff00000857683c>] bus_for_each_dev+0x5c/0xa0
[<ffff000008578110>] driver_attach+0x20/0x30
[<ffff000008577c20>] bus_add_driver+0x110/0x230
[<ffff000008579320>] driver_register+0x60/0x100
[<ffff000008d478b8>] acpi_processor_driver_init+0x2c/0xb0
[<ffff000008083168>] do_one_initcall+0x38/0x130
[<ffff000008d20d6c>] kernel_init_freeable+0x210/0x2b4
[<ffff000008945d90>] kernel_init+0x10/0x110
[<ffff000008082e80>] ret_from_fork+0x10/0x50
It's because the spinlock inside pcc_mbox_request_channel() is
kept too long. This patch releases spinlock before request_irq()
and free_irq() to fix this issue as spinlock is only needed to
protect the channel data.
Signed-off-by: Hoan Tran <hotran@apm.com>
Reviewed-by: Prashanth Prakash <pprakash@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/mailbox/pcc.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/mailbox/pcc.c b/drivers/mailbox/pcc.c index 08c87fadca8c..1f32688c312d 100644 --- a/drivers/mailbox/pcc.c +++ b/drivers/mailbox/pcc.c | |||
@@ -65,6 +65,7 @@ | |||
65 | #include <linux/mailbox_controller.h> | 65 | #include <linux/mailbox_controller.h> |
66 | #include <linux/mailbox_client.h> | 66 | #include <linux/mailbox_client.h> |
67 | #include <linux/io-64-nonatomic-lo-hi.h> | 67 | #include <linux/io-64-nonatomic-lo-hi.h> |
68 | #include <acpi/pcc.h> | ||
68 | 69 | ||
69 | #include "mailbox.h" | 70 | #include "mailbox.h" |
70 | 71 | ||
@@ -267,6 +268,8 @@ struct mbox_chan *pcc_mbox_request_channel(struct mbox_client *cl, | |||
267 | if (chan->txdone_method == TXDONE_BY_POLL && cl->knows_txdone) | 268 | if (chan->txdone_method == TXDONE_BY_POLL && cl->knows_txdone) |
268 | chan->txdone_method |= TXDONE_BY_ACK; | 269 | chan->txdone_method |= TXDONE_BY_ACK; |
269 | 270 | ||
271 | spin_unlock_irqrestore(&chan->lock, flags); | ||
272 | |||
270 | if (pcc_doorbell_irq[subspace_id] > 0) { | 273 | if (pcc_doorbell_irq[subspace_id] > 0) { |
271 | int rc; | 274 | int rc; |
272 | 275 | ||
@@ -275,12 +278,11 @@ struct mbox_chan *pcc_mbox_request_channel(struct mbox_client *cl, | |||
275 | if (unlikely(rc)) { | 278 | if (unlikely(rc)) { |
276 | dev_err(dev, "failed to register PCC interrupt %d\n", | 279 | dev_err(dev, "failed to register PCC interrupt %d\n", |
277 | pcc_doorbell_irq[subspace_id]); | 280 | pcc_doorbell_irq[subspace_id]); |
281 | pcc_mbox_free_channel(chan); | ||
278 | chan = ERR_PTR(rc); | 282 | chan = ERR_PTR(rc); |
279 | } | 283 | } |
280 | } | 284 | } |
281 | 285 | ||
282 | spin_unlock_irqrestore(&chan->lock, flags); | ||
283 | |||
284 | return chan; | 286 | return chan; |
285 | } | 287 | } |
286 | EXPORT_SYMBOL_GPL(pcc_mbox_request_channel); | 288 | EXPORT_SYMBOL_GPL(pcc_mbox_request_channel); |
@@ -304,20 +306,19 @@ void pcc_mbox_free_channel(struct mbox_chan *chan) | |||
304 | return; | 306 | return; |
305 | } | 307 | } |
306 | 308 | ||
309 | if (pcc_doorbell_irq[id] > 0) | ||
310 | devm_free_irq(chan->mbox->dev, pcc_doorbell_irq[id], chan); | ||
311 | |||
307 | spin_lock_irqsave(&chan->lock, flags); | 312 | spin_lock_irqsave(&chan->lock, flags); |
308 | chan->cl = NULL; | 313 | chan->cl = NULL; |
309 | chan->active_req = NULL; | 314 | chan->active_req = NULL; |
310 | if (chan->txdone_method == (TXDONE_BY_POLL | TXDONE_BY_ACK)) | 315 | if (chan->txdone_method == (TXDONE_BY_POLL | TXDONE_BY_ACK)) |
311 | chan->txdone_method = TXDONE_BY_POLL; | 316 | chan->txdone_method = TXDONE_BY_POLL; |
312 | 317 | ||
313 | if (pcc_doorbell_irq[id] > 0) | ||
314 | devm_free_irq(chan->mbox->dev, pcc_doorbell_irq[id], chan); | ||
315 | |||
316 | spin_unlock_irqrestore(&chan->lock, flags); | 318 | spin_unlock_irqrestore(&chan->lock, flags); |
317 | } | 319 | } |
318 | EXPORT_SYMBOL_GPL(pcc_mbox_free_channel); | 320 | EXPORT_SYMBOL_GPL(pcc_mbox_free_channel); |
319 | 321 | ||
320 | |||
321 | /** | 322 | /** |
322 | * pcc_send_data - Called from Mailbox Controller code. Used | 323 | * pcc_send_data - Called from Mailbox Controller code. Used |
323 | * here only to ring the channel doorbell. The PCC client | 324 | * here only to ring the channel doorbell. The PCC client |