John Meneghini
c75b92dbd3
scsi: bnx2fc: Make bnx2fc_recv_frame() mp safe
commit 936bd03405 upstream.
Running tests with a debug kernel shows that bnx2fc_recv_frame() is
modifying the per_cpu lport stats counters in a non-mpsafe way. Just boot
a debug kernel and run the bnx2fc driver with the hardware enabled.
[ 1391.699147] BUG: using smp_processor_id() in preemptible [00000000] code: bnx2fc_
[ 1391.699160] caller is bnx2fc_recv_frame+0xbf9/0x1760 [bnx2fc]
[ 1391.699174] CPU: 2 PID: 4355 Comm: bnx2fc_l2_threa Kdump: loaded Tainted: G B
[ 1391.699180] Hardware name: HP ProLiant DL120 G7, BIOS J01 07/01/2013
[ 1391.699183] Call Trace:
[ 1391.699188] dump_stack_lvl+0x57/0x7d
[ 1391.699198] check_preemption_disabled+0xc8/0xd0
[ 1391.699205] bnx2fc_recv_frame+0xbf9/0x1760 [bnx2fc]
[ 1391.699215] ? do_raw_spin_trylock+0xb5/0x180
[ 1391.699221] ? bnx2fc_npiv_create_vports.isra.0+0x4e0/0x4e0 [bnx2fc]
[ 1391.699229] ? bnx2fc_l2_rcv_thread+0xb7/0x3a0 [bnx2fc]
[ 1391.699240] bnx2fc_l2_rcv_thread+0x1af/0x3a0 [bnx2fc]
[ 1391.699250] ? bnx2fc_ulp_init+0xc0/0xc0 [bnx2fc]
[ 1391.699258] kthread+0x364/0x420
[ 1391.699263] ? _raw_spin_unlock_irq+0x24/0x50
[ 1391.699268] ? set_kthread_struct+0x100/0x100
[ 1391.699273] ret_from_fork+0x22/0x30
Restore the old get_cpu/put_cpu code with some modifications to reduce the
size of the critical section.
Link: https://lore.kernel.org/r/20220124145110.442335-1-jmeneghi@redhat.com
Fixes: d576a5e80c ("bnx2fc: Improve stats update mechanism")
Tested-by: Guangwu Zhang <guazhang@redhat.com>
Acked-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: John Meneghini <jmeneghi@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-05-16 12:35:33 +09:00
..
2023-05-16 09:14:47 +09:00
2023-05-16 11:33:39 +09:00
2023-05-15 11:34:48 +09:00
2016-10-26 22:17:43 -04:00
2023-05-16 08:46:28 +09:00
2023-05-16 11:27:54 +09:00
2023-05-15 16:33:37 +09:00
2023-05-16 12:35:33 +09:00
2023-05-16 09:56:12 +09:00
2023-05-16 12:15:18 +09:00
2023-05-15 16:34:38 +09:00
2016-09-14 12:47:42 -04:00
2023-05-16 11:42:20 +09:00
2023-05-15 16:35:41 +09:00
2023-05-16 08:57:03 +09:00
2023-05-16 09:57:54 +09:00
2023-05-15 12:16:49 +09:00
2023-05-16 10:34:00 +09:00
2023-05-15 09:06:57 +09:00
2023-05-15 15:17:31 +09:00
2023-05-16 10:54:28 +09:00
2023-05-16 11:11:04 +09:00
2023-05-16 12:16:01 +09:00
2023-05-16 11:42:19 +09:00
2023-05-16 12:21:01 +09:00
2018-05-25 16:13:08 +02:00
2016-07-20 17:38:35 -06:00
2015-05-31 18:06:28 -07:00
2023-05-16 09:57:52 +09:00
2023-05-16 12:15:37 +09:00
2023-05-16 09:37:53 +09:00
2023-05-15 13:50:10 +09:00
2017-08-06 18:59:49 -07:00
2023-05-15 15:08:47 +09:00
2023-05-16 12:31:54 +09:00
2023-05-15 08:14:20 +09:00
2015-04-27 10:10:19 -07:00
2023-05-15 08:14:20 +09:00
2015-04-27 10:04:39 -07:00
2023-05-15 08:14:20 +09:00
2015-04-27 10:05:55 -07:00
2016-07-13 22:33:23 -04:00
2016-07-13 22:33:23 -04:00
2015-08-07 15:03:42 +02:00
2013-11-26 11:09:07 +01:00
2014-10-20 16:21:33 +02:00
2014-10-20 16:21:33 +02:00
2023-05-16 12:16:03 +09:00
2015-05-31 18:06:28 -07:00
2016-02-23 21:27:02 -05:00
2015-04-09 18:08:31 -07:00
2015-05-31 18:06:28 -07:00
2015-05-31 18:06:28 -07:00
2015-04-17 10:13:56 -07:00
2023-05-15 16:21:11 +09:00
2015-11-25 22:08:55 -05:00
2015-11-25 22:08:52 -05:00
2023-05-16 11:46:30 +09:00
2023-05-16 11:10:45 +09:00
2014-10-20 16:21:33 +02:00
2015-04-14 09:50:27 -07:00
2016-08-16 00:49:32 -04:00
2023-05-16 12:15:06 +09:00
2016-04-11 16:57:09 -04:00
2016-02-23 21:27:02 -05:00
2014-07-17 22:07:37 +02:00
2016-05-10 22:01:07 -04:00
2014-11-24 14:45:27 +01:00
2023-05-15 09:20:02 +09:00
2023-05-15 09:20:02 +09:00
2016-02-23 21:27:02 -05:00
2023-05-16 11:24:41 +09:00
2017-01-12 11:39:29 +01:00
2016-09-29 21:52:43 -04:00
2016-02-25 21:16:49 -05:00
2013-04-09 14:13:16 -04:00
2016-02-25 21:16:49 -05:00
2023-05-16 09:04:57 +09:00
2013-11-26 11:09:07 +01:00
2023-05-16 11:26:28 +09:00
2023-05-15 13:56:49 +09:00
2023-05-16 09:47:18 +09:00
2017-12-20 10:07:22 +01:00
2015-08-12 13:14:57 -07:00
2015-08-12 13:14:57 -07:00
2016-02-25 21:10:53 -05:00
2015-11-20 11:39:03 -05:00
2023-05-15 17:11:36 +09:00
2023-05-15 17:11:36 +09:00
2023-05-15 15:17:27 +09:00
2013-04-09 14:13:27 -04:00
2023-05-16 08:19:55 +09:00
2023-05-15 16:59:19 +09:00
2016-01-27 20:36:10 +08:00
2023-05-16 11:02:40 +09:00
2023-05-15 14:56:54 +09:00
2013-01-03 15:57:01 -08:00
2016-01-27 20:36:10 +08:00
2023-05-16 12:30:22 +09:00
2016-02-05 16:29:28 -06:00
2023-05-15 09:20:02 +09:00
2023-05-15 16:21:11 +09:00
2016-09-26 20:49:25 -04:00
2023-05-15 14:49:58 +09:00
2014-03-27 08:26:31 -07:00
2023-05-16 08:46:49 +09:00
2014-10-20 16:21:33 +02:00
2013-04-09 14:13:15 -04:00
2023-05-16 09:39:48 +09:00
2013-04-15 14:30:44 -06:00
2014-11-24 14:45:27 +01:00
2014-07-17 22:07:35 +02:00
2015-05-31 18:06:28 -07:00
2023-05-15 15:10:53 +09:00
2016-09-14 14:11:12 -04:00
2013-01-03 15:57:01 -08:00
2013-01-03 15:57:01 -08:00
2015-05-31 18:06:28 -07:00
2014-11-24 20:01:28 +01:00
2016-09-04 01:28:07 -04:00
2016-02-23 21:27:02 -05:00
2015-05-31 18:06:28 -07:00
2016-04-30 09:25:26 -07:00
2015-05-31 18:06:28 -07:00
2016-03-01 20:06:49 -05:00
2016-11-28 15:51:31 -05:00
2016-04-04 12:07:42 -04:00
2023-05-16 12:23:15 +09:00
2023-05-16 08:20:42 +09:00
2023-05-15 12:38:47 +09:00
2016-06-18 11:59:01 -07:00
2014-11-12 11:16:12 +01:00
2023-05-16 11:25:02 +09:00
2023-05-15 14:41:06 +09:00
2014-11-12 11:16:05 +01:00
2014-04-24 13:44:54 -04:00
2023-05-15 11:01:25 +09:00
2016-10-07 09:28:53 -07:00
2016-04-11 16:57:09 -04:00
2016-03-14 21:05:04 -04:00
2023-05-16 11:42:21 +09:00
2014-06-06 16:08:16 -07:00
2023-05-16 12:02:19 +09:00
2023-05-15 16:35:45 +09:00
2016-04-11 16:57:09 -04:00
2023-05-16 12:21:28 +09:00
2016-08-18 22:23:20 -04:00
2023-05-16 08:31:27 +09:00
2018-06-06 16:44:38 +02:00
2023-05-16 12:02:19 +09:00
2014-11-12 11:15:54 +01:00
2016-09-15 09:51:14 -04:00
2023-05-16 12:00:07 +09:00
2016-09-15 09:51:14 -04:00
2016-04-11 16:57:09 -04:00
2023-05-16 12:00:38 +09:00
2023-05-15 17:27:31 +09:00
2014-10-20 16:21:33 +02:00
2016-02-23 21:27:02 -05:00
2023-05-16 11:02:43 +09:00
2023-05-15 10:26:52 +09:00
2023-05-16 12:33:04 +09:00
2023-05-16 12:33:04 +09:00
2014-11-12 11:15:57 +01:00
2023-05-16 10:49:48 +09:00
2015-11-18 11:59:09 -05:00
2016-02-23 21:27:02 -05:00
2023-05-15 12:38:49 +09:00
2014-05-28 12:16:28 +02:00
2023-05-15 16:21:11 +09:00
2014-11-20 09:11:15 +01:00
2023-05-16 11:02:42 +09:00
2014-10-20 16:21:33 +02:00
2015-05-31 18:06:28 -07:00
2023-05-16 12:00:39 +09:00
2023-05-16 12:29:44 +09:00
2016-11-01 13:31:23 -04:00
2015-02-02 09:57:46 -08:00
2013-04-09 14:13:15 -04:00
2016-09-01 17:52:01 -07:00
2015-05-31 18:06:28 -07:00
2023-05-12 17:04:04 +09:00
2013-01-03 15:57:01 -08:00
2013-11-26 11:09:07 +01:00