1. 11 Jul, 2024 1 commit
  2. 05 Jul, 2024 22 commits
  3. 27 Jun, 2024 9 commits
  4. 26 Jun, 2024 1 commit
  5. 14 Jun, 2024 3 commits
  6. 13 Jun, 2024 1 commit
  7. 12 Jun, 2024 3 commits
    • Damien Le Moal's avatar
      scsi: mpi3mr: Fix ATA NCQ priority support · 90e6f089
      Damien Le Moal authored
      The function mpi3mr_qcmd() of the mpi3mr driver is able to indicate to
      the HBA if a read or write command directed at an ATA device should be
      translated to an NCQ read/write command with the high prioiryt bit set
      when the request uses the RT priority class and the user has enabled NCQ
      priority through sysfs.
      
      However, unlike the mpt3sas driver, the mpi3mr driver does not define
      the sas_ncq_prio_supported and sas_ncq_prio_enable sysfs attributes, so
      the ncq_prio_enable field of struct mpi3mr_sdev_priv_data is never
      actually set and NCQ Priority cannot ever be used.
      
      Fix this by defining these missing atributes to allow a user to check if
      an ATA device supports NCQ priority and to enable/disable the use of NCQ
      priority. To do this, lift the function scsih_ncq_prio_supp() out of the
      mpt3sas driver and make it the generic SCSI SAS transport function
      sas_ata_ncq_prio_supported(). Nothing in that function is hardware
      specific, so this function can be used in both the mpt3sas driver and
      the mpi3mr driver.
      Reported-by: default avatarScott McCoy <scott.mccoy@wdc.com>
      Fixes: 023ab2a9 ("scsi: mpi3mr: Add support for queue command processing")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
      Link: https://lore.kernel.org/r/20240611083435.92961-1-dlemoal@kernel.orgReviewed-by: default avatarNiklas Cassel <cassel@kernel.org>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      90e6f089
    • Jeff Johnson's avatar
      scsi: Add missing MODULE_DESCRIPTION() macros · 95f8bf93
      Jeff Johnson authored
      On x86, make allmodconfig && make W=1 C=1 reports:
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/scsi/scsi_common.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/scsi/advansys.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/scsi/BusLogic.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/scsi/aha1740.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/scsi/isci/isci.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/scsi/elx/efct.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/scsi/atp870u.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/scsi/ppa.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/scsi/imm.o
      
      Add all missing invocations of the MODULE_DESCRIPTION() macro.
      
      This updates all files which have a MODULE_LICENSE() but which do not have
      a MODULE_DESCRIPTION(), even ones which did not produce the x86
      allmodconfig warnings.
      Acked-by: default avatarFinn Thain <fthain@linux-m68k.org>
      Signed-off-by: default avatarJeff Johnson <quic_jjohnson@quicinc.com>
      Link: https://lore.kernel.org/r/20240610-md-drivers-scsi-v3-1-055da78d66b2@quicinc.comSigned-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      95f8bf93
    • Ziqi Chen's avatar
      scsi: ufs: core: Quiesce request queues before checking pending cmds · 77691af4
      Ziqi Chen authored
      In ufshcd_clock_scaling_prepare(), after SCSI layer is blocked,
      ufshcd_pending_cmds() is called to check whether there are pending
      transactions or not. And only if there are no pending transactions can we
      proceed to kickstart the clock scaling sequence.
      
      ufshcd_pending_cmds() traverses over all SCSI devices and calls
      sbitmap_weight() on their budget_map. sbitmap_weight() can be broken down
      to three steps:
      
       1. Calculate the nr outstanding bits set in the 'word' bitmap.
      
       2. Calculate the nr outstanding bits set in the 'cleared' bitmap.
      
       3. Subtract the result from step 1 by the result from step 2.
      
      This can lead to a race condition as outlined below:
      
      Assume there is one pending transaction in the request queue of one SCSI
      device, say sda, and the budget token of this request is 0, the 'word' is
      0x1 and the 'cleared' is 0x0.
      
       1. When step 1 executes, it gets the result as 1.
      
       2. Before step 2 executes, block layer tries to dispatch a new request to
          sda. Since the SCSI layer is blocked, the request cannot pass through
          SCSI but the block layer would do budget_get() and budget_put() to
          sda's budget map regardless, so the 'word' has become 0x3 and 'cleared'
          has become 0x2 (assume the new request got budget token 1).
      
       3. When step 2 executes, it gets the result as 1.
      
       4. When step 3 executes, it gets the result as 0, meaning there is no
          pending transactions, which is wrong.
      
          Thread A                        Thread B
          ufshcd_pending_cmds()           __blk_mq_sched_dispatch_requests()
          |                               |
          sbitmap_weight(word)            |
          |                               scsi_mq_get_budget()
          |                               |
          |                               scsi_mq_put_budget()
          |                               |
          sbitmap_weight(cleared)
          ...
      
      When this race condition happens, the clock scaling sequence is started
      with transactions still in flight, leading to subsequent hibernate enter
      failure, broken link, task abort and back to back error recovery.
      
      Fix this race condition by quiescing the request queues before calling
      ufshcd_pending_cmds() so that block layer won't touch the budget map when
      ufshcd_pending_cmds() is working on it. In addition, remove the SCSI layer
      blocking/unblocking to reduce redundancies and latencies.
      
      Fixes: 8d077ede ("scsi: ufs: Optimize the command queueing code")
      Co-developed-by: default avatarCan Guo <quic_cang@quicinc.com>
      Signed-off-by: default avatarCan Guo <quic_cang@quicinc.com>
      Signed-off-by: default avatarZiqi Chen <quic_ziqichen@quicinc.com>
      Link: https://lore.kernel.org/r/1717754818-39863-1-git-send-email-quic_ziqichen@quicinc.comReviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      77691af4