* [PATCH v2] bus: fsl-mc-msi: fix MSI descriptor mutex lock for msi_first_desc()
@ 2022-04-12 7:56 Shin'ichiro Kawasaki
2022-04-27 10:38 ` Shinichiro Kawasaki
2022-04-27 17:46 ` [tip: irq/urgent] bus: fsl-mc-msi: Fix " tip-bot2 for Shin'ichiro Kawasaki
0 siblings, 2 replies; 4+ messages in thread
From: Shin'ichiro Kawasaki @ 2022-04-12 7:56 UTC (permalink / raw)
To: linux-kernel, Stuart Yoder, Laurentiu Tudor
Cc: Thomas Gleixner, Jason Gunthorpe, Damien Le Moal,
Shin'ichiro Kawasaki
Commit e8604b1447b4 ("bus: fsl-mc-msi: Simplify MSI descriptor
handling") introduced a call to the helper function msi_first_desc(),
which needs MSI descriptor mutex lock before call. However, the required
mutex lock was not added. This resulted in lockdep assert WARNING [1].
Fix this by adding the mutex lock and unlock around the function call.
[1]
[ 8.542804] WARNING: CPU: 4 PID: 119 at kernel/irq/msi.c:274 msi_first_desc+0xd0/0x10c
[ 8.551428] Modules linked in:
[ 8.555184] CPU: 4 PID: 119 Comm: kworker/u32:1 Not tainted 5.18.0-rc1+ #5
[ 8.562755] Hardware name: SolidRun Ltd. SolidRun CEX7 Platform, BIOS EDK II Aug 9 2021
[ 8.571539] Workqueue: events_unbound deferred_probe_work_func
[ 8.578079] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 8.585736] pc : msi_first_desc+0xd0/0x10c
[ 8.590529] lr : msi_first_desc+0xcc/0x10c
[ 8.595321] sp : ffff800009856fb0
[ 8.599328] x29: ffff800009856fb0 x28: ffff3018789f0000 x27: ffff3018789f0000
[ 8.607175] x26: 1ffff0000130ae2a x25: 1fffe6030f13e0a4 x24: 1fffe6030f13e0a3
[ 8.615020] x23: ffff301878a09024 x22: ffff301860993800 x21: ffffc539150ec000
[ 8.622865] x20: 0000000000000000 x19: ffff301878a04880 x18: ffff30257b37b588
[ 8.630710] x17: 0000000000000000 x16: 1fffe6030c3d89a3 x15: 1fffe6030c3d8982
[ 8.638555] x14: 0000000000000004 x13: ffff301861ec4c14 x12: ffff70000130adc3
[ 8.646400] x11: 1ffff0000130adc2 x10: ffff70000130adc2 x9 : ffffc53911dd0790
[ 8.654245] x8 : ffff800009856e17 x7 : 0000000000000001 x6 : 0000000041b58ab3
[ 8.662089] x5 : ffff70000130ada2 x4 : 1ffff0000130add2 x3 : 1fffe6030c3d8802
[ 8.669933] x2 : 0000000000000000 x1 : 0000000000000000 x0 : 0000000000000000
[ 8.677778] Call trace:
[ 8.680918] msi_first_desc+0xd0/0x10c
[ 8.685364] fsl_mc_msi_domain_alloc_irqs+0x7c/0xc0
[ 8.690938] fsl_mc_populate_irq_pool+0x80/0x3cc
[ 8.696251] dprc_scan_objects+0x370/0x560
[ 8.701042] dprc_probe+0x54/0x210
[ 8.705137] fsl_mc_driver_probe+0x60/0xc0
[ 8.709934] really_probe+0x328/0x9bc
[ 8.714292] __driver_probe_device+0x268/0x3d0
[ 8.719431] driver_probe_device+0x64/0x154
[ 8.724310] __device_attach_driver+0x194/0x250
[ 8.729536] bus_for_each_drv+0x114/0x190
[ 8.734241] __device_attach+0x198/0x34c
[ 8.738859] device_initial_probe+0x20/0x30
[ 8.743738] bus_probe_device+0x168/0x1e0
[ 8.748443] device_add+0x858/0x12a0
[ 8.752713] fsl_mc_device_add+0x4bc/0x950
[ 8.757505] fsl_mc_bus_probe+0x464/0x740
[ 8.762210] platform_probe+0xd0/0x1b0
[ 8.766653] really_probe+0x328/0x9bc
[ 8.771010] __driver_probe_device+0x268/0x3d0
[ 8.776149] driver_probe_device+0x64/0x154
[ 8.781028] __device_attach_driver+0x194/0x250
[ 8.786254] bus_for_each_drv+0x114/0x190
[ 8.790958] __device_attach+0x198/0x34c
[ 8.795576] device_initial_probe+0x20/0x30
[ 8.800455] bus_probe_device+0x168/0x1e0
[ 8.805159] deferred_probe_work_func+0x16c/0x24c
[ 8.810558] process_one_work+0x69c/0xf40
[ 8.815265] worker_thread+0x3dc/0xc50
[ 8.819710] kthread+0x2cc/0x340
[ 8.823635] ret_from_fork+0x10/0x20
[ 8.827909] irq event stamp: 2082
[ 8.831915] hardirqs last enabled at (2081): [<ffffc539131f6670>] _raw_spin_unlock_irqrestore+0x120/0x144
[ 8.842267] hardirqs last disabled at (2082): [<ffffc539131d5ef4>] el1_dbg+0x24/0x80
[ 8.850708] softirqs last enabled at (2002): [<ffffc53910d90a38>] __do_softirq+0x528/0x8e0
[ 8.859753] softirqs last disabled at (1997): [<ffffc53910e3c3e8>] __irq_exit_rcu+0x3f8/0x680
Fixes: e8604b1447b4 ("bus: fsl-mc-msi: Simplify MSI descriptor handling")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
CC: stable@vger.kernel.org # v5.17+
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
---
Changes from v1:
* Added a Reviewed-by tag
* Reflected a nit comment on the list
drivers/bus/fsl-mc/fsl-mc-msi.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/bus/fsl-mc/fsl-mc-msi.c b/drivers/bus/fsl-mc/fsl-mc-msi.c
index 5e0e4393ce4d..0cfe859a4ac4 100644
--- a/drivers/bus/fsl-mc/fsl-mc-msi.c
+++ b/drivers/bus/fsl-mc/fsl-mc-msi.c
@@ -224,8 +224,12 @@ int fsl_mc_msi_domain_alloc_irqs(struct device *dev, unsigned int irq_count)
if (error)
return error;
+ msi_lock_descs(dev);
if (msi_first_desc(dev, MSI_DESC_ALL))
- return -EINVAL;
+ error = -EINVAL;
+ msi_unlock_descs(dev);
+ if (error)
+ return error;
/*
* NOTE: Calling this function will trigger the invocation of the
--
2.35.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] bus: fsl-mc-msi: fix MSI descriptor mutex lock for msi_first_desc()
2022-04-12 7:56 [PATCH v2] bus: fsl-mc-msi: fix MSI descriptor mutex lock for msi_first_desc() Shin'ichiro Kawasaki
@ 2022-04-27 10:38 ` Shinichiro Kawasaki
2022-04-27 17:38 ` Thomas Gleixner
2022-04-27 17:46 ` [tip: irq/urgent] bus: fsl-mc-msi: Fix " tip-bot2 for Shin'ichiro Kawasaki
1 sibling, 1 reply; 4+ messages in thread
From: Shinichiro Kawasaki @ 2022-04-27 10:38 UTC (permalink / raw)
To: linux-kernel, Stuart Yoder, Laurentiu Tudor
Cc: Thomas Gleixner, Jason Gunthorpe, Damien Le Moal
On Apr 12, 2022 / 16:56, Shin'ichiro Kawasaki wrote:
> Commit e8604b1447b4 ("bus: fsl-mc-msi: Simplify MSI descriptor
> handling") introduced a call to the helper function msi_first_desc(),
> which needs MSI descriptor mutex lock before call. However, the required
> mutex lock was not added. This resulted in lockdep assert WARNING [1].
> Fix this by adding the mutex lock and unlock around the function call.
This is a gentle reminder. Comments or merge to upstream will be appreciated.
--
Best Regards,
Shin'ichiro Kawasaki
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] bus: fsl-mc-msi: fix MSI descriptor mutex lock for msi_first_desc()
2022-04-27 10:38 ` Shinichiro Kawasaki
@ 2022-04-27 17:38 ` Thomas Gleixner
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Gleixner @ 2022-04-27 17:38 UTC (permalink / raw)
To: Shinichiro Kawasaki, linux-kernel, Stuart Yoder, Laurentiu Tudor
Cc: Jason Gunthorpe, Damien Le Moal
On Wed, Apr 27 2022 at 10:38, Shinichiro Kawasaki wrote:
> On Apr 12, 2022 / 16:56, Shin'ichiro Kawasaki wrote:
>> Commit e8604b1447b4 ("bus: fsl-mc-msi: Simplify MSI descriptor
>> handling") introduced a call to the helper function msi_first_desc(),
>> which needs MSI descriptor mutex lock before call. However, the required
>> mutex lock was not added. This resulted in lockdep assert WARNING [1].
>> Fix this by adding the mutex lock and unlock around the function call.
>
> This is a gentle reminder. Comments or merge to upstream will be appreciated.
I expected it to go through the FSL tree. I pick it up now.
Thanks,
tglx
^ permalink raw reply [flat|nested] 4+ messages in thread
* [tip: irq/urgent] bus: fsl-mc-msi: Fix MSI descriptor mutex lock for msi_first_desc()
2022-04-12 7:56 [PATCH v2] bus: fsl-mc-msi: fix MSI descriptor mutex lock for msi_first_desc() Shin'ichiro Kawasaki
2022-04-27 10:38 ` Shinichiro Kawasaki
@ 2022-04-27 17:46 ` tip-bot2 for Shin'ichiro Kawasaki
1 sibling, 0 replies; 4+ messages in thread
From: tip-bot2 for Shin'ichiro Kawasaki @ 2022-04-27 17:46 UTC (permalink / raw)
To: linux-tip-commits
Cc: Shin'ichiro Kawasaki, Thomas Gleixner, Damien Le Moal,
stable, x86, linux-kernel, maz
The following commit has been merged into the irq/urgent branch of tip:
Commit-ID: c7d2f89fea26c84d5accc55d9976dd7e5305e63a
Gitweb: https://git.kernel.org/tip/c7d2f89fea26c84d5accc55d9976dd7e5305e63a
Author: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
AuthorDate: Tue, 12 Apr 2022 16:56:36 +09:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Wed, 27 Apr 2022 19:42:32 +02:00
bus: fsl-mc-msi: Fix MSI descriptor mutex lock for msi_first_desc()
Commit e8604b1447b4 introduced a call to the helper function
msi_first_desc(), which needs MSI descriptor mutex lock before
call. However, the required mutex lock was not added. This results in
lockdep assertion:
WARNING: CPU: 4 PID: 119 at kernel/irq/msi.c:274 msi_first_desc+0xd0/0x10c
msi_first_desc+0xd0/0x10c
fsl_mc_msi_domain_alloc_irqs+0x7c/0xc0
fsl_mc_populate_irq_pool+0x80/0x3cc
Fix this by adding the mutex lock and unlock around the function call.
Fixes: e8604b1447b4 ("bus: fsl-mc-msi: Simplify MSI descriptor handling")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20220412075636.755454-1-shinichiro.kawasaki@wdc.com
---
drivers/bus/fsl-mc/fsl-mc-msi.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/bus/fsl-mc/fsl-mc-msi.c b/drivers/bus/fsl-mc/fsl-mc-msi.c
index 5e0e439..0cfe859 100644
--- a/drivers/bus/fsl-mc/fsl-mc-msi.c
+++ b/drivers/bus/fsl-mc/fsl-mc-msi.c
@@ -224,8 +224,12 @@ int fsl_mc_msi_domain_alloc_irqs(struct device *dev, unsigned int irq_count)
if (error)
return error;
+ msi_lock_descs(dev);
if (msi_first_desc(dev, MSI_DESC_ALL))
- return -EINVAL;
+ error = -EINVAL;
+ msi_unlock_descs(dev);
+ if (error)
+ return error;
/*
* NOTE: Calling this function will trigger the invocation of the
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-04-27 17:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-12 7:56 [PATCH v2] bus: fsl-mc-msi: fix MSI descriptor mutex lock for msi_first_desc() Shin'ichiro Kawasaki
2022-04-27 10:38 ` Shinichiro Kawasaki
2022-04-27 17:38 ` Thomas Gleixner
2022-04-27 17:46 ` [tip: irq/urgent] bus: fsl-mc-msi: Fix " tip-bot2 for Shin'ichiro Kawasaki
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).