From: Bart Van Assche <bvanassche@acm.org>
To: "Martin K . Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, Bart Van Assche <bvanassche@acm.org>
Subject: [PATCH v4 00/54] scsi: Enable context analysis for most drivers
Date: Fri, 25 Sep 2026 11:25:38 -0700 [thread overview]
Message-ID: <cover.1790360262.git.bvanassche@acm.org> (raw)
This patch series enables lock context analysis for all SCSI drivers in the
drivers/scsi/ directory except scsi_debug. The advantages are as follows:
- The compiler (only Clang) verifies whether the lock and unlock calls match
what has been declared via __must_hold(), __acquires() or __releases().
This is useful for catching locking bugs in error paths.
- Support for __guarded_by() is enabled. If a member variable is annotated
with __guarded_by(lock), the compiler will issue a warning if that member
variable is accessed without holding 'lock'.
Please consider this patch series for the next merge window.
Thanks,
Bart.
Changes compared to v3:
- Dropped the SCSI core and UFS patches (merged upstream in Linux 7.3).
- Replaced __no_context_analysis with __context_unsafe(/*reason*/) across
drivers with conditional locking (aacraid, ips, libfc, lpfc, mvsas, qedi,
qla2xxx, qla4xxx).
- Passed struct pointers directly to functions called with locks held instead
of dereferencing or using __assume_ctx_lock():
* BusLogic: Pass struct Scsi_Host * directly to multiple functions.
* libiscsi: Pass struct iscsi_session * directly to functions requiring
session locks and update callers in be2iscsi, bnx2i, cxgbi, libiscsi,
libiscsi_tcp, qedi, qla4xxx, and iser.
* bnx2fc: Pass tgt directly to several functions.
* csiostor: Pass struct csio_hw * directly to cleanup and abort functions.
* fnic: Pass struct fnic_iport_s * and struct fnic * directly.
* ipr: Pass struct Scsi_Host * directly to error handling functions.
* qla1280: Pass struct Scsi_Host * directly to wait/error functions.
* NCR5380: Pass struct NCR5380_hostdata * directly to NCR5380_select()
and NCR5380_information_transfer().
* fcoe: Pass struct fcoe_ctlr * directly to functions called with locks
held.
- scsi: ipr: Added patch to simplify ipr_eh_abort() by deriving the host
pointer once (detected by Sashiko).
- scsi: smartpqi: Fixed missing ampersands (&ctrl_info->...), documented
locking requirements with __acquires(), __releases(), and __cond_releases(),
and suppressed complaints with __acquire() where mutex usage is irregular.
- scsi: cxgbi: Added __assume_ctx_lock(&conn->session->back_lock) with a
TODO comment documenting missing locking around iscsi_itt_to_ctask().
- scsi: libfc: Added __must_hold annotations for discovery and FCP functions.
- scsi: ibmvscsi_tgt: Added __must_hold(&vscsi->intr_lock) annotations.
- scsi: pm8001: Added Acked-by from Jack Wang.
- Consolidated preparation and enabling patches for aic7xxx, be2iscsi, and
bnx2i.
- Moved the scsi_debug changes into a separate patch series.
- Dropped megaraid / megaraid_sas patches from this series. These will be
reposted later.
- Added patch "scsi: drivers: Enable lock context analysis" as the final patch
to enable CONTEXT_ANALYSIS := y in drivers/scsi/Makefile (excluding
scsi_debug).
Changes compared to v2:
- Added patch "scsi: core: Pass the SCSI host pointer directly".
- Corrected several annotations that had missing or extra ampersands (&).
- Reduced the number of __assume_ctx_lock() statements.
Changes compared to v1:
- Split patch "Enable lock context analysis" into one patch per driver.
Bart Van Assche (54):
PCI: Convert to_pci_dev() into an inline function
scsi: sg: Prepare for enabling lock context analysis
scsi: st: Prepare for enabling lock context analysis
scsi: BusLogic: Pass the host pointer directly to several functions
scsi: BusLogic: Prepare for enabling lock context analysis
scsi: NCR5380: Prepare for enabling lock context analysis
scsi: aacraid: Enable lock context analysis
scsi: aha152x: Prepare for enabling lock context analysis
scsi: aic7xxx: Enable lock context analysis
scsi: aic94xx: Enable lock context analysis
scsi: arcmsr: Enable lock context analysis
scsi: libiscsi: Pass the session pointer directly to several functions
scsi: libiscsi: Prepare for enabling lock context analysis
scsi: be2iscsi: Enable lock context analysis
scsi: cxgbi: Enable lock context analysis
scsi: bfa: Enable lock context analysis
scsi: bnx2fc: Pass tgt directly to several functions
scsi: bnx2fc: Enable lock context analysis
scsi: bnx2i: Enable lock context analysis
scsi: csiostor: Pass the hw pointer directly to several functions
scsi: csiostor: Enable lock context analysis
scsi: elx: Enable lock context analysis
scsi: esas2r: Enable lock context analysis
scsi: fcoe: Enable lock context analysis
scsi: fnic: Pass pointers directly to several functions
scsi: fnic: Enable lock context analysis
scsi: hisi_sas: Enable lock context analysis
scsi: hpsa: Prepare for enabling lock context analysis
scsi: ibmvscsi: Enable lock context analysis
scsi: ibmvscsi_tgt: Enable lock context analysis
scsi: ipr: Simplify ipr_eh_abort()
scsi: ipr: Pass the host pointer directly to several functions
scsi: ipr: Prepare for enabling lock context analysis
scsi: ips: Prepare for enabling lock context analysis
scsi: isci: Enable lock context analysis
scsi: libfc: Enable lock context analysis
scsi: libsas: Prepare for enabling lock context analysis
scsi: libsas: Enable lock context analysis
scsi: lpfc: Prepare for enabling lock context analysis
scsi: mpt3sas: Enable lock context analysis
scsi: mvsas: Enable lock context analysis
scsi: pcmcia: Enable lock context analysis
scsi: pm8001: Enable lock context analysis
scsi: qedf: Enable lock context analysis
scsi: qedi: Enable lock context analysis
scsi: qla1280: Pass the host pointer directly to several functions
scsi: qla1280: Prepare for enabling lock context analysis
scsi: qla2xxx: Enable lock context analysis
scsi: qla4xxx: Enable lock context analysis
scsi: iSCSI transport: Prepare for enabling lock context analysis
scsi: smartpqi: Enable lock context analysis
scsi: snic: Enable lock context analysis
scsi: sym53c8xx_2: Enable lock context analysis
scsi: drivers: Enable lock context analysis
drivers/infiniband/ulp/iser/iser_initiator.c | 3 +-
drivers/scsi/BusLogic.c | 99 ++++---
drivers/scsi/BusLogic.h | 3 +-
drivers/scsi/Makefile | 25 +-
drivers/scsi/NCR5380.c | 19 +-
drivers/scsi/NCR5380.h | 5 +-
drivers/scsi/aacraid/Makefile | 2 +
drivers/scsi/aacraid/commctrl.c | 1 +
drivers/scsi/aacraid/commsup.c | 3 +
drivers/scsi/aha152x.c | 4 +-
drivers/scsi/aic7xxx/Makefile | 2 +
drivers/scsi/aic7xxx/aic79xx_osm.h | 2 +
drivers/scsi/aic7xxx/aic7xxx_osm.h | 2 +
drivers/scsi/aic94xx/Makefile | 2 +
drivers/scsi/arcmsr/Makefile | 2 +
drivers/scsi/be2iscsi/Makefile | 2 +
drivers/scsi/be2iscsi/be_main.c | 18 +-
drivers/scsi/bfa/Makefile | 3 +
drivers/scsi/bnx2fc/Makefile | 3 +
drivers/scsi/bnx2fc/bnx2fc.h | 9 +-
drivers/scsi/bnx2fc/bnx2fc_els.c | 27 +-
drivers/scsi/bnx2fc/bnx2fc_hwi.c | 2 +-
drivers/scsi/bnx2fc/bnx2fc_io.c | 15 +-
drivers/scsi/bnx2fc/bnx2fc_tgt.c | 2 +-
drivers/scsi/bnx2i/Makefile | 3 +
drivers/scsi/bnx2i/bnx2i_hwi.c | 45 ++--
drivers/scsi/bnx2i/bnx2i_iscsi.c | 1 +
drivers/scsi/csiostor/Makefile | 2 +
drivers/scsi/csiostor/csio_attr.c | 4 +-
drivers/scsi/csiostor/csio_hw.c | 20 +-
drivers/scsi/csiostor/csio_lnode.c | 3 +
drivers/scsi/csiostor/csio_rnode.c | 9 +-
drivers/scsi/csiostor/csio_scsi.c | 42 +--
drivers/scsi/csiostor/csio_scsi.h | 7 +-
drivers/scsi/cxgbi/Makefile | 3 +
drivers/scsi/cxgbi/libcxgbi.c | 13 +-
drivers/scsi/elx/Makefile | 1 +
drivers/scsi/esas2r/Makefile | 3 +
drivers/scsi/fcoe/Makefile | 3 +
drivers/scsi/fcoe/fcoe_ctlr.c | 50 +++-
drivers/scsi/fnic/Makefile | 3 +
drivers/scsi/fnic/fdls_disc.c | 57 +++-
drivers/scsi/fnic/fip.c | 2 +
drivers/scsi/fnic/fnic_fcs.c | 21 +-
drivers/scsi/fnic/fnic_fdls.h | 7 +-
drivers/scsi/fnic/fnic_scsi.c | 4 +
drivers/scsi/hisi_sas/Makefile | 3 +
drivers/scsi/hpsa.c | 2 +-
drivers/scsi/ibmvscsi/Makefile | 3 +
drivers/scsi/ibmvscsi_tgt/Makefile | 3 +
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 34 ++-
drivers/scsi/ipr.c | 46 ++--
drivers/scsi/ips.c | 1 +
drivers/scsi/isci/Makefile | 3 +
drivers/scsi/libfc/Makefile | 2 +
drivers/scsi/libfc/fc_disc.c | 7 +-
drivers/scsi/libfc/fc_exch.c | 6 +
drivers/scsi/libfc/fc_fcp.c | 17 +-
drivers/scsi/libiscsi.c | 258 +++++++++++--------
drivers/scsi/libiscsi_tcp.c | 17 +-
drivers/scsi/libsas/Makefile | 2 +
drivers/scsi/libsas/sas_ata.c | 2 +-
drivers/scsi/lpfc/lpfc_els.c | 2 +
drivers/scsi/lpfc/lpfc_nportdisc.c | 1 +
drivers/scsi/lpfc/lpfc_scsi.c | 1 +
drivers/scsi/lpfc/lpfc_sli.c | 2 +
drivers/scsi/mpt3sas/Makefile | 3 +
drivers/scsi/mvsas/Makefile | 2 +
drivers/scsi/mvsas/mv_sas.c | 7 +
drivers/scsi/pcmcia/Makefile | 2 +
drivers/scsi/pm8001/Makefile | 1 +
drivers/scsi/pm8001/pm80xx_hwi.c | 2 +
drivers/scsi/qedf/Makefile | 3 +
drivers/scsi/qedi/Makefile | 3 +
drivers/scsi/qedi/qedi_fw.c | 35 +--
drivers/scsi/qla1280.c | 57 ++--
drivers/scsi/qla2xxx/Makefile | 3 +
drivers/scsi/qla2xxx/qla_nx.c | 2 +
drivers/scsi/qla2xxx/qla_target.c | 29 ++-
drivers/scsi/qla2xxx/qla_tmpl.c | 1 +
drivers/scsi/qla4xxx/Makefile | 3 +
drivers/scsi/qla4xxx/ql4_isr.c | 8 +-
drivers/scsi/qla4xxx/ql4_nx.c | 2 +
drivers/scsi/scsi_transport_iscsi.c | 1 +
drivers/scsi/sg.c | 1 +
drivers/scsi/smartpqi/Makefile | 3 +
drivers/scsi/smartpqi/smartpqi_init.c | 67 ++++-
drivers/scsi/snic/Makefile | 3 +
drivers/scsi/st.c | 1 +
drivers/scsi/sym53c8xx_2/Makefile | 2 +
include/linux/pci.h | 5 +-
include/scsi/libiscsi.h | 23 +-
92 files changed, 834 insertions(+), 405 deletions(-)
next reply other threads:[~2026-09-25 18:29 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-25 18:25 Bart Van Assche [this message]
2026-09-25 18:25 ` [PATCH v4 01/54] PCI: Convert to_pci_dev() into an inline function Bart Van Assche
2026-09-25 18:25 ` [PATCH v4 02/54] scsi: sg: Prepare for enabling lock context analysis Bart Van Assche
2026-09-25 18:25 ` [PATCH v4 03/54] scsi: st: " Bart Van Assche
2026-09-25 18:25 ` [PATCH v4 04/54] scsi: BusLogic: Pass the host pointer directly to several functions Bart Van Assche
2026-09-26 20:02 ` Khalid Aziz
2026-09-28 17:41 ` Bart Van Assche
2026-09-28 18:55 ` Khalid Aziz
2026-09-28 19:28 ` Bart Van Assche
2026-09-30 20:13 ` Khalid Aziz
2026-09-30 20:42 ` Bart Van Assche
2026-09-25 18:25 ` [PATCH v4 05/54] scsi: BusLogic: Prepare for enabling lock context analysis Bart Van Assche
2026-09-25 18:25 ` [PATCH v4 06/54] scsi: NCR5380: " Bart Van Assche
2026-09-26 0:42 ` Finn Thain
2026-09-28 17:42 ` Bart Van Assche
2026-09-25 18:25 ` [PATCH v4 07/54] scsi: aacraid: Enable " Bart Van Assche
2026-09-25 18:25 ` [PATCH v4 08/54] scsi: aha152x: Prepare for enabling " Bart Van Assche
2026-09-25 18:25 ` [PATCH v4 09/54] scsi: aic7xxx: Enable " Bart Van Assche
2026-09-25 18:25 ` [PATCH v4 10/54] scsi: aic94xx: " Bart Van Assche
2026-09-25 18:25 ` [PATCH v4 11/54] scsi: arcmsr: " Bart Van Assche
2026-09-25 18:25 ` [PATCH v4 12/54] scsi: libiscsi: Pass the session pointer directly to several functions Bart Van Assche
2026-09-25 18:25 ` [PATCH v4 13/54] scsi: libiscsi: Prepare for enabling lock context analysis Bart Van Assche
2026-09-25 18:25 ` [PATCH v4 14/54] scsi: be2iscsi: Enable " Bart Van Assche
2026-09-25 18:25 ` [PATCH v4 15/54] scsi: cxgbi: " Bart Van Assche
2026-09-25 18:25 ` [PATCH v4 16/54] scsi: bfa: " Bart Van Assche
2026-09-25 18:25 ` [PATCH v4 17/54] scsi: bnx2fc: Pass tgt directly to several functions Bart Van Assche
2026-09-25 18:25 ` [PATCH v4 18/54] scsi: bnx2fc: Enable lock context analysis Bart Van Assche
2026-09-25 18:25 ` [PATCH v4 19/54] scsi: bnx2i: " Bart Van Assche
2026-09-25 18:25 ` [PATCH v4 20/54] scsi: csiostor: Pass the hw pointer directly to several functions Bart Van Assche
2026-09-28 6:27 ` Damien Le Moal
2026-09-25 18:25 ` [PATCH v4 21/54] scsi: csiostor: Enable lock context analysis Bart Van Assche
2026-09-25 18:26 ` [PATCH v4 22/54] scsi: elx: " Bart Van Assche
2026-09-25 18:26 ` [PATCH v4 23/54] scsi: esas2r: " Bart Van Assche
2026-09-25 18:26 ` [PATCH v4 24/54] scsi: fcoe: " Bart Van Assche
2026-09-25 18:26 ` [PATCH v4 25/54] scsi: fnic: Pass pointers directly to several functions Bart Van Assche
2026-09-25 18:26 ` [PATCH v4 26/54] scsi: fnic: Enable lock context analysis Bart Van Assche
2026-09-25 18:26 ` [PATCH v4 27/54] scsi: hisi_sas: " Bart Van Assche
2026-09-25 18:26 ` [PATCH v4 28/54] scsi: hpsa: Prepare for enabling " Bart Van Assche
2026-09-25 18:26 ` [PATCH v4 29/54] scsi: ibmvscsi: Enable " Bart Van Assche
2026-09-25 18:26 ` [PATCH v4 30/54] scsi: ibmvscsi_tgt: " Bart Van Assche
2026-09-25 18:26 ` [PATCH v4 31/54] scsi: ipr: Simplify ipr_eh_abort() Bart Van Assche
2026-09-25 18:26 ` [PATCH v4 32/54] scsi: ipr: Pass the host pointer directly to several functions Bart Van Assche
2026-09-25 18:26 ` [PATCH v4 33/54] scsi: ipr: Prepare for enabling lock context analysis Bart Van Assche
2026-09-25 18:26 ` [PATCH v4 34/54] scsi: ips: " Bart Van Assche
2026-09-25 18:26 ` [PATCH v4 35/54] scsi: isci: Enable " Bart Van Assche
2026-09-25 18:26 ` [PATCH v4 36/54] scsi: libfc: " Bart Van Assche
2026-09-25 18:26 ` [PATCH v4 37/54] scsi: libsas: Prepare for enabling " Bart Van Assche
2026-09-25 18:26 ` [PATCH v4 38/54] scsi: libsas: Enable " Bart Van Assche
2026-09-25 18:26 ` [PATCH v4 39/54] scsi: lpfc: Prepare for enabling " Bart Van Assche
2026-09-25 18:26 ` [PATCH v4 40/54] scsi: mpt3sas: Enable " Bart Van Assche
2026-09-25 18:26 ` [PATCH v4 41/54] scsi: mvsas: " Bart Van Assche
2026-09-25 18:26 ` [PATCH v4 42/54] scsi: pcmcia: " Bart Van Assche
2026-09-25 18:26 ` [PATCH v4 43/54] scsi: pm8001: " Bart Van Assche
2026-09-25 18:26 ` [PATCH v4 44/54] scsi: qedf: " Bart Van Assche
2026-09-25 18:26 ` [PATCH v4 45/54] scsi: qedi: " Bart Van Assche
2026-09-25 18:26 ` [PATCH v4 46/54] scsi: qla1280: Pass the host pointer directly to several functions Bart Van Assche
2026-09-25 18:26 ` [PATCH v4 47/54] scsi: qla1280: Prepare for enabling lock context analysis Bart Van Assche
2026-09-25 18:26 ` [PATCH v4 48/54] scsi: qla2xxx: Enable " Bart Van Assche
2026-09-25 18:26 ` [PATCH v4 49/54] scsi: qla4xxx: " Bart Van Assche
2026-09-25 18:26 ` [PATCH v4 50/54] scsi: iSCSI transport: Prepare for enabling " Bart Van Assche
2026-09-25 18:26 ` [PATCH v4 51/54] scsi: smartpqi: Enable " Bart Van Assche
2026-09-25 18:26 ` [PATCH v4 52/54] scsi: snic: " Bart Van Assche
2026-09-25 18:26 ` [PATCH v4 53/54] scsi: sym53c8xx_2: " Bart Van Assche
2026-09-25 18:26 ` [PATCH v4 54/54] scsi: drivers: " Bart Van Assche
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=cover.1790360262.git.bvanassche@acm.org \
--to=bvanassche@acm.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.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