From b5777ff9290b6fbc98b93dd19199cc569a66355a Mon Sep 17 00:00:00 2001 From: Gleb Chesnokov Date: Wed, 10 Dec 2025 19:49:32 +0300 Subject: [PATCH] scst: annotate workqueues for WQ_PERCPU / WQ_UNBOUND Upstream workqueue changes introduce a new WQ_PERCPU flag and plan to switch alloc_workqueue()'s default from per-CPU to unbound To kepp SCST behaviour unchanged across kernels, this patch makes all alloc_workqueue() users explicit about whether they want per-CPU or unbound queues. --- iscsi-scst/kernel/isert-scst/iser_global.c | 7 +++++-- iscsi-scst/kernel/isert-scst/iser_rdma.c | 7 +++++-- qla2x00t-32gbit/qla_os.c | 6 +++++- qla2x00t/qla_os.c | 6 +++++- scst/src/scst_event.c | 4 +++- scst/src/scst_lib.c | 4 +++- srpt/src/ib_srpt.c | 6 +++++- 7 files changed, 31 insertions(+), 9 deletions(-) diff --git a/iscsi-scst/kernel/isert-scst/iser_global.c b/iscsi-scst/kernel/isert-scst/iser_global.c index 7f7ec72bc..a1e12fb45 100644 --- a/iscsi-scst/kernel/isert-scst/iser_global.c +++ b/iscsi-scst/kernel/isert-scst/iser_global.c @@ -138,7 +138,11 @@ int isert_global_init(void) spin_lock_init(&isert_glob.portal_lock); init_waitqueue_head(&isert_glob.portal_wq); - isert_glob.conn_wq = alloc_workqueue("isert_conn_wq", 0, 1); + isert_glob.conn_wq = alloc_workqueue("isert_conn_wq", 0 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 19, 0) + | WQ_PERCPU +#endif + , 1); if (!isert_glob.conn_wq) { PRINT_ERROR("Failed to alloc iser conn work queue"); return -ENOMEM; @@ -164,7 +168,6 @@ free_cmnd_cache: free_wq: destroy_workqueue(isert_glob.conn_wq); - return -ENOMEM; } diff --git a/iscsi-scst/kernel/isert-scst/iser_rdma.c b/iscsi-scst/kernel/isert-scst/iser_rdma.c index 6ed53bc86..dc8c45c1d 100644 --- a/iscsi-scst/kernel/isert-scst/iser_rdma.c +++ b/iscsi-scst/kernel/isert-scst/iser_rdma.c @@ -973,8 +973,11 @@ static struct isert_device *isert_device_create(struct ib_device *ib_dev) cq_desc->idx = i; INIT_WORK(&cq_desc->cq_comp_work, isert_cq_comp_work_cb); - cq_desc->cq_workqueue = alloc_workqueue("isert_cq_%p", - WQ_CPU_INTENSIVE | WQ_MEM_RECLAIM, 1, + cq_desc->cq_workqueue = alloc_workqueue("isert_cq_%p", 0 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 19, 0) + | WQ_PERCPU +#endif + | WQ_CPU_INTENSIVE | WQ_MEM_RECLAIM, 1, cq_desc); if (unlikely(!cq_desc->cq_workqueue)) { PRINT_ERROR("Failed to alloc iser cq work queue for dev:%s", diff --git a/qla2x00t-32gbit/qla_os.c b/qla2x00t-32gbit/qla_os.c index 25bdb4866..827412a72 100644 --- a/qla2x00t-32gbit/qla_os.c +++ b/qla2x00t-32gbit/qla_os.c @@ -3508,7 +3508,11 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) "req->req_q_in=%p req->req_q_out=%p rsp->rsp_q_in=%p rsp->rsp_q_out=%p.\n", req->req_q_in, req->req_q_out, rsp->rsp_q_in, rsp->rsp_q_out); - ha->wq = alloc_workqueue("qla2xxx_wq", WQ_MEM_RECLAIM, 0); + ha->wq = alloc_workqueue("qla2xxx_wq", 0 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 19, 0) + | WQ_PERCPU +#endif + | WQ_MEM_RECLAIM, 0); if (unlikely(!ha->wq)) { ret = -ENOMEM; goto probe_failed; diff --git a/qla2x00t/qla_os.c b/qla2x00t/qla_os.c index 6279b6374..f4ce5704d 100644 --- a/qla2x00t/qla_os.c +++ b/qla2x00t/qla_os.c @@ -468,7 +468,11 @@ static int qla25xx_setup_mode(struct scsi_qla_host *vha) "Failed to create request queue.\n"); goto fail; } - ha->wq = alloc_workqueue("qla2xxx_wq", WQ_MEM_RECLAIM, 1); + ha->wq = alloc_workqueue("qla2xxx_wq", 0 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 19, 0) + | WQ_PERCPU +#endif + | WQ_MEM_RECLAIM, 1); vha->req = ha->req_q_map[req]; options |= BIT_1; for (ques = 1; ques < ha->max_rsp_queues; ques++) { diff --git a/scst/src/scst_event.c b/scst/src/scst_event.c index 857155dd3..2c2ff49e8 100644 --- a/scst/src/scst_event.c +++ b/scst/src/scst_event.c @@ -1082,7 +1082,9 @@ int scst_event_init(void) TRACE_ENTRY(); - scst_event_wq = alloc_workqueue("scst_event_wq", 0, 0); + scst_event_wq = alloc_workqueue("scst_event_wq", 0 + | WQ_UNBOUND, + 0); if (unlikely(!scst_event_wq)) { PRINT_ERROR("Failed to allocate scst_event_wq"); res = -ENOMEM; diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index a78b7a916..eb7f70daa 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -15747,7 +15747,9 @@ int __init scst_lib_init(void) scst_scsi_op_list_init(); - scst_release_acg_wq = alloc_workqueue("scst_release_acg", 0, 1); + scst_release_acg_wq = alloc_workqueue("scst_release_acg", 0 + | WQ_UNBOUND, + 0); if (unlikely(!scst_release_acg_wq)) { PRINT_ERROR("Failed to allocate scst_release_acg_wq"); res = -ENOMEM; diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index 056ac4ec0..b999ab6c0 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -4562,7 +4562,11 @@ static int __init srpt_init_module(void) goto out; } - srpt_wq = alloc_workqueue("srpt", WQ_SYSFS, 0); + srpt_wq = alloc_workqueue("srpt", 0 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 19, 0) + | WQ_PERCPU +#endif + | WQ_SYSFS, 0); if (!srpt_wq) { pr_err("Couldn't allocate the ib_srpt workqueue\n"); ret = -ENOMEM;