Shiraz Saleem
4e1a5842a3
RDMA/irdma: Fix data race on CQP completion stats
[ Upstream commit f2c3037811 ]
CQP completion statistics is read lockesly in irdma_wait_event and
irdma_check_cqp_progress while it can be updated in the completion
thread irdma_sc_ccq_get_cqe_info on another CPU as KCSAN reports.
Make completion statistics an atomic variable to reflect coherent updates
to it. This will also avoid load/store tearing logic bug potentially
possible by compiler optimizations.
[77346.170861] BUG: KCSAN: data-race in irdma_handle_cqp_op [irdma] / irdma_sc_ccq_get_cqe_info [irdma]
[77346.171383] write to 0xffff8a3250b108e0 of 8 bytes by task 9544 on cpu 4:
[77346.171483] irdma_sc_ccq_get_cqe_info+0x27a/0x370 [irdma]
[77346.171658] irdma_cqp_ce_handler+0x164/0x270 [irdma]
[77346.171835] cqp_compl_worker+0x1b/0x20 [irdma]
[77346.172009] process_one_work+0x4d1/0xa40
[77346.172024] worker_thread+0x319/0x700
[77346.172037] kthread+0x180/0x1b0
[77346.172054] ret_from_fork+0x22/0x30
[77346.172136] read to 0xffff8a3250b108e0 of 8 bytes by task 9838 on cpu 2:
[77346.172234] irdma_handle_cqp_op+0xf4/0x4b0 [irdma]
[77346.172413] irdma_cqp_aeq_cmd+0x75/0xa0 [irdma]
[77346.172592] irdma_create_aeq+0x390/0x45a [irdma]
[77346.172769] irdma_rt_init_hw.cold+0x212/0x85d [irdma]
[77346.172944] irdma_probe+0x54f/0x620 [irdma]
[77346.173122] auxiliary_bus_probe+0x66/0xa0
[77346.173137] really_probe+0x140/0x540
[77346.173154] __driver_probe_device+0xc7/0x220
[77346.173173] driver_probe_device+0x5f/0x140
[77346.173190] __driver_attach+0xf0/0x2c0
[77346.173208] bus_for_each_dev+0xa8/0xf0
[77346.173225] driver_attach+0x29/0x30
[77346.173240] bus_add_driver+0x29c/0x2f0
[77346.173255] driver_register+0x10f/0x1a0
[77346.173272] __auxiliary_driver_register+0xbc/0x140
[77346.173287] irdma_init_module+0x55/0x1000 [irdma]
[77346.173460] do_one_initcall+0x7d/0x410
[77346.173475] do_init_module+0x81/0x2c0
[77346.173491] load_module+0x1232/0x12c0
[77346.173506] __do_sys_finit_module+0x101/0x180
[77346.173522] __x64_sys_finit_module+0x3c/0x50
[77346.173538] do_syscall_64+0x39/0x90
[77346.173553] entry_SYSCALL_64_after_hwframe+0x63/0xcd
[77346.173634] value changed: 0x0000000000000094 -> 0x0000000000000095
Fixes: 915cc7ac0f ("RDMA/irdma: Add miscellaneous utility definitions")
Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
Link: https://lore.kernel.org/r/20230711175253.1289-3-shiraz.saleem@intel.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-08-03 10:24:03 +02:00
..
2023-07-27 08:50:33 +02:00
2023-05-30 14:03:19 +01:00
2023-06-28 11:12:17 +02:00
2023-03-30 12:49:09 +02:00
2023-07-27 08:50:26 +02:00
2023-06-28 11:12:39 +02:00
2023-06-14 11:15:28 +02:00
2023-07-23 13:49:43 +02:00
2023-07-23 13:49:35 +02:00
2023-07-19 16:21:58 +02:00
2023-07-19 16:20:59 +02:00
2023-04-13 16:55:31 +02:00
2023-07-19 16:21:58 +02:00
2023-05-11 23:03:04 +09:00
2023-07-19 16:21:42 +02:00
2023-05-30 14:03:32 +01:00
2023-07-19 16:21:43 +02:00
2023-06-09 10:34:00 +02:00
2023-07-27 08:50:27 +02:00
2023-06-21 16:00:51 +02:00
2023-07-19 16:22:08 +02:00
2023-07-23 13:49:41 +02:00
2023-05-11 23:03:27 +09:00
2023-08-03 10:23:49 +02:00
2023-08-03 10:24:03 +02:00
2023-07-27 08:50:32 +02:00
2023-05-11 23:03:38 +09:00
2023-06-28 11:12:23 +02:00
2023-07-19 16:21:27 +02:00
2023-07-19 16:21:58 +02:00
2023-08-03 10:23:50 +02:00
2023-07-19 16:21:54 +02:00
2023-04-06 12:10:58 +02:00
2023-07-23 13:49:42 +02:00
2023-08-03 10:24:03 +02:00
2023-07-19 16:21:26 +02:00
2023-05-11 23:03:28 +09:00
2023-07-19 16:21:20 +02:00
2023-07-19 16:22:09 +02:00
2023-07-19 16:22:15 +02:00
2023-05-11 23:03:31 +09:00
2023-07-19 16:22:03 +02:00
2023-05-24 17:32:41 +01:00
2023-07-23 13:49:43 +02:00
2023-08-03 10:23:57 +02:00
2023-07-19 16:21:24 +02:00
2023-07-19 16:21:08 +02:00
2023-05-24 17:32:37 +01:00
2023-07-23 13:49:37 +02:00
2023-07-23 13:49:37 +02:00
2023-07-19 16:22:09 +02:00
2023-07-23 13:49:31 +02:00
2023-08-03 10:24:02 +02:00
2023-06-28 11:12:36 +02:00
2023-07-23 13:49:24 +02:00
2023-07-05 18:27:37 +01:00
2023-07-23 13:49:43 +02:00
2023-07-19 16:21:57 +02:00
2023-07-27 08:50:26 +02:00
2023-07-23 13:49:42 +02:00
2023-05-24 17:32:42 +01:00
2023-08-03 10:23:51 +02:00
2023-07-23 13:49:44 +02:00
2023-08-03 10:23:59 +02:00
2023-07-27 08:50:38 +02:00
2023-08-03 10:24:01 +02:00
2023-06-21 16:00:52 +02:00
2023-07-19 16:21:00 +02:00
2023-04-06 12:10:44 +02:00
2023-07-23 13:49:46 +02:00
2023-07-19 16:22:14 +02:00
2023-05-24 17:32:53 +01:00
2023-05-11 23:03:16 +09:00
2023-07-19 16:21:59 +02:00
2023-07-23 13:49:35 +02:00
2023-07-23 13:49:49 +02:00
2023-07-23 13:49:34 +02:00
2023-08-03 10:23:57 +02:00
2023-07-27 08:50:50 +02:00
2023-05-11 23:03:31 +09:00
2023-08-03 10:23:57 +02:00
2023-06-28 11:12:35 +02:00
2023-06-14 11:15:28 +02:00
2023-07-19 16:21:01 +02:00
2023-06-21 16:00:56 +02:00
2023-08-03 10:23:53 +02:00
2023-07-23 13:49:21 +02:00
2023-07-23 13:49:42 +02:00
2023-06-14 11:15:32 +02:00
2023-07-19 16:21:41 +02:00
2023-06-28 11:12:40 +02:00
2023-07-27 08:50:45 +02:00
2023-07-19 16:20:55 +02:00
2023-05-11 23:03:31 +09:00
2023-07-19 16:21:48 +02:00
2023-06-09 10:34:07 +02:00
2023-05-30 14:03:32 +01:00