From: Hongyan Xu <getshell@seu.edu.cn>
To: justin.tee@broadcom.com, paul.ely@broadcom.com
Cc: James.Bottomley@HansenPartnership.com, mkp@kernel.org,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
jianhao.xu@seu.edu.cn, Hongyan Xu <getshell@seu.edu.cn>
Subject: [PATCH] scsi: lpfc: disable delayed CQ work before freeing a queue
Date: Mon, 28 Sep 2026 21:41:54 +0800 [thread overview]
Message-ID: <20260928134154.1595-1-getshell@seu.edu.cn> (raw)
CQ processing can leave sched_irqwork or sched_spwork pending on a
delayed work timer. Flushing the HBA workqueue does not wait for delayed
work whose timer has not yet queued it, allowing lpfc_sli4_queue_free()
to release the embedded work item and its queue first.
Initialize both delayed works before allocation can fail, and disable
them synchronously before freeing any queue resources.
Fixes: 32517fc0975b ("scsi: lpfc: Rework EQ/CQ processing to address interrupt coalescing")
Signed-off-by: Hongyan Xu <getshell@seu.edu.cn>
---
drivers/scsi/lpfc/lpfc_sli.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index cfa4371169f1..0348442b979f 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -15828,6 +15828,9 @@ lpfc_sli4_queue_free(struct lpfc_queue *queue)
if (!queue)
return;
+ disable_delayed_work_sync(&queue->sched_irqwork);
+ disable_delayed_work_sync(&queue->sched_spwork);
+
if (!list_empty(&queue->wq_list))
list_del(&queue->wq_list);
@@ -15892,6 +15895,8 @@ lpfc_sli4_queue_alloc(struct lpfc_hba *phba, uint32_t page_size,
INIT_LIST_HEAD(&queue->page_list);
INIT_LIST_HEAD(&queue->child_list);
INIT_LIST_HEAD(&queue->cpu_list);
+ INIT_DELAYED_WORK(&queue->sched_irqwork, lpfc_sli4_dly_hba_process_cq);
+ INIT_DELAYED_WORK(&queue->sched_spwork, lpfc_sli4_dly_sp_process_cq);
/* Set queue parameters now. If the system cannot provide memory
* resources, the free routine needs to know what was allocated.
@@ -15922,8 +15927,6 @@ lpfc_sli4_queue_alloc(struct lpfc_hba *phba, uint32_t page_size,
}
INIT_WORK(&queue->irqwork, lpfc_sli4_hba_process_cq);
INIT_WORK(&queue->spwork, lpfc_sli4_sp_process_cq);
- INIT_DELAYED_WORK(&queue->sched_irqwork, lpfc_sli4_dly_hba_process_cq);
- INIT_DELAYED_WORK(&queue->sched_spwork, lpfc_sli4_dly_sp_process_cq);
/* notify_interval will be set during q creation */
--
2.50.1.windows.1
next reply other threads:[~2026-09-28 13:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 13:41 Hongyan Xu [this message]
2026-09-28 14:02 ` Paul Ely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260928134154.1595-1-getshell@seu.edu.cn \
--to=getshell@seu.edu.cn \
--cc=James.Bottomley@HansenPartnership.com \
--cc=jianhao.xu@seu.edu.cn \
--cc=justin.tee@broadcom.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=mkp@kernel.org \
--cc=paul.ely@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®