Skip to content
  1. Jun 08, 2021
  2. Jun 02, 2021
  3. Jun 01, 2021
  4. May 22, 2021
    • Dmitry Bogdanov's avatar
      scsi: target: qla2xxx: Wait for stop_phase1 at WWN removal · 2ef7665d
      Dmitry Bogdanov authored
      
      
      Target de-configuration panics at high CPU load because TPGT and WWPN can
      be removed on separate threads.
      
      TPGT removal requests a reset HBA on a separate thread and waits for reset
      complete (phase1). Due to high CPU load that HBA reset can be delayed for
      some time.
      
      WWPN removal does qlt_stop_phase2(). There it is believed that phase1 has
      already completed and thus tgt.tgt_ops is subsequently cleared. However,
      tgt.tgt_ops is needed to process incoming traffic and therefore this will
      cause one of the following panics:
      
      NIP qlt_reset+0x7c/0x220 [qla2xxx]
      LR  qlt_reset+0x68/0x220 [qla2xxx]
      Call Trace:
      0xc000003ffff63a78 (unreliable)
      qlt_handle_imm_notify+0x800/0x10c0 [qla2xxx]
      qlt_24xx_atio_pkt+0x208/0x590 [qla2xxx]
      qlt_24xx_process_atio_queue+0x33c/0x7a0 [qla2xxx]
      qla83xx_msix_atio_q+0x54/0x90 [qla2xxx]
      
      or
      
      NIP qlt_24xx_handle_abts+0xd0/0x2a0 [qla2xxx]
      LR  qlt_24xx_handle_abts+0xb4/0x2a0 [qla2xxx]
      Call Trace:
      qlt_24xx_handle_abts+0x90/0x2a0 [qla2xxx] (unreliable)
      qlt_24xx_process_atio_queue+0x500/0x7a0 [qla2xxx]
      qla83xx_msix_atio_q+0x54/0x90 [qla2xxx]
      
      or
      
      NIP qlt_create_sess+0x90/0x4e0 [qla2xxx]
      LR  qla24xx_do_nack_work+0xa8/0x180 [qla2xxx]
      Call Trace:
      0xc0000000348fba30 (unreliable)
      qla24xx_do_nack_work+0xa8/0x180 [qla2xxx]
      qla2x00_do_work+0x674/0xbf0 [qla2xxx]
      qla2x00_iocb_work_fn
      
      The patch fixes the issue by serializing qlt_stop_phase1() and
      qlt_stop_phase2() functions to make WWPN removal wait for phase1
      completion.
      
      Link: https://lore.kernel.org/r/20210415203554.27890-1-d.bogdanov@yadro.com
      Reviewed-by: default avatarRoman Bolshakov <r.bolshakov@yadro.com>
      Signed-off-by: default avatarDmitry Bogdanov <d.bogdanov@yadro.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      2ef7665d
    • Yang Yingliang's avatar
      scsi: hisi_sas: Drop free_irq() of devm_request_irq() allocated irq · 7907a021
      Yang Yingliang authored
      
      
      irqs allocated with devm_request_irq() should not be freed using
      free_irq(). Doing so causes a dangling pointer and a subsequent double
      free.
      
      Link: https://lore.kernel.org/r/20210519130519.2661938-1-yangyingliang@huawei.com
      Reported-by: default avatarHulk Robot <hulkci@huawei.com>
      Acked-by: default avatarJohn Garry <john.garry@huawei.com>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      7907a021
    • Matt Wang's avatar
      scsi: vmw_pvscsi: Set correct residual data length · e662502b
      Matt Wang authored
      
      
      Some commands (such as INQUIRY) may return less data than the initiator
      requested. To avoid conducting useless information, set the right residual
      count to make upper layer aware of this.
      
      Before (INQUIRY PAGE 0xB0 with 128B buffer):
      
      $ sg_raw -r 128 /dev/sda 12 01 B0 00 80 00
      SCSI Status: Good
      
      Received 128 bytes of data:
       00 00 b0 00 3c 01 00 00 00 00 00 00 00 00 00 00 00 ...<............
       10 00 00 00 00 00 01 00 00 00 00 00 40 00 00 08 00 ...........@....
       20 80 00 00 00 00 00 00 00 00 00 20 00 00 00 00 00 .......... .....
       30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
       40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
       50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
       60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
       70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
      
      After:
      
      $ sg_raw -r 128 /dev/sda 12 01 B0 00 80 00
      SCSI Status: Good
      
      Received 64 bytes of data:
      00 00 b0 00 3c 01 00 00 00 00 00 00 00 00 00 00 00 ...<............
      10 00 00 00 00 00 01 00 00 00 00 00 40 00 00 08 00 ...........@....
      20 80 00 00 00 00 00 00 00 00 00 20 00 00 00 00 00 .......... .....
      30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
      
      [mkp: clarified description]
      
      Link: https://lore.kernel.org/r/03C41093-B62E-43A2-913E-CFC92F1C70C3@vmware.com
      Signed-off-by: default avatarMatt Wang <wwentao@vmware.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      e662502b
    • Javed Hasan's avatar
      scsi: bnx2fc: Return failure if io_req is already in ABTS processing · 122c81c5
      Javed Hasan authored
      
      
      Return failure from bnx2fc_eh_abort() if io_req is already in ABTS
      processing.
      
      Link: https://lore.kernel.org/r/20210519061416.19321-1-jhasan@marvell.com
      Reviewed-by: default avatarHimanshu Madhani <himanshu.madhani@oracle.com>
      Signed-off-by: default avatarJaved Hasan <jhasan@marvell.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      122c81c5
    • Tom Rix's avatar
      scsi: aic7xxx: Remove multiple definition of globals · b4de11df
      Tom Rix authored
      
      
      Building aicasm with gcc 10.2 + gas 26.1 causes these errors:
      
        multiple definition of `args';
        multiple definition of `yylineno';
      
      args came from the expansion of:
      
        STAILQ_HEAD(macro_arg_list, macro_arg) args;
      
      The definition of the macro_arg_list structure is needed, the global
      variable 'args' is not, so delete it.
      
      yylineno is defined by flex, so defining it in bison/*.y file is not
      needed. Also delete this.
      
      Link: https://lore.kernel.org/r/20210517205057.1850010-1-trix@redhat.com
      Signed-off-by: default avatarTom Rix <trix@redhat.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      b4de11df
    • Tom Rix's avatar
      scsi: aic7xxx: Restore several defines for aic7xxx firmware build · 7e760633
      Tom Rix authored
      With CONFIG_AIC7XXX_BUILD_FIRMWARE, there is this representative error:
      
        aicasm: Stopped at file ./drivers/scsi/aic7xxx/aic7xxx.seq,
          line 271 - Undefined symbol MSG_SIMPLE_Q_TAG referenced
      
      MSG_SIMPLE_Q_TAG used to be defined in drivers/scsi/aic7xxx/scsi_message.h
      as:
      
        #define MSG_SIMPLE_Q_TAG	0x20 /* O/O */
      
      The new definition in include/scsi/scsi.h is:
      
        #define SIMPLE_QUEUE_TAG    0x20
      
      But aicasm can not handle the all the preprocessor directives in scsi.h, so
      add MSG_SIMPLE_Q_TAB and other required defines back to scsi_message.h.
      
      Link: https://lore.kernel.org/r/20210517132451.1832233-1-trix@redhat.com
      Fixes: d8cd784f
      
       ("scsi: aic7xxx: aic79xx: Drop internal SCSI message definition"
      Signed-off-by: default avatarTom Rix <trix@redhat.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      7e760633
    • Mike Christie's avatar
      scsi: target: iblock: Fix smp_processor_id() BUG messages · 5aaeca25
      Mike Christie authored
      This has us use raw_smp_processor_id() in iblock's plug_device callout.
      smp_processor_id() is not needed here, because we are running from a per
      CPU work item that is also queued to run on a worker thread that is
      normally bound to a specific CPU. If the worker thread did end up switching
      CPUs then it's handled the same way we handle when the work got moved to a
      different CPU's worker thread, where we will just end up sending I/O from
      the new CPU.
      
      Link: https://lore.kernel.org/r/20210519222640.5153-1-michael.christie@oracle.com
      Fixes: 415ccd98
      
       ("scsi: target: iblock: Add backend plug/unplug callouts")
      Signed-off-by: default avatarMike Christie <michael.christie@oracle.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      5aaeca25
    • Dan Carpenter's avatar
      scsi: libsas: Use _safe() loop in sas_resume_port() · 8c7e7b84
      Dan Carpenter authored
      If sas_notify_lldd_dev_found() fails then this code calls:
      
      	sas_unregister_dev(port, dev);
      
      which removes "dev", our list iterator, from the list.  This could lead to
      an endless loop.  We need to use list_for_each_entry_safe().
      
      Link: https://lore.kernel.org/r/YKUeq6gwfGcvvhty@mwanda
      Fixes: 303694ee
      
       ("[SCSI] libsas: suspend / resume support")
      Reviewed-by: default avatarJohn Garry <john.garry@huawei.com>
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      8c7e7b84
    • Bodo Stroesser's avatar
      scsi: target: tcmu: Fix xarray RCU warning · b4150b68
      Bodo Stroesser authored
      Commit f5ce815f ("scsi: target: tcmu: Support DATA_BLOCK_SIZE = N *
      PAGE_SIZE") introduced xas_next() calls to iterate xarray elements.  These
      calls triggered the WARNING "suspicious RCU usage" at tcmu device set up
      [1]. In the call stack of xas_next(), xas_load() was called.  According to
      its comment, this function requires "the xa_lock or the RCU lock".
      
      To avoid the warning:
      
       - Guard the small loop calling xas_next() in tcmu_get_empty_block with RCU
         lock.
      
       - In the large loop in tcmu_copy_data using RCU lock would possibly
         disable preemtion for a long time (copy multi MBs). Therefore replace
         XA_STATE, xas_set and xas_next with a single xa_load.
      
      [1]
      
      [ 1899.867091] =============================
      [ 1899.871199] WARNING: suspicious RCU usage
      [ 1899.875310] 5.13.0-rc1+ #41 Not tainted
      [ 1899.879222] -----------------------------
      [ 1899.883299] include/linux/xarray.h:1182 suspicious rcu_dereference_check() usage!
      [ 1899.890940] other info that might help us debug this:
      [ 1899.899082] rcu_scheduler_active = 2, debug_locks = 1
      [ 1899.905719] 3 locks held by kworker/0:1/1368:
      [ 1899.910161]  #0: ffffa1f8c8b98738 ((wq_completion)target_submission){+.+.}-{0:0}, at: process_one_work+0x1ee/0x580
      [ 1899.920732]  #1: ffffbd7040cd7e78 ((work_completion)(&q->sq.work)){+.+.}-{0:0}, at: process_one_work+0x1ee/0x580
      [ 1899.931146]  #2: ffffa1f8d1c99768 (&udev->cmdr_lock){+.+.}-{3:3}, at: tcmu_queue_cmd+0xea/0x160 [target_core_user]
      [ 1899.941678] stack backtrace:
      [ 1899.946093] CPU: 0 PID: 1368 Comm: kworker/0:1 Not tainted 5.13.0-rc1+ #41
      [ 1899.953070] Hardware name: System manufacturer System Product Name/PRIME Z270-A, BIOS 1302 03/15/2018
      [ 1899.962459] Workqueue: target_submission target_queued_submit_work [target_core_mod]
      [ 1899.970337] Call Trace:
      [ 1899.972839]  dump_stack+0x6d/0x89
      [ 1899.976222]  xas_descend+0x10e/0x120
      [ 1899.979875]  xas_load+0x39/0x50
      [ 1899.983077]  tcmu_get_empty_blocks+0x115/0x1c0 [target_core_user]
      [ 1899.989318]  queue_cmd_ring+0x1da/0x630 [target_core_user]
      [ 1899.994897]  ? rcu_read_lock_sched_held+0x3f/0x70
      [ 1899.999695]  ? trace_kmalloc+0xa6/0xd0
      [ 1900.003501]  ? __kmalloc+0x205/0x380
      [ 1900.007167]  tcmu_queue_cmd+0x12f/0x160 [target_core_user]
      [ 1900.012746]  __target_execute_cmd+0x23/0xa0 [target_core_mod]
      [ 1900.018589]  transport_generic_new_cmd+0x1f3/0x370 [target_core_mod]
      [ 1900.025046]  transport_handle_cdb_direct+0x34/0x50 [target_core_mod]
      [ 1900.031517]  target_queued_submit_work+0x43/0xe0 [target_core_mod]
      [ 1900.037837]  process_one_work+0x268/0x580
      [ 1900.041952]  ? process_one_work+0x580/0x580
      [ 1900.046195]  worker_thread+0x55/0x3b0
      [ 1900.049921]  ? process_one_work+0x580/0x580
      [ 1900.054192]  kthread+0x143/0x160
      [ 1900.057499]  ? kthread_create_worker_on_cpu+0x40/0x40
      [ 1900.062661]  ret_from_fork+0x1f/0x30
      
      Link: https://lore.kernel.org/r/20210519135440.26773-1-bostroesser@gmail.com
      Fixes: f5ce815f
      
       ("scsi: target: tcmu: Support DATA_BLOCK_SIZE = N * PAGE_SIZE")
      Reported-by: default avatarShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
      Tested-by: default avatarShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
      Signed-off-by: default avatarBodo Stroesser <bostroesser@gmail.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      b4150b68
    • Shin'ichiro Kawasaki's avatar
      scsi: target: core: Avoid smp_processor_id() in preemptible code · 70ca3c57
      Shin'ichiro Kawasaki authored
      The BUG message "BUG: using smp_processor_id() in preemptible [00000000]
      code" was observed for TCMU devices with kernel config DEBUG_PREEMPT.
      
      The message was observed when blktests block/005 was run on TCMU devices
      with fileio backend or user:zbc backend [1]. The commit 1130b499
      ("scsi: target: tcm_loop: Use LIO wq cmd submission helper") triggered the
      symptom. The commit modified work queue to handle commands and changed
      'current->nr_cpu_allowed' at smp_processor_id() call.
      
      The message was also observed at system shutdown when TCMU devices were not
      cleaned up [2]. The function smp_processor_id() was called in SCSI host
      work queue for abort handling, and triggered the BUG message. This symptom
      was observed regardless of the commit 1130b499 ("scsi: target:
      tcm_loop: Use LIO wq cmd submission helper").
      
      To avoid the preemptible code check at smp_processor_id(), get CPU ID with
      raw_smp_processor_id() instead. The CPU ID is used for performance
      improvement then thread move to other CPU will not affect the code.
      
      [1]
      
      [   56.468103] run blktests block/005 at 2021-05-12 14:16:38
      [   57.369473] check_preemption_disabled: 85 callbacks suppressed
      [   57.369480] BUG: using smp_processor_id() in preemptible [00000000] code: fio/1511
      [   57.369506] BUG: using smp_processor_id() in preemptible [00000000] code: fio/1510
      [   57.369512] BUG: using smp_processor_id() in preemptible [00000000] code: fio/1506
      [   57.369552] caller is __target_init_cmd+0x157/0x170 [target_core_mod]
      [   57.369606] CPU: 4 PID: 1506 Comm: fio Not tainted 5.13.0-rc1+ #34
      [   57.369613] Hardware name: System manufacturer System Product Name/PRIME Z270-A, BIOS 1302 03/15/2018
      [   57.369617] Call Trace:
      [   57.369621] BUG: using smp_processor_id() in preemptible [00000000] code: fio/1507
      [   57.369628]  dump_stack+0x6d/0x89
      [   57.369642]  check_preemption_disabled+0xc8/0xd0
      [   57.369628] caller is __target_init_cmd+0x157/0x170 [target_core_mod]
      [   57.369655]  __target_init_cmd+0x157/0x170 [target_core_mod]
      [   57.369695]  target_init_cmd+0x76/0x90 [target_core_mod]
      [   57.369732]  tcm_loop_queuecommand+0x109/0x210 [tcm_loop]
      [   57.369744]  scsi_queue_rq+0x38e/0xc40
      [   57.369761]  __blk_mq_try_issue_directly+0x109/0x1c0
      [   57.369779]  blk_mq_try_issue_directly+0x43/0x90
      [   57.369790]  blk_mq_submit_bio+0x4e5/0x5d0
      [   57.369812]  submit_bio_noacct+0x46e/0x4e0
      [   57.369830]  __blkdev_direct_IO_simple+0x1a3/0x2d0
      [   57.369859]  ? set_init_blocksize.isra.0+0x60/0x60
      [   57.369880]  generic_file_read_iter+0x89/0x160
      [   57.369898]  blkdev_read_iter+0x44/0x60
      [   57.369906]  new_sync_read+0x102/0x170
      [   57.369929]  vfs_read+0xd4/0x160
      [   57.369941]  __x64_sys_pread64+0x6e/0xa0
      [   57.369946]  ? lockdep_hardirqs_on+0x79/0x100
      [   57.369958]  do_syscall_64+0x3a/0x70
      [   57.369965]  entry_SYSCALL_64_after_hwframe+0x44/0xae
      [   57.369973] RIP: 0033:0x7f7ed4c1399f
      [   57.369979] Code: 08 89 3c 24 48 89 4c 24 18 e8 7d f3 ff ff 4c 8b 54 24 18 48 8b 54 24 10 41 89 c0 48 8b 74 24 08 8b 3c 24 b8 11 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 31 44 89 c7 48 89 04 24 e8 cd f3 ff ff 48 8b
      [   57.369983] RSP: 002b:00007ffd7918c580 EFLAGS: 00000293 ORIG_RAX: 0000000000000011
      [   57.369990] RAX: ffffffffffffffda RBX: 00000000015b4540 RCX: 00007f7ed4c1399f
      [   57.369993] RDX: 0000000000001000 RSI: 00000000015de000 RDI: 0000000000000009
      [   57.369996] RBP: 00000000015b4540 R08: 0000000000000000 R09: 0000000000000001
      [   57.369999] R10: 0000000000e5c000 R11: 0000000000000293 R12: 00007f7eb5269a70
      [   57.370002] R13: 0000000000000000 R14: 0000000000001000 R15: 00000000015b4568
      [   57.370031] CPU: 7 PID: 1507 Comm: fio Not tainted 5.13.0-rc1+ #34
      [   57.370036] Hardware name: System manufacturer System Product Name/PRIME Z270-A, BIOS 1302 03/15/2018
      [   57.370039] Call Trace:
      [   57.370045]  dump_stack+0x6d/0x89
      [   57.370056]  check_preemption_disabled+0xc8/0xd0
      [   57.370068]  __target_init_cmd+0x157/0x170 [target_core_mod]
      [   57.370121]  target_init_cmd+0x76/0x90 [target_core_mod]
      [   57.370178]  tcm_loop_queuecommand+0x109/0x210 [tcm_loop]
      [   57.370197]  scsi_queue_rq+0x38e/0xc40
      [   57.370224]  __blk_mq_try_issue_directly+0x109/0x1c0
      ...
      
      [2]
      
      [  117.458597] BUG: using smp_processor_id() in preemptible [00000000] code: kworker/u16:8
      [  117.467279] caller is __target_init_cmd+0x157/0x170 [target_core_mod]
      [  117.473893] CPU: 1 PID: 418 Comm: kworker/u16:6 Not tainted 5.13.0-rc1+ #34
      [  117.481150] Hardware name: System manufacturer System Product Name/PRIME Z270-A, BIOS 8
      [  117.481153] Workqueue: scsi_tmf_7 scmd_eh_abort_handler
      [  117.481156] Call Trace:
      [  117.481158]  dump_stack+0x6d/0x89
      [  117.481162]  check_preemption_disabled+0xc8/0xd0
      [  117.512575]  target_submit_tmr+0x41/0x150 [target_core_mod]
      [  117.519705]  tcm_loop_issue_tmr+0xa7/0x100 [tcm_loop]
      [  117.524913]  tcm_loop_abort_task+0x43/0x60 [tcm_loop]
      [  117.530137]  scmd_eh_abort_handler+0x7b/0x230
      [  117.534681]  process_one_work+0x268/0x580
      [  117.538862]  worker_thread+0x55/0x3b0
      [  117.542652]  ? process_one_work+0x580/0x580
      [  117.548351]  kthread+0x143/0x160
      [  117.551675]  ? kthread_create_worker_on_cpu+0x40/0x40
      [  117.556873]  ret_from_fork+0x1f/0x30
      
      Link: https://lore.kernel.org/r/20210515070315.215801-1-shinichiro.kawasaki@wdc.com
      Fixes: 1526d9f1
      
       ("scsi: target: Make state_list per CPU")
      Cc: stable@vger.kernel.org # v5.11+
      Reviewed-by: default avatarMike Christie <michael.christie@oracle.com>
      Signed-off-by: default avatarShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      70ca3c57
  5. May 16, 2021
  6. May 15, 2021
    • Javed Hasan's avatar
      scsi: qedf: Add pointer checks in qedf_update_link_speed() · 73578af9
      Javed Hasan authored
      The following trace was observed:
      
       [   14.042059] Call Trace:
       [   14.042061]  <IRQ>
       [   14.042068]  qedf_link_update+0x144/0x1f0 [qedf]
       [   14.042117]  qed_link_update+0x5c/0x80 [qed]
       [   14.042135]  qed_mcp_handle_link_change+0x2d2/0x410 [qed]
       [   14.042155]  ? qed_set_ptt+0x70/0x80 [qed]
       [   14.042170]  ? qed_set_ptt+0x70/0x80 [qed]
       [   14.042186]  ? qed_rd+0x13/0x40 [qed]
       [   14.042205]  qed_mcp_handle_events+0x437/0x690 [qed]
       [   14.042221]  ? qed_set_ptt+0x70/0x80 [qed]
       [   14.042239]  qed_int_sp_dpc+0x3a6/0x3e0 [qed]
       [   14.042245]  tasklet_action_common.isra.14+0x5a/0x100
       [   14.042250]  __do_softirq+0xe4/0x2f8
       [   14.042253]  irq_exit+0xf7/0x100
       [   14.042255]  do_IRQ+0x7f/0xd0
       [   14.042257]  common_interrupt+0xf/0xf
       [   14.042259]  </IRQ>
      
      API qedf_link_update() is getting called from QED but by that time
      shost_data is not initialised. This results in a NULL pointer dereference
      when we try to dereference shost_data while updating supported_speeds.
      
      Add a NULL pointer check before dereferencing shost_data.
      
      Link: https://lore.kernel.org/r/20210512072533.23618-1-jhasan@marvell.com
      Fixes: 61d8658b
      
       ("scsi: qedf: Add QLogic FastLinQ offload FCoE driver framework.")
      Reviewed-by: default avatarHimanshu Madhani <himanshu.madhani@oracle.com>
      Signed-off-by: default avatarJaved Hasan <jhasan@marvell.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      73578af9
    • Bart Van Assche's avatar
      scsi: ufs: core: Increase the usable queue depth · d0b2b70e
      Bart Van Assche authored
      With the current implementation of the UFS driver active_queues is 1
      instead of 0 if all UFS request queues are idle. That causes
      hctx_may_queue() to divide the queue depth by 2 when queueing a request and
      hence reduces the usable queue depth.
      
      The shared tag set code in the block layer keeps track of the number of
      active request queues. blk_mq_tag_busy() is called before a request is
      queued onto a hwq and blk_mq_tag_idle() is called some time after the hwq
      became idle. blk_mq_tag_idle() is called from inside blk_mq_timeout_work().
      Hence, blk_mq_tag_idle() is only called if a timer is associated with each
      request that is submitted to a request queue that shares a tag set with
      another request queue.
      
      Adds a blk_mq_start_request() call in ufshcd_exec_dev_cmd(). This doubles
      the queue depth on my test setup from 16 to 32.
      
      In addition to increasing the usable queue depth, also fix the
      documentation of the 'timeout' parameter in the header above
      ufshcd_exec_dev_cmd().
      
      Link: https://lore.kernel.org/r/20210513164912.5683-1-bvanassche@acm.org
      Fixes: 7252a360
      
       ("scsi: ufs: Avoid busy-waiting by eliminating tag conflicts")
      Cc: Can Guo <cang@codeaurora.org>
      Cc: Alim Akhtar <alim.akhtar@samsung.com>
      Cc: Avri Altman <avri.altman@wdc.com>
      Cc: Stanley Chu <stanley.chu@mediatek.com>
      Cc: Bean Huo <beanhuo@micron.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Reviewed-by: default avatarCan Guo <cang@codeaurora.org>
      Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      d0b2b70e
    • Matt Wang's avatar
      scsi: BusLogic: Fix 64-bit system enumeration error for Buslogic · 56f39614
      Matt Wang authored
      Commit 391e2f25
      
       ("[SCSI] BusLogic: Port driver to 64-bit")
      introduced a serious issue for 64-bit systems.  With this commit,
      64-bit kernel will enumerate 8*15 non-existing disks.  This is caused
      by the broken CCB structure.  The change from u32 data to void *data
      increased CCB length on 64-bit system, which introduced an extra 4
      byte offset of the CDB.  This leads to incorrect response to INQUIRY
      commands during enumeration.
      
      Fix disk enumeration failure by reverting the portion of the commit
      above which switched the data pointer from u32 to void.
      
      Link: https://lore.kernel.org/r/C325637F-1166-4340-8F0F-3BCCD59D4D54@vmware.com
      Acked-by: default avatarKhalid Aziz <khalid@gonehiking.org>
      Signed-off-by: default avatarMatt Wang <wwentao@vmware.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      56f39614
    • Peter Wang's avatar
      scsi: ufs: ufs-mediatek: Fix power down spec violation · c625b80b
      Peter Wang authored
      
      
      As per spec, e.g. JESD220E chapter 7.2, while powering off the UFS device,
      RST_N signal should be between VSS(Ground) and VCCQ/VCCQ2. The power down
      sequence after fixing:
      
      Power down:
      
       1. Assert RST_N low
      
       2. Turn-off VCC
      
       3. Turn-off VCCQ/VCCQ2
      
      Link: https://lore.kernel.org/r/1620813706-25331-1-git-send-email-peter.wang@mediatek.com
      Reviewed-by: default avatarStanley Chu <stanley.chu@mediatek.com>
      Signed-off-by: default avatarPeter Wang <peter.wang@mediatek.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      c625b80b
  7. May 10, 2021
    • Linus Torvalds's avatar
      Linux 5.13-rc1 · 6efb943b
      Linus Torvalds authored
      v5.13-rc1
      6efb943b
    • Linus Torvalds's avatar
      fbmem: fix horribly incorrect placement of __maybe_unused · 6dae40ae
      Linus Torvalds authored
      Commit b9d79e4c
      
       ("fbmem: Mark proc_fb_seq_ops as __maybe_unused")
      places the '__maybe_unused' in an entirely incorrect location between
      the "struct" keyword and the structure name.
      
      It's a wonder that gcc accepts that silently, but clang quite reasonably
      warns about it:
      
          drivers/video/fbdev/core/fbmem.c:736:21: warning: attribute declaration must precede definition [-Wignored-attributes]
          static const struct __maybe_unused seq_operations proc_fb_seq_ops = {
                              ^
      
      Fix it.
      
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      6dae40ae
    • Linus Torvalds's avatar
      Merge tag 'drm-next-2021-05-10' of git://anongit.freedesktop.org/drm/drm · efc58a96
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "Bit later than usual, I queued them all up on Friday then promptly
        forgot to write the pull request email. This is mainly amdgpu fixes,
        with some radeon/msm/fbdev and one i915 gvt fix thrown in.
      
        amdgpu:
         - MPO hang workaround
         - Fix for concurrent VM flushes on vega/navi
         - dcefclk is not adjustable on navi1x and newer
         - MST HPD debugfs fix
         - Suspend/resumes fixes
         - Register VGA clients late in case driver fails to load
         - Fix GEM leak in user framebuffer create
         - Add support for polaris12 with 32 bit memory interface
         - Fix duplicate cursor issue when using overlay
         - Fix corruption with tiled surfaces on VCN3
         - Add BO size and stride check to fix BO size verification
      
        radeon:
         - Fix off-by-one in power state parsing
         - Fix possible memory leak in power state parsing
      
        msm:
         - NULL ptr dereference fix
      
        fbdev:
         - procfs disabled warning fix
      
        i915:
         - gvt: Fix a possible division by zero in vgpu display rate
           calculation"
      
      * tag 'drm-next-2021-05-10' of git://anongit.freedesktop.org/drm/drm:
        drm/amdgpu: Use device specific BO size & stride check.
        drm/amdgpu: Init GFX10_ADDR_CONFIG for VCN v3 in DPG mode.
        drm/amd/pm: initialize variable
        drm/radeon: Avoid power table parsing memory leaks
        drm/radeon: Fix off-by-one power_state index heap overwrite
        drm/amd/display: Fix two cursor duplication when using overlay
        drm/amdgpu: add new MC firmware for Polaris12 32bit ASIC
        fbmem: Mark proc_fb_seq_ops as __maybe_unused
        drm/msm/dpu: Delete bonkers code
        drm/i915/gvt: Prevent divided by zero when calculating refresh rate
        amdgpu: fix GEM obj leak in amdgpu_display_user_framebuffer_create
        drm/amdgpu: Register VGA clients after init can no longer fail
        drm/amdgpu: Handling of amdgpu_device_resume return value for graceful teardown
        drm/amdgpu: fix r initial values
        drm/amd/display: fix wrong statement in mst hpd debugfs
        amdgpu/pm: set pp_dpm_dcefclk to readonly on NAVI10 and newer gpus
        amdgpu/pm: Prevent force of DCEFCLK on NAVI10 and SIENNA_CICHLID
        drm/amdgpu: fix concurrent VM flushes on Vega/Navi v2
        drm/amd/display: Reject non-zero src_y and src_x for video planes
      efc58a96
    • Linus Torvalds's avatar
      Merge tag 'block-5.13-2021-05-09' of git://git.kernel.dk/linux-block · 506c3079
      Linus Torvalds authored
      Pull block fix from Jens Axboe:
       "Turns out the bio max size change still has issues, so let's get it
        reverted for 5.13-rc1. We'll shake out the issues there and defer it
        to 5.14 instead"
      
      * tag 'block-5.13-2021-05-09' of git://git.kernel.dk/linux-block:
        Revert "bio: limit bio max size"
      506c3079
    • Linus Torvalds's avatar
      Merge tag '5.13-rc-smb3-part3' of git://git.samba.org/sfrench/cifs-2.6 · 0a55a1fb
      Linus Torvalds authored
      Pull cifs fixes from Steve French:
       "Three small SMB3 chmultichannel related changesets (also for stable)
        from the SMB3 test event this week.
      
        The other fixes are still in review/testing"
      
      * tag '5.13-rc-smb3-part3' of git://git.samba.org/sfrench/cifs-2.6:
        smb3: if max_channels set to more than one channel request multichannel
        smb3: do not attempt multichannel to server which does not support it
        smb3: when mounting with multichannel include it in requested capabilities
      0a55a1fb
    • Linus Torvalds's avatar
      Merge tag 'sched-urgent-2021-05-09' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 9819f682
      Linus Torvalds authored
      Pull scheduler fixes from Thomas Gleixner:
       "A set of scheduler updates:
      
         - Prevent PSI state corruption when schedule() races with cgroup
           move.
      
           A recent commit combined two PSI callbacks to reduce the number of
           cgroup tree updates, but missed that schedule() can drop rq::lock
           for load balancing, which opens the race window for
           cgroup_move_task() which then observes half updated state.
      
           The fix is to solely use task::ps_flags instead of looking at the
           potentially mismatching scheduler state
      
         - Prevent an out-of-bounds access in uclamp caused bu a rounding
           division which can lead to an off-by-one error exceeding the
           buckets array size.
      
         - Prevent unfairness caused by missing load decay when a task is
           attached to a cfs runqueue.
      
           The old load of the task was attached to the runqueue and never
           removed. Fix it by enforcing the load update through the hierarchy
           for unthrottled run queue instances.
      
         - A documentation fix fot the 'sched_verbose' command line option"
      
      * tag 'sched-urgent-2021-05-09' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        sched/fair: Fix unfairness caused by missing load decay
        sched: Fix out-of-bound access in uclamp
        psi: Fix psi state corruption when schedule() races with cgroup move
        sched,doc: sched_debug_verbose cmdline should be sched_verbose
      9819f682
    • Linus Torvalds's avatar
      Merge tag 'locking-urgent-2021-05-09' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 732a27a0
      Linus Torvalds authored
      Pull locking fixes from Thomas Gleixner:
       "A set of locking related fixes and updates:
      
         - Two fixes for the futex syscall related to the timeout handling.
      
           FUTEX_LOCK_PI does not support the FUTEX_CLOCK_REALTIME bit and
           because it's not set the time namespace adjustment for clock
           MONOTONIC is applied wrongly.
      
           FUTEX_WAIT cannot support the FUTEX_CLOCK_REALTIME bit because its
           always a relative timeout.
      
         - Cleanups in the futex syscall entry points which became obvious
           when the two timeout handling bugs were fixed.
      
         - Cleanup of queued_write_lock_slowpath() as suggested by Linus
      
         - Fixup of the smp_call_function_single_async() prototype"
      
      * tag 'locking-urgent-2021-05-09' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        futex: Make syscall entry points less convoluted
        futex: Get rid of the val2 conditional dance
        futex: Do not apply time namespace adjustment on FUTEX_LOCK_PI
        Revert 337f1304 ("futex: Allow FUTEX_CLOCK_REALTIME with FUTEX_WAIT op")
        locking/qrwlock: Cleanup queued_write_lock_slowpath()
        smp: Fix smp_call_function_single_async prototype
      732a27a0
    • Linus Torvalds's avatar
      Merge tag 'perf_urgent_for_v5.13_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 85bbba1c
      Linus Torvalds authored
      Pull x86 perf fix from Borislav Petkov:
       "Handle power-gating of AMD IOMMU perf counters properly when they are
        used"
      
      * tag 'perf_urgent_for_v5.13_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/events/amd/iommu: Fix invalid Perf result due to IOMMU PMC power-gating
      85bbba1c
    • Linus Torvalds's avatar
      Merge tag 'x86_urgent_for_v5.13_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · dd3e4012
      Linus Torvalds authored
      Pull x86 fixes from Borislav Petkov:
       "A bunch of things accumulated for x86 in the last two weeks:
      
         - Fix guest vtime accounting so that ticks happening while the guest
           is running can also be accounted to it. Along with a consolidation
           to the guest-specific context tracking helpers.
      
         - Provide for the host NMI handler running after a VMX VMEXIT to be
           able to run on the kernel stack correctly.
      
         - Initialize MSR_TSC_AUX when RDPID is supported and not RDTSCP (virt
           relevant - real hw supports both)
      
         - A code generation improvement to TASK_SIZE_MAX through the use of
           alternatives
      
         - The usual misc and related cleanups and improvements"
      
      * tag 'x86_urgent_for_v5.13_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        KVM: x86: Consolidate guest enter/exit logic to common helpers
        context_tracking: KVM: Move guest enter/exit wrappers to KVM's domain
        context_tracking: Consolidate guest enter/exit wrappers
        sched/vtime: Move guest enter/exit vtime accounting to vtime.h
        sched/vtime: Move vtime accounting external declarations above inlines
        KVM: x86: Defer vtime accounting 'til after IRQ handling
        context_tracking: Move guest exit vtime accounting to separate helpers
        context_tracking: Move guest exit context tracking to separate helpers
        KVM/VMX: Invoke NMI non-IST entry instead of IST entry
        x86/cpu: Remove write_tsc() and write_rdtscp_aux() wrappers
        x86/cpu: Initialize MSR_TSC_AUX if RDTSCP *or* RDPID is supported
        x86/resctrl: Fix init const confusion
        x86: Delete UD0, UD1 traces
        x86/smpboot: Remove duplicate includes
        x86/cpu: Use alternative to generate the TASK_SIZE_MAX constant
      dd3e4012
  8. May 09, 2021
    • Jens Axboe's avatar
      Revert "bio: limit bio max size" · 35c820e7
      Jens Axboe authored
      This reverts commit cd2c7545
      
      .
      
      Alex reports that the commit causes corruption with LUKS on ext4. Revert
      it for now so that this can be investigated properly.
      
      Link: https://lore.kernel.org/linux-block/1620493841.bxdq8r5haw.none@localhost/
      Reported-by: default avatarAlex Xu (Hello71) <alex_y_xu@yahoo.ca>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      35c820e7
    • Linus Torvalds's avatar
      Merge tag 'riscv-for-linus-5.13-mw1' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux · b7415964
      Linus Torvalds authored
      Pull RISC-V fixes from Palmer Dabbelt:
      
       - A fix to avoid over-allocating the kernel's mapping on !MMU systems,
         which could lead to up to 2MiB of lost memory
      
       - The SiFive address extension errata only manifest on rv64, they are
         now disabled on rv32 where they are unnecessary
      
       - A pair of late-landing cleanups
      
      * tag 'riscv-for-linus-5.13-mw1' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
        riscv: remove unused handle_exception symbol
        riscv: Consistify protect_kernel_linear_mapping_text_rodata() use
        riscv: enable SiFive errata CIP-453 and CIP-1200 Kconfig only if CONFIG_64BIT=y
        riscv: Only extend kernel reservation if mapped read-only
      b7415964
    • Linus Torvalds's avatar
      drm/i915/display: fix compiler warning about array overrun · fec4d427
      Linus Torvalds authored
      
      
      intel_dp_check_mst_status() uses a 14-byte array to read the DPRX Event
      Status Indicator data, but then passes that buffer at offset 10 off as
      an argument to drm_dp_channel_eq_ok().
      
      End result: there are only 4 bytes remaining of the buffer, yet
      drm_dp_channel_eq_ok() wants a 6-byte buffer.  gcc-11 correctly warns
      about this case:
      
        drivers/gpu/drm/i915/display/intel_dp.c: In function ‘intel_dp_check_mst_status’:
        drivers/gpu/drm/i915/display/intel_dp.c:3491:22: warning: ‘drm_dp_channel_eq_ok’ reading 6 bytes from a region of size 4 [-Wstringop-overread]
         3491 |                     !drm_dp_channel_eq_ok(&esi[10], intel_dp->lane_count)) {
              |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        drivers/gpu/drm/i915/display/intel_dp.c:3491:22: note: referencing argument 1 of type ‘const u8 *’ {aka ‘const unsigned char *’}
        In file included from drivers/gpu/drm/i915/display/intel_dp.c:38:
        include/drm/drm_dp_helper.h:1466:6: note: in a call to function ‘drm_dp_channel_eq_ok’
         1466 | bool drm_dp_channel_eq_ok(const u8 link_status[DP_LINK_STATUS_SIZE],
              |      ^~~~~~~~~~~~~~~~~~~~
             6:14 elapsed
      
      This commit just extends the original array by 2 zero-initialized bytes,
      avoiding the warning.
      
      There may be some underlying bug in here that caused this confusion, but
      this is at least no worse than the existing situation that could use
      random data off the stack.
      
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Dave Airlie <airlied@redhat.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      fec4d427
    • Linus Torvalds's avatar
      Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · 07db0563
      Linus Torvalds authored
      Pull more SCSI updates from James Bottomley:
       "This is a set of minor fixes in various drivers (qla2xxx, ufs,
        scsi_debug, lpfc) one doc fix and a fairly large update to the fnic
        driver to remove the open coded iteration functions in favour of the
        scsi provided ones"
      
      * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: fnic: Use scsi_host_busy_iter() to traverse commands
        scsi: fnic: Kill 'exclude_id' argument to fnic_cleanup_io()
        scsi: scsi_debug: Fix cmd_per_lun, set to max_queue
        scsi: ufs: core: Narrow down fast path in system suspend path
        scsi: ufs: core: Cancel rpm_dev_flush_recheck_work during system suspend
        scsi: ufs: core: Do not put UFS power into LPM if link is broken
        scsi: qla2xxx: Prevent PRLI in target mode
        scsi: qla2xxx: Add marginal path handling support
        scsi: target: tcmu: Return from tcmu_handle_completions() if cmd_id not found
        scsi: ufs: core: Fix a typo in ufs-sysfs.c
        scsi: lpfc: Fix bad memory access during VPD DUMP mailbox command
        scsi: lpfc: Fix DMA virtual address ptr assignment in bsg
        scsi: lpfc: Fix illegal memory access on Abort IOCBs
        scsi: blk-mq: Fix build warning when making htmldocs
      07db0563
    • Linus Torvalds's avatar
      Merge tag 'kbuild-v5.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild · 0f979d81
      Linus Torvalds authored
      Pull more Kbuild updates from Masahiro Yamada:
      
       - Convert sh and sparc to use generic shell scripts to generate the
         syscall headers
      
       - refactor .gitignore files
      
       - Update kernel/config_data.gz only when the content of the .config
         is really changed, which avoids the unneeded re-link of vmlinux
      
       - move "remove stale files" workarounds to scripts/remove-stale-files
      
       - suppress unused-but-set-variable warnings by default for Clang
         as well
      
       - fix locale setting LANG=C to LC_ALL=C
      
       - improve 'make distclean'
      
       - always keep intermediate objects from scripts/link-vmlinux.sh
      
       - move IF_ENABLED out of <linux/kconfig.h> to make it self-contained
      
       - misc cleanups
      
      * tag 'kbuild-v5.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (25 commits)
        linux/kconfig.h: replace IF_ENABLED() with PTR_IF() in <linux/kernel.h>
        kbuild: Don't remove link-vmlinux temporary files on exit/signal
        kbuild: remove the unneeded comments for external module builds
        kbuild: make distclean remove tag files in sub-directories
        kbuild: make distclean work against $(objtree) instead of $(srctree)
        kbuild: refactor modname-multi by using suffix-search
        kbuild: refactor fdtoverlay rule
        kbuild: parameterize the .o part of suffix-search
        arch: use cross_compiling to check whether it is a cross build or not
        kbuild: remove ARCH=sh64 support from top Makefile
        .gitignore: prefix local generated files with a slash
        kbuild: replace LANG=C with LC_ALL=C
        Makefile: Move -Wno-unused-but-set-variable out of GCC only block
        kbuild: add a script to remove stale generated files
        kbuild: update config_data.gz only when the content of .config is changed
        .gitignore: ignore only top-level modules.builtin
        .gitignore: move tags and TAGS close to other tag files
        kernel/.gitgnore: remove stale timeconst.h and hz.bc
        usr/include: refactor .gitignore
        genksyms: fix stale comment
        ...
      0f979d81
  9. May 08, 2021