Skip to content

Enable context analysis in the SCSI core and UFS driver

Bart Van Assche linux-scsi 4 versions – Applied

Status from this message: Applied to 7.3/scsi-staging, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v7 Latest6 patches 8 repliesApplied
  2. v66 patches 1 replySuperseded
  3. v56 patches 9 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v46 patches9 repliesSuperseded

Changes in v7 from the cover letter

- Left out duplicate patch 2/6.

Patches in v7 Applied

#Subject and filesSizeRepliesApplied
1/6ufs: core: Set task state before io_schedule_timeout()drivers/ufs/core/ufshcd.c+1 -00 replies
2/6ufs: core: Enable context analysisdrivers/ufs/core/Makefile drivers/ufs/core/ufs-debugfs.c drivers/ufs/core/ufshcd.c +1 more+24 -20 replies
3/6scsi: core: Pass the SCSI host pointer directly to scanning functionsdrivers/scsi/scsi_scan.c+26 -210 replies
4/6scsi: core: Add lock context annotationsdrivers/scsi/scsi_scan.c+5 -00 replies
5/6scsi: core: Protect host state changes with the host lockdrivers/scsi/hosts.c drivers/scsi/leapraid/leapraid_func.c drivers/scsi/leapraid/leapraid_os.c +7 more+40 -294 replies
6/6scsi: core: Enable context analysisdrivers/scsi/Makefile drivers/scsi/device_handler/Makefile+25 -03 replies

Reviews trailers per patch

All 6 patches have a Reviewed-by or Acked-by.

PatchPeter WangJohn Garry
1/6R-b
2/6R-b
3/6R-b
4/6R-b
5/6R-b
6/6R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v7 thread

Cover letter [PATCH v7 0/6] Enable context analysis in the SCSI core and UFS driver

Hi Martin,

This patch series enables context analysis for the SCSI core and the UFS driver. 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'.

Additionally, a patch is included that suppresses KCSAN complaints about SCSI host state changes.

More information about lock context analysis is available in the cover letter of [PATCH v5 00/36] Compiler-Based Context- and Locking-Analysis
(https://lore.kernel.org/lkml/[email protected]/).

Please consider this patch series for the next merge window.

Thanks,

Bart.

Changes compared to v6:
- Left out duplicate patch 2/6.

Changes compared to v5:
- In patch 5/6, add __must_hold() to both the definition and the declaration of scsi_host_set_state(). Use locking in scsi_get_host_state() instead of READ_ONCE(). Add #include <linux/cleanup.h>. Rename host_state into state.
- In patch 6/6, refer to context analysis instead of compiler warnings.
- Include changes for the leapraid driver.
- Added several Reviewed-by tags.

Changes compared to v4:
- Added Reviewed-by tags to the UFS patches.
- Made the title and the description of patch 3/6 more detailed.

Changes compared to v3:
- Left out all changes except those for the SCSI core and the UFS driver.

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 (6):
ufs: core: Set task state before io_schedule_timeout()
ufs: core: Enable context analysis
scsi: core: Pass the SCSI host pointer directly to scanning functions
scsi: core: Add lock context annotations
scsi: core: Protect host state changes with the host lock
scsi: core: Enable context analysis

 drivers/scsi/Makefile                     | 22 ++++++++++
 drivers/scsi/device_handler/Makefile      |  3 ++
 drivers/scsi/hosts.c                      | 19 +++++----
 drivers/scsi/leapraid/leapraid_func.c     |  2 +-
 drivers/scsi/leapraid/leapraid_os.c       |  2 +-
 drivers/scsi/megaraid/megaraid_sas_base.c |  2 +-
 drivers/scsi/mpi3mr/mpi3mr_os.c           |  2 +-
 drivers/scsi/mpt3sas/mpt3sas_scsih.c      |  2 +-
 drivers/scsi/qla4xxx/ql4_os.c             |  6 +--
 drivers/scsi/scsi_lib.c                   |  3 +-
 drivers/scsi/scsi_scan.c                  | 52 ++++++++++++++---------
 drivers/scsi/scsi_sysfs.c                 |  7 +--
 drivers/ufs/core/Makefile                 |  2 +
 drivers/ufs/core/ufs-debugfs.c            |  8 +++-
 drivers/ufs/core/ufshcd.c                 | 15 +++++++
 drivers/ufs/host/Makefile                 |  2 +
 include/scsi/scsi_host.h                  | 24 ++++++++---
 17 files changed, 121 insertions(+), 52 deletions(-)