mbox series

[PATCHv8,00/10] scsi: EH rework, main part

Message ID 20231023092837.33786-1-hare@suse.de (mailing list archive)
Headers show
Series scsi: EH rework, main part | expand

Message

Hannes Reinecke Oct. 23, 2023, 9:28 a.m. UTC
Hi all,

(taking up an old thread:)
here's now the main part of my EH rework.
It modifies the reset callbacks for SCSI EH such that
each callback (eh_host_reset_handler, eh_bus_reset_handler,
eh_target_reset_handler, eh_device_reset_handler) only
references the actual entity it needs to work on
(ie 'Scsi_Host', (scsi bus), 'scsi_target', 'scsi_device'),
and the 'struct scsi_cmnd' is dropped from the argument list.
This simplifies the handler themselves as they don't need to
exclude some 'magic' command, and we don't need to allocate
a mock 'struct scsi_cmnd' when issuing a reset via SCSI ioctl.

The entire patchset can be found at:

https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git
branch eh-rework.v8

As usual, comments and reviews are welcome.

Changes to v6:
- Include reviews from Bart
- Add patch to return -EAGAIN from scsi_ioctl_reset()

Changes to v5:
- Improve description for patch to modify scsi_eh_bus_device_reset()
- Add patch to modify the iteratrion in scsi_eh_bus_reset()

Hannes Reinecke (10):
  scsi: Use Scsi_Host as argument for eh_host_reset_handler
  scsi: Use Scsi_Host and channel number as argument for
    eh_bus_reset_handler()
  scsi: Use scsi_target as argument for eh_target_reset_handler()
  scsi: Use scsi_device as argument to eh_device_reset_handler()
  scsi: set host byte after EH completed
  scsi_error: iterate over list of failed commands in
    scsi_eh_bus_reset()
  scsi: Do not allocate scsi command in scsi_ioctl_reset()
  scsi_error: iterate over list of failed commands in
    scsi_eh_bus_device_reset()
  scsi_error: map FAST_IO_FAIL to -EAGAIN in SCSI EH
  scsi: remove SUBMITTED_BY_SCSI_RESET_IOCTL

 Documentation/scsi/scsi_eh.rst              |  15 +-
 Documentation/scsi/scsi_mid_low_api.rst     |  35 ++-
 drivers/infiniband/ulp/srp/ib_srp.c         |  12 +-
 drivers/message/fusion/mptfc.c              |  25 +-
 drivers/message/fusion/mptsas.c             |  10 +-
 drivers/message/fusion/mptscsih.c           | 114 +++------
 drivers/message/fusion/mptscsih.h           |   8 +-
 drivers/message/fusion/mptspi.c             |   8 +-
 drivers/s390/scsi/zfcp_scsi.c               |  16 +-
 drivers/scsi/3w-9xxx.c                      |  11 +-
 drivers/scsi/3w-sas.c                       |  11 +-
 drivers/scsi/3w-xxxx.c                      |  13 +-
 drivers/scsi/53c700.c                       |  39 +--
 drivers/scsi/BusLogic.c                     |  24 +-
 drivers/scsi/NCR5380.c                      |   5 +-
 drivers/scsi/a100u2w.c                      |  14 +-
 drivers/scsi/aacraid/linit.c                |  41 ++-
 drivers/scsi/advansys.c                     |  28 ++-
 drivers/scsi/aha152x.c                      |  10 +-
 drivers/scsi/aha1542.c                      |  28 +--
 drivers/scsi/aic7xxx/aic79xx_osm.c          |  37 ++-
 drivers/scsi/aic7xxx/aic7xxx_osm.c          |  10 +-
 drivers/scsi/arcmsr/arcmsr_hba.c            |   8 +-
 drivers/scsi/arm/acornscsi.c                |   8 +-
 drivers/scsi/arm/fas216.c                   |  24 +-
 drivers/scsi/arm/fas216.h                   |  17 +-
 drivers/scsi/atari_scsi.c                   |   4 +-
 drivers/scsi/be2iscsi/be_main.c             |  12 +-
 drivers/scsi/bfa/bfad_im.c                  |   8 +-
 drivers/scsi/bnx2fc/bnx2fc.h                |   4 +-
 drivers/scsi/bnx2fc/bnx2fc_io.c             |  14 +-
 drivers/scsi/csiostor/csio_scsi.c           |   5 +-
 drivers/scsi/cxlflash/main.c                |  10 +-
 drivers/scsi/dc395x.c                       |  24 +-
 drivers/scsi/esas2r/esas2r.h                |   8 +-
 drivers/scsi/esas2r/esas2r_main.c           |  57 +++--
 drivers/scsi/esp_scsi.c                     |   9 +-
 drivers/scsi/fdomain.c                      |   3 +-
 drivers/scsi/fnic/fnic.h                    |   4 +-
 drivers/scsi/fnic/fnic_scsi.c               |  12 +-
 drivers/scsi/hpsa.c                         |  14 +-
 drivers/scsi/hptiop.c                       |   6 +-
 drivers/scsi/ibmvscsi/ibmvfc.c              |  19 +-
 drivers/scsi/ibmvscsi/ibmvscsi.c            |  25 +-
 drivers/scsi/imm.c                          |   6 +-
 drivers/scsi/initio.c                       |  14 +-
 drivers/scsi/ipr.c                          |  29 ++-
 drivers/scsi/ips.c                          |  30 +--
 drivers/scsi/libfc/fc_fcp.c                 |  18 +-
 drivers/scsi/libiscsi.c                     |  21 +-
 drivers/scsi/libsas/sas_scsi_host.c         |  21 +-
 drivers/scsi/lpfc/lpfc_scsi.c               |  29 ++-
 drivers/scsi/mac53c94.c                     |   8 +-
 drivers/scsi/megaraid.c                     |   6 +-
 drivers/scsi/megaraid.h                     |   2 +-
 drivers/scsi/megaraid/megaraid_mbox.c       |  18 +-
 drivers/scsi/megaraid/megaraid_sas.h        |   3 +-
 drivers/scsi/megaraid/megaraid_sas_base.c   |  60 ++---
 drivers/scsi/megaraid/megaraid_sas_fusion.c |  55 +++--
 drivers/scsi/mesh.c                         |  12 +-
 drivers/scsi/mpi3mr/mpi3mr_os.c             | 134 +++++-----
 drivers/scsi/mpt3sas/mpt3sas_scsih.c        |  82 +++---
 drivers/scsi/mvumi.c                        |   9 +-
 drivers/scsi/myrb.c                         |   3 +-
 drivers/scsi/myrs.c                         |   3 +-
 drivers/scsi/ncr53c8xx.c                    |   4 +-
 drivers/scsi/nsp32.c                        |  14 +-
 drivers/scsi/pcmcia/nsp_cs.c                |  10 +-
 drivers/scsi/pcmcia/nsp_cs.h                |   6 +-
 drivers/scsi/pcmcia/qlogic_stub.c           |   4 +-
 drivers/scsi/pcmcia/sym53c500_cs.c          |   8 +-
 drivers/scsi/pmcraid.c                      |  36 ++-
 drivers/scsi/ppa.c                          |   6 +-
 drivers/scsi/qedf/qedf_main.c               |  13 +-
 drivers/scsi/qedi/qedi_iscsi.c              |   3 +-
 drivers/scsi/qla1280.c                      |  74 +++---
 drivers/scsi/qla2xxx/qla_os.c               |  85 +++----
 drivers/scsi/qla4xxx/ql4_os.c               |  58 ++---
 drivers/scsi/qlogicfas408.c                 |  10 +-
 drivers/scsi/qlogicfas408.h                 |   2 +-
 drivers/scsi/qlogicpti.c                    |   3 +-
 drivers/scsi/scsi_debug.c                   |  54 ++--
 drivers/scsi/scsi_error.c                   | 260 ++++++++++----------
 drivers/scsi/scsi_lib.c                     |   2 -
 drivers/scsi/smartpqi/smartpqi.h            |   1 -
 drivers/scsi/smartpqi/smartpqi_init.c       |  19 +-
 drivers/scsi/snic/snic.h                    |   5 +-
 drivers/scsi/snic/snic_scsi.c               |  41 +--
 drivers/scsi/stex.c                         |   9 +-
 drivers/scsi/storvsc_drv.c                  |   4 +-
 drivers/scsi/sym53c8xx_2/sym_glue.c         |  14 +-
 drivers/scsi/virtio_scsi.c                  |  12 +-
 drivers/scsi/vmw_pvscsi.c                   |  20 +-
 drivers/scsi/wd33c93.c                      |   8 +-
 drivers/scsi/wd33c93.h                      |   2 +-
 drivers/scsi/wd719x.c                       |  17 +-
 drivers/scsi/xen-scsifront.c                |   6 +-
 drivers/staging/rts5208/rtsx.c              |   6 +-
 drivers/target/loopback/tcm_loop.c          |  17 +-
 drivers/ufs/core/ufshcd.c                   |  18 +-
 drivers/usb/image/microtek.c                |   4 +-
 drivers/usb/storage/scsiglue.c              |   8 +-
 drivers/usb/storage/uas.c                   |   3 +-
 include/scsi/libfc.h                        |   4 +-
 include/scsi/libiscsi.h                     |   4 +-
 include/scsi/libsas.h                       |   4 +-
 include/scsi/scsi_cmnd.h                    |   1 -
 include/scsi/scsi_eh.h                      |   2 +-
 include/scsi/scsi_host.h                    |   8 +-
 109 files changed, 1038 insertions(+), 1223 deletions(-)

Comments

Benjamin Block Oct. 24, 2023, 5:30 p.m. UTC | #1
Hey Hannes,

On Mon, Oct 23, 2023 at 11:28:27AM +0200, Hannes Reinecke wrote:
> Hi all,
> 
> (taking up an old thread:)
> here's now the main part of my EH rework.
> It modifies the reset callbacks for SCSI EH such that
> each callback (eh_host_reset_handler, eh_bus_reset_handler,
> eh_target_reset_handler, eh_device_reset_handler) only
> references the actual entity it needs to work on
> (ie 'Scsi_Host', (scsi bus), 'scsi_target', 'scsi_device'),
> and the 'struct scsi_cmnd' is dropped from the argument list.
> This simplifies the handler themselves as they don't need to
> exclude some 'magic' command, and we don't need to allocate
> a mock 'struct scsi_cmnd' when issuing a reset via SCSI ioctl.
> 
> The entire patchset can be found at:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git
> branch eh-rework.v8

This doesn't exist (yet?). I also tried to somehow get both part 2 of the
preparations and this series applied on some tree, but failed.
Preparations part 2 seems to be based on some form of Linus' master tree, and
this on Martin's staging tree?
Maybe I'm just unlucky :D
Hannes Reinecke Oct. 24, 2023, 5:40 p.m. UTC | #2
On 10/24/23 19:30, Benjamin Block wrote:
> Hey Hannes,
> 
> On Mon, Oct 23, 2023 at 11:28:27AM +0200, Hannes Reinecke wrote:
>> Hi all,
>>
>> (taking up an old thread:)
>> here's now the main part of my EH rework.
>> It modifies the reset callbacks for SCSI EH such that
>> each callback (eh_host_reset_handler, eh_bus_reset_handler,
>> eh_target_reset_handler, eh_device_reset_handler) only
>> references the actual entity it needs to work on
>> (ie 'Scsi_Host', (scsi bus), 'scsi_target', 'scsi_device'),
>> and the 'struct scsi_cmnd' is dropped from the argument list.
>> This simplifies the handler themselves as they don't need to
>> exclude some 'magic' command, and we don't need to allocate
>> a mock 'struct scsi_cmnd' when issuing a reset via SCSI ioctl.
>>
>> The entire patchset can be found at:
>>
>> https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git
>> branch eh-rework.v8
> 
> This doesn't exist (yet?). I also tried to somehow get both part 2 of the
> preparations and this series applied on some tree, but failed.
> Preparations part 2 seems to be based on some form of Linus' master tree, and
> this on Martin's staging tree?
> Maybe I'm just unlucky :D
> 
Maybe you are.
Pushed now, please try again.

Cheers,

Hannes
Benjamin Block Oct. 24, 2023, 5:57 p.m. UTC | #3
On Tue, Oct 24, 2023 at 07:40:15PM +0200, Hannes Reinecke wrote:
> On 10/24/23 19:30, Benjamin Block wrote:
> > On Mon, Oct 23, 2023 at 11:28:27AM +0200, Hannes Reinecke wrote:
> >> The entire patchset can be found at:
> >>
> >> https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git
> >> branch eh-rework.v8
> > 
> > This doesn't exist (yet?). I also tried to somehow get both part 2 of the
> > preparations and this series applied on some tree, but failed.
> > Preparations part 2 seems to be based on some form of Linus' master tree, and
> > this on Martin's staging tree?
> > Maybe I'm just unlucky :D
> > 
> Maybe you are.
> Pushed now, please try again.

That was v9, but I guess that works as well, thanks.
Wenchao Hao March 6, 2024, 1:40 p.m. UTC | #4
On 2023/10/23 17:28, Hannes Reinecke wrote:
> Hi all,
> 
> (taking up an old thread:)
> here's now the main part of my EH rework.
> It modifies the reset callbacks for SCSI EH such that
> each callback (eh_host_reset_handler, eh_bus_reset_handler,
> eh_target_reset_handler, eh_device_reset_handler) only
> references the actual entity it needs to work on
> (ie 'Scsi_Host', (scsi bus), 'scsi_target', 'scsi_device'),
> and the 'struct scsi_cmnd' is dropped from the argument list.
> This simplifies the handler themselves as they don't need to
> exclude some 'magic' command, and we don't need to allocate
> a mock 'struct scsi_cmnd' when issuing a reset via SCSI ioctl.
> 
> The entire patchset can be found at:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git
> branch eh-rework.v8
> 
> As usual, comments and reviews are welcome.
> 

Hi Hannes,

It seems a long time, is this work still going on?

> Changes to v6:
> - Include reviews from Bart
> - Add patch to return -EAGAIN from scsi_ioctl_reset()
> 
> Changes to v5:
> - Improve description for patch to modify scsi_eh_bus_device_reset()
> - Add patch to modify the iteratrion in scsi_eh_bus_reset()
> 
> Hannes Reinecke (10):
>    scsi: Use Scsi_Host as argument for eh_host_reset_handler
>    scsi: Use Scsi_Host and channel number as argument for
>      eh_bus_reset_handler()
>    scsi: Use scsi_target as argument for eh_target_reset_handler()
>    scsi: Use scsi_device as argument to eh_device_reset_handler()
>    scsi: set host byte after EH completed
>    scsi_error: iterate over list of failed commands in
>      scsi_eh_bus_reset()
>    scsi: Do not allocate scsi command in scsi_ioctl_reset()
>    scsi_error: iterate over list of failed commands in
>      scsi_eh_bus_device_reset()
>    scsi_error: map FAST_IO_FAIL to -EAGAIN in SCSI EH
>    scsi: remove SUBMITTED_BY_SCSI_RESET_IOCTL
>
Niklas Cassel Nov. 5, 2024, 9:10 a.m. UTC | #5
Hello Hannes,

On Mon, Oct 23, 2023 at 11:28:27AM +0200, Hannes Reinecke wrote:
> Hi all,
> 
> (taking up an old thread:)
> here's now the main part of my EH rework.
> It modifies the reset callbacks for SCSI EH such that
> each callback (eh_host_reset_handler, eh_bus_reset_handler,
> eh_target_reset_handler, eh_device_reset_handler) only
> references the actual entity it needs to work on
> (ie 'Scsi_Host', (scsi bus), 'scsi_target', 'scsi_device'),
> and the 'struct scsi_cmnd' is dropped from the argument list.
> This simplifies the handler themselves as they don't need to
> exclude some 'magic' command, and we don't need to allocate
> a mock 'struct scsi_cmnd' when issuing a reset via SCSI ioctl.
> 
> The entire patchset can be found at:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git
> branch eh-rework.v8
> 
> As usual, comments and reviews are welcome.

This seems to be the latest version of your EH rework.

Do you have any plans to send a v9?


Kind regards,
Niklas
Hannes Reinecke Nov. 5, 2024, 3:22 p.m. UTC | #6
On 11/5/24 10:10, Niklas Cassel wrote:
> Hello Hannes,
> 
> On Mon, Oct 23, 2023 at 11:28:27AM +0200, Hannes Reinecke wrote:
>> Hi all,
>>
>> (taking up an old thread:)
>> here's now the main part of my EH rework.
>> It modifies the reset callbacks for SCSI EH such that
>> each callback (eh_host_reset_handler, eh_bus_reset_handler,
>> eh_target_reset_handler, eh_device_reset_handler) only
>> references the actual entity it needs to work on
>> (ie 'Scsi_Host', (scsi bus), 'scsi_target', 'scsi_device'),
>> and the 'struct scsi_cmnd' is dropped from the argument list.
>> This simplifies the handler themselves as they don't need to
>> exclude some 'magic' command, and we don't need to allocate
>> a mock 'struct scsi_cmnd' when issuing a reset via SCSI ioctl.
>>
>> The entire patchset can be found at:
>>
>> https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git
>> branch eh-rework.v8
>>
>> As usual, comments and reviews are welcome.
> 
> This seems to be the latest version of your EH rework.
> 
> Do you have any plans to send a v9?
> 
Weelll ... I didn't really proceed with that, as that requires
for some LLDDs to set a side a command tag for TMF.

It was relatively easy pre-multiqueue times (where you could just
reduce max_commands by 1), but for blk-mq that now longer works.

We need to do some really cumbersome things (just look at fnic ...)
and I hoped I could get the 'reserved commands for TMF' patchset
in first, so then this one would be easy.

Alas, this hasn't happened, and so I didn't continue on that work.
But I'll see if I can resurrect it.

Cheers,

Hannes
Niklas Cassel Nov. 5, 2024, 3:47 p.m. UTC | #7
Hello Hannes,

On Tue, Nov 05, 2024 at 04:22:40PM +0100, Hannes Reinecke wrote:
> On 11/5/24 10:10, Niklas Cassel wrote:
> > Hello Hannes,
> > 
> > On Mon, Oct 23, 2023 at 11:28:27AM +0200, Hannes Reinecke wrote:
> > > Hi all,
> > > 
> > > (taking up an old thread:)
> > > here's now the main part of my EH rework.
> > > It modifies the reset callbacks for SCSI EH such that
> > > each callback (eh_host_reset_handler, eh_bus_reset_handler,
> > > eh_target_reset_handler, eh_device_reset_handler) only
> > > references the actual entity it needs to work on
> > > (ie 'Scsi_Host', (scsi bus), 'scsi_target', 'scsi_device'),
> > > and the 'struct scsi_cmnd' is dropped from the argument list.
> > > This simplifies the handler themselves as they don't need to
> > > exclude some 'magic' command, and we don't need to allocate
> > > a mock 'struct scsi_cmnd' when issuing a reset via SCSI ioctl.
> > > 
> > > The entire patchset can be found at:
> > > 
> > > https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git
> > > branch eh-rework.v8
> > > 
> > > As usual, comments and reviews are welcome.
> > 
> > This seems to be the latest version of your EH rework.
> > 
> > Do you have any plans to send a v9?
> > 
> Weelll ... I didn't really proceed with that, as that requires
> for some LLDDs to set a side a command tag for TMF.
> 
> It was relatively easy pre-multiqueue times (where you could just
> reduce max_commands by 1), but for blk-mq that now longer works.
> 
> We need to do some really cumbersome things (just look at fnic ...)
> and I hoped I could get the 'reserved commands for TMF' patchset
> in first, so then this one would be easy.

I see, I didn't realize that the series had outstanding dependencies.


For anyone else looking for the actual series in lore, here there are:

EH rework prep patches, part 1:
https://lore.kernel.org/linux-scsi/20231002154328.43718-1-hare@suse.de/
- This series has been merged by Martin, and was included in v6.7.

EH rework prep patches, part 2:
https://lore.kernel.org/linux-scsi/20231023091507.120828-1-hare@suse.de/
- This series has not been merged, and is most likely the
  'reserved commands for TMF' series that Hannes is referring to.

EH rework, main part (or part 3):
https://lore.kernel.org/linux-scsi/20231023092837.33786-1-hare@suse.de/
- Depends on part 2 (which has not been merged yet).


> 
> Alas, this hasn't happened, and so I didn't continue on that work.
> But I'll see if I can resurrect it.