24 Jun, 2020

1 commit

  • [ Upstream commit 4919b33b63c8b69d8dcf2b867431d0e3b6dc6d28 ]

    The adapter info MAD is used to send the client info and receive the host
    info as a response. A persistent buffer is used and as such the client info
    is overwritten after the response. During the course of a normal adapter
    reset the client info is refreshed in the buffer in preparation for sending
    the adapter info MAD.

    However, in the special case of LPM where we reenable the CRQ instead of a
    full CRQ teardown and reset we fail to refresh the client info in the
    adapter info buffer. As a result, after Live Partition Migration (LPM) we
    erroneously report the host's info as our own.

    [mkp: typos]

    Link: https://lore.kernel.org/r/20200603203632.18426-1-tyreld@linux.ibm.com
    Signed-off-by: Tyrel Datwyler
    Signed-off-by: Martin K. Petersen
    Signed-off-by: Sasha Levin

    Tyrel Datwyler
     

27 May, 2020

1 commit

  • [ Upstream commit b36522150e5b85045f868768d46fbaaa034174b2 ]

    While removing an ibmvscsi client adapter a WARN_ON like the following is
    seen in the kernel log:

    drmgr: drmgr: -r -c slot -s U9080.M9S.783AEC8-V11-C11 -w 5 -d 1
    WARNING: CPU: 9 PID: 24062 at ../kernel/dma/mapping.c:311 dma_free_attrs+0x78/0x110
    Supported: No, Unreleased kernel
    CPU: 9 PID: 24062 Comm: drmgr Kdump: loaded Tainted: G X 5.3.18-12-default
    NIP: c0000000001fa758 LR: c0000000001fa744 CTR: c0000000001fa6e0
    REGS: c0000002173375d0 TRAP: 0700 Tainted: G X (5.3.18-12-default)
    MSR: 8000000000029033 CR: 28088282 XER: 20000000
    CFAR: c0000000001fbf0c IRQMASK: 1
    GPR00: c0000000001fa744 c000000217337860 c00000000161ab00 0000000000000000
    GPR04: 0000000000000000 c000011e12250000 0000000018010000 0000000000000000
    GPR08: 0000000000000000 0000000000000001 0000000000000001 c0080000190f4fa8
    GPR12: c0000000001fa6e0 c000000007fc2a00 0000000000000000 0000000000000000
    GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
    GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
    GPR24: 000000011420e310 0000000000000000 0000000000000000 0000000018010000
    GPR28: c00000000159de50 c000011e12250000 0000000000006600 c000011e5c994848
    NIP [c0000000001fa758] dma_free_attrs+0x78/0x110
    LR [c0000000001fa744] dma_free_attrs+0x64/0x110
    Call Trace:
    [c000000217337860] [000000011420e310] 0x11420e310 (unreliable)
    [c0000002173378b0] [c0080000190f0280] release_event_pool+0xd8/0x120 [ibmvscsi]
    [c000000217337930] [c0080000190f3f74] ibmvscsi_remove+0x6c/0x160 [ibmvscsi]
    [c000000217337960] [c0000000000f3cac] vio_bus_remove+0x5c/0x100
    [c0000002173379a0] [c00000000087a0a4] device_release_driver_internal+0x154/0x280
    [c0000002173379e0] [c0000000008777cc] bus_remove_device+0x11c/0x220
    [c000000217337a60] [c000000000870fc4] device_del+0x1c4/0x470
    [c000000217337b10] [c0000000008712a0] device_unregister+0x30/0xa0
    [c000000217337b80] [c0000000000f39ec] vio_unregister_device+0x2c/0x60
    [c000000217337bb0] [c00800001a1d0964] dlpar_remove_slot+0x14c/0x250 [rpadlpar_io]
    [c000000217337c50] [c00800001a1d0bcc] remove_slot_store+0xa4/0x110 [rpadlpar_io]
    [c000000217337cd0] [c000000000c091a0] kobj_attr_store+0x30/0x50
    [c000000217337cf0] [c00000000057c934] sysfs_kf_write+0x64/0x90
    [c000000217337d10] [c00000000057be10] kernfs_fop_write+0x1b0/0x290
    [c000000217337d60] [c000000000488c4c] __vfs_write+0x3c/0x70
    [c000000217337d80] [c00000000048c648] vfs_write+0xd8/0x260
    [c000000217337dd0] [c00000000048ca8c] ksys_write+0xdc/0x130
    [c000000217337e20] [c00000000000b488] system_call+0x5c/0x70
    Instruction dump:
    7c840074 f8010010 f821ffb1 20840040 eb830218 7c8407b4 48002019 60000000
    2fa30000 409e003c 892d0988 792907e0 2fbd0000 419e0028 2fbc0000
    ---[ end trace 5955b3c0cc079942 ]---
    rpadlpar_io: slot U9080.M9S.783AEC8-V11-C11 removed

    This is tripped as a result of irqs being disabled during the call to
    dma_free_coherent() by release_event_pool(). At this point in the code path
    we have quiesced the adapter and it is overly paranoid to be holding the
    host lock.

    [mkp: fixed build warning reported by sfr]

    Link: https://lore.kernel.org/r/1588027793-17952-1-git-send-email-tyreld@linux.ibm.com
    Signed-off-by: Tyrel Datwyler
    Signed-off-by: Martin K. Petersen
    Signed-off-by: Sasha Levin

    Tyrel Datwyler
     

22 Sep, 2019

1 commit

  • Pull SCSI updates from James Bottomley:
    "This is mostly update of the usual drivers: qla2xxx, ufs, smartpqi,
    lpfc, hisi_sas, qedf, mpt3sas; plus a whole load of minor updates. The
    only core change this time around is the addition of request batching
    for virtio. Since batching requires an additional flag to use, it
    should be invisible to the rest of the drivers"

    * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (264 commits)
    scsi: hisi_sas: Fix the conflict between device gone and host reset
    scsi: hisi_sas: Add BIST support for phy loopback
    scsi: hisi_sas: Add hisi_sas_debugfs_alloc() to centralise allocation
    scsi: hisi_sas: Remove some unused function arguments
    scsi: hisi_sas: Remove redundant work declaration
    scsi: hisi_sas: Remove hisi_sas_hw.slot_complete
    scsi: hisi_sas: Assign NCQ tag for all NCQ commands
    scsi: hisi_sas: Update all the registers after suspend and resume
    scsi: hisi_sas: Retry 3 times TMF IO for SAS disks when init device
    scsi: hisi_sas: Remove sleep after issue phy reset if sas_smp_phy_control() fails
    scsi: hisi_sas: Directly return when running I_T_nexus reset if phy disabled
    scsi: hisi_sas: Use true/false as input parameter of sas_phy_reset()
    scsi: hisi_sas: add debugfs auto-trigger for internal abort time out
    scsi: virtio_scsi: unplug LUNs when events missed
    scsi: scsi_dh_rdac: zero cdb in send_mode_select()
    scsi: fcoe: fix null-ptr-deref Read in fc_release_transport
    scsi: ufs-hisi: use devm_platform_ioremap_resource() to simplify code
    scsi: ufshcd: use devm_platform_ioremap_resource() to simplify code
    scsi: hisi_sas: use devm_platform_ioremap_resource() to simplify code
    scsi: ufs: Use kmemdup in ufshcd_read_string_desc()
    ...

    Linus Torvalds
     

08 Aug, 2019

1 commit

  • Mark switch cases where we are expecting to fall through.

    This patch fixes the following warnings:

    drivers/scsi/ibmvscsi/ibmvfc.c: In function 'ibmvfc_npiv_login_done':
    drivers/scsi/ibmvscsi/ibmvfc.c:4022:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
    ibmvfc_retry_host_init(vhost);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    drivers/scsi/ibmvscsi/ibmvfc.c:4023:2: note: here
    case IBMVFC_MAD_DRIVER_FAILED:
    ^~~~
    drivers/scsi/ibmvscsi/ibmvfc.c: In function 'ibmvfc_bsg_request':
    drivers/scsi/ibmvscsi/ibmvfc.c:1830:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
    port_id = (bsg_request->rqst_data.h_els.port_id[0] << 16) |
    ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    (bsg_request->rqst_data.h_els.port_id[1] << 8) |
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    bsg_request->rqst_data.h_els.port_id[2];
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    drivers/scsi/ibmvscsi/ibmvfc.c:1833:2: note: here
    case FC_BSG_RPT_ELS:
    ^~~~
    drivers/scsi/ibmvscsi/ibmvfc.c:1838:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
    port_id = (bsg_request->rqst_data.h_ct.port_id[0] << 16) |
    ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    (bsg_request->rqst_data.h_ct.port_id[1] << 8) |
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    bsg_request->rqst_data.h_ct.port_id[2];
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    drivers/scsi/ibmvscsi/ibmvfc.c:1841:2: note: here
    case FC_BSG_RPT_CT:
    ^~~~

    Reported-by: Stephen Rothwell
    Signed-off-by: Gustavo A. R. Silva
    Reviewed-by: Kees Cook
    Acked-by: Tyrel Datwyler
    Signed-off-by: Martin K. Petersen

    Gustavo A. R. Silva
     

24 Jul, 2019

1 commit

  • While removing an ibmvfc client adapter a WARN_ON like the following
    WARN_ON is seen in the kernel log:

    WARNING: CPU: 6 PID: 5421 at ./include/linux/dma-mapping.h:541
    ibmvfc_free_event_pool+0x12c/0x1f0 [ibmvfc]
    CPU: 6 PID: 5421 Comm: rmmod Tainted: G E 4.17.0-rc1-next-20180419-autotest #1
    NIP: d00000000290328c LR: d00000000290325c CTR: c00000000036ee20
    REGS: c000000288d1b7e0 TRAP: 0700 Tainted: G E (4.17.0-rc1-next-20180419-autotest)
    MSR: 800000010282b033 CR: 44008828 XER: 20000000
    CFAR: c00000000036e408 SOFTE: 1
    GPR00: d00000000290325c c000000288d1ba60 d000000002917900 c000000289d75448
    GPR04: 0000000000000071 c0000000ff870000 0000000018040000 0000000000000001
    GPR08: 0000000000000000 c00000000156e838 0000000000000001 d00000000290c640
    GPR12: c00000000036ee20 c00000001ec4dc00 0000000000000000 0000000000000000
    GPR16: 0000000000000000 0000000000000000 00000100276901e0 0000000010020598
    GPR20: 0000000010020550 0000000010020538 0000000010020578 00000000100205b0
    GPR24: 0000000000000000 0000000000000000 0000000010020590 5deadbeef0000100
    GPR28: 5deadbeef0000200 d000000002910b00 0000000000000071 c0000002822f87d8
    NIP [d00000000290328c] ibmvfc_free_event_pool+0x12c/0x1f0 [ibmvfc]
    LR [d00000000290325c] ibmvfc_free_event_pool+0xfc/0x1f0 [ibmvfc]
    Call Trace:
    [c000000288d1ba60] [d00000000290325c] ibmvfc_free_event_pool+0xfc/0x1f0 [ibmvfc] (unreliable)
    [c000000288d1baf0] [d000000002909390] ibmvfc_abort_task_set+0x7b0/0x8b0 [ibmvfc]
    [c000000288d1bb70] [c0000000000d8c68] vio_bus_remove+0x68/0x100
    [c000000288d1bbb0] [c0000000007da7c4] device_release_driver_internal+0x1f4/0x2d0
    [c000000288d1bc00] [c0000000007da95c] driver_detach+0x7c/0x100
    [c000000288d1bc40] [c0000000007d8af4] bus_remove_driver+0x84/0x140
    [c000000288d1bcb0] [c0000000007db6ac] driver_unregister+0x4c/0xa0
    [c000000288d1bd20] [c0000000000d6e7c] vio_unregister_driver+0x2c/0x50
    [c000000288d1bd50] [d00000000290ba0c] cleanup_module+0x24/0x15e0 [ibmvfc]
    [c000000288d1bd70] [c0000000001dadb0] sys_delete_module+0x220/0x2d0
    [c000000288d1be30] [c00000000000b284] system_call+0x58/0x6c
    Instruction dump:
    e8410018 e87f0068 809f0078 e8bf0080 e8df0088 2fa30000 419e008c e9230200
    2fa90000 419e0080 894d098a 794a07e0 e9290008 2fa90000 419e0028

    This is tripped as a result of irqs being disabled during the call to
    dma_free_coherent() by ibmvfc_free_event_pool(). At this point in the code path
    we have quiesced the adapter and its overly paranoid anyways to be holding the
    host lock.

    Reported-by: Abdul Haleem
    Signed-off-by: Tyrel Datwyler
    Signed-off-by: Martin K. Petersen

    Tyrel Datwyler
     

12 Jul, 2019

1 commit

  • Pull SCSI updates from James Bottomley:
    "This is mostly update of the usual drivers: qla2xxx, hpsa, lpfc, ufs,
    mpt3sas, ibmvscsi, megaraid_sas, bnx2fc and hisi_sas as well as the
    removal of the osst driver (I heard from Willem privately that he
    would like the driver removed because all his test hardware has
    failed). Plus number of minor changes, spelling fixes and other
    trivia.

    The big merge conflict this time around is the SPDX licence tags.
    Following discussion on linux-next, we believe our version to be more
    accurate than the one in the tree, so the resolution is to take our
    version for all the SPDX conflicts"

    Note on the SPDX license tag conversion conflicts: the SCSI tree had
    done its own SPDX conversion, which in some cases conflicted with the
    treewide ones done by Thomas & co.

    In almost all cases, the conflicts were purely syntactic: the SCSI tree
    used the old-style SPDX tags ("GPL-2.0" and "GPL-2.0+") while the
    treewide conversion had used the new-style ones ("GPL-2.0-only" and
    "GPL-2.0-or-later").

    In these cases I picked the new-style one.

    In a few cases, the SPDX conversion was actually different, though. As
    explained by James above, and in more detail in a pre-pull-request
    thread:

    "The other problem is actually substantive: In the libsas code Luben
    Tuikov originally specified gpl 2.0 only by dint of stating:

    * This file is licensed under GPLv2.

    In all the libsas files, but then muddied the water by quoting GPLv2
    verbatim (which includes the or later than language). So for these
    files Christoph did the conversion to v2 only SPDX tags and Thomas
    converted to v2 or later tags"

    So in those cases, where the spdx tag substantially mattered, I took the
    SCSI tree conversion of it, but then also took the opportunity to turn
    the old-style "GPL-2.0" into a new-style "GPL-2.0-only" tag.

    Similarly, when there were whitespace differences or other differences
    to the comments around the copyright notices, I took the version from
    the SCSI tree as being the more specific conversion.

    Finally, in the spdx conversions that had no conflicts (because the
    treewide ones hadn't been done for those files), I just took the SCSI
    tree version as-is, even if it was old-style. The old-style conversions
    are perfectly valid, even if the "-only" and "-or-later" versions are
    perhaps more descriptive.

    * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (185 commits)
    scsi: qla2xxx: move IO flush to the front of NVME rport unregistration
    scsi: qla2xxx: Fix NVME cmd and LS cmd timeout race condition
    scsi: qla2xxx: on session delete, return nvme cmd
    scsi: qla2xxx: Fix kernel crash after disconnecting NVMe devices
    scsi: megaraid_sas: Update driver version to 07.710.06.00-rc1
    scsi: megaraid_sas: Introduce various Aero performance modes
    scsi: megaraid_sas: Use high IOPS queues based on IO workload
    scsi: megaraid_sas: Set affinity for high IOPS reply queues
    scsi: megaraid_sas: Enable coalescing for high IOPS queues
    scsi: megaraid_sas: Add support for High IOPS queues
    scsi: megaraid_sas: Add support for MPI toolbox commands
    scsi: megaraid_sas: Offload Aero RAID5/6 division calculations to driver
    scsi: megaraid_sas: RAID1 PCI bandwidth limit algorithm is applicable for only Ventura
    scsi: megaraid_sas: megaraid_sas: Add check for count returned by HOST_DEVICE_LIST DCMD
    scsi: megaraid_sas: Handle sequence JBOD map failure at driver level
    scsi: megaraid_sas: Don't send FPIO to RL Bypass queue
    scsi: megaraid_sas: In probe context, retry IOC INIT once if firmware is in fault
    scsi: megaraid_sas: Release Mutex lock before OCR in case of DCMD timeout
    scsi: megaraid_sas: Call disable_irq from process IRQ poll
    scsi: megaraid_sas: Remove few debug counters from IO path
    ...

    Linus Torvalds
     

19 Jun, 2019

4 commits

  • clang warns:

    drivers/scsi/ibmvscsi/ibmvscsi.c:2126:7: warning: variable 'rc' is used
    uninitialized whenever switch case is taken [-Wsometimes-uninitialized]
    case IBMVSCSI_HOST_ACTION_NONE:
    ^~~~~~~~~~~~~~~~~~~~~~~~~
    drivers/scsi/ibmvscsi/ibmvscsi.c:2151:6: note: uninitialized use occurs
    here
    if (rc) {
    ^~

    Initialize rc in the IBMVSCSI_HOST_ACTION_UNBLOCK case statement then
    shuffle IBMVSCSI_HOST_ACTION_NONE down to the default case statement and
    make it return early so that rc is never used uninitialized in this
    function.

    Fixes: 035a3c4046b5 ("scsi: ibmvscsi: redo driver work thread to use enum action states")
    Link: https://github.com/ClangBuiltLinux/linux/issues/502
    Suggested-by: Michael Ellerman
    Suggested-by: Tyrel Datwyler
    Signed-off-by: Nathan Chancellor
    Acked-by: Tyrel Datwyler
    Signed-off-by: Martin K. Petersen

    Nathan Chancellor
     
  • After a successful SRP login response we call scsi_unblock_requests() to
    kick any pending IOs. The callback to process this SRP response happens in
    a tasklet and therefore is in softirq context. The result of such is that
    when blk-mq is enabled, it is no longer safe to call scsi_unblock_requests()
    from this context. The result of duing so triggers the following WARN_ON
    splat in dmesg after a host reset or CRQ reenablement.

    WARNING: CPU: 0 PID: 0 at block/blk-mq.c:1375 __blk_mq_run_hw_queue+0x120/0x180
    Modules linked in:
    CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.0.0-rc8 #4
    NIP [c0000000009771e0] __blk_mq_run_hw_queue+0x120/0x180
    LR [c000000000977484] __blk_mq_delay_run_hw_queue+0x244/0x250
    Call Trace:

    __blk_mq_delay_run_hw_queue+0x244/0x250
    blk_mq_run_hw_queue+0x8c/0x1c0
    blk_mq_run_hw_queues+0x60/0x90
    scsi_run_queue+0x1e4/0x3b0
    scsi_run_host_queues+0x48/0x80
    login_rsp+0xb0/0x100
    ibmvscsi_handle_crq+0x30c/0x3e0
    ibmvscsi_task+0x54/0xe0
    tasklet_action_common.isra.3+0xc4/0x1a0
    __do_softirq+0x174/0x3f4
    irq_exit+0xf0/0x120
    __do_irq+0xb0/0x210
    call_do_irq+0x14/0x24
    do_IRQ+0x9c/0x130
    hardware_interrupt_common+0x14c/0x150

    This patch fixes the issue by introducing a new host action for unblocking
    the scsi requests in our seperate work thread.

    Signed-off-by: Tyrel Datwyler
    Signed-off-by: Martin K. Petersen

    Tyrel Datwyler
     
  • The current implemenation relies on two flags in the driver's private host
    structure to signal the need for a host reset or to reenable the CRQ after
    a LPAR migration. This patch does away with those flags and introduces a
    single action flag and defined enums for the supported kthread work
    actions. Lastly, the if/else logic is replaced with a switch statement.

    Signed-off-by: Tyrel Datwyler
    Signed-off-by: Martin K. Petersen

    Tyrel Datwyler
     
  • Wire up the host_reset function in our driver_template to allow a user
    requested adpater reset via the host_reset sysfs attribute.

    Example:

    echo "adapter" > /sys/class/scsi_host/host0/host_reset

    Signed-off-by: Tyrel Datwyler
    Signed-off-by: Martin K. Petersen

    Tyrel Datwyler
     

31 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation either version 2 of the license or at
    your option any later version this program is distributed in the
    hope that it will be useful but without any warranty without even
    the implied warranty of merchantability or fitness for a particular
    purpose see the gnu general public license for more details you
    should have received a copy of the gnu general public license along
    with this program if not write to the free software foundation inc
    59 temple place suite 330 boston ma 02111 1307 usa

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

    has been chosen to replace the boilerplate/reference in 1334 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Reviewed-by: Richard Fontana
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190527070033.113240726@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

21 May, 2019

1 commit


28 Mar, 2019

4 commits

  • No change to functionality. Simply make transport event messages a little
    clearer, and rework CRQ format enums such that we have separate enums for
    INIT messages and XPORT events.

    [mkp: typo]

    Signed-off-by: Tyrel Datwyler
    Signed-off-by: Martin K. Petersen

    Tyrel Datwyler
     
  • Status and error codes are returned in big endian from the VIOS. The values
    are translated into a human readable format when logged, but the values are
    also logged. This patch byte swaps those values so that they are consistent
    between BE and LE platforms.

    Signed-off-by: Tyrel Datwyler
    Signed-off-by: Martin K. Petersen

    Tyrel Datwyler
     
  • The VIOS uses the SCSI_ERROR class to report PRLI failures. These errors
    are indicated with the combination of a IBMVFC_FC_SCSI_ERROR return status
    and 0x8000 error code. Add these codes to cmd_status[] with appropriate
    human readable error message.

    Signed-off-by: Tyrel Datwyler
    Signed-off-by: Martin K. Petersen

    Tyrel Datwyler
     
  • The text of messages logged with ibmvfc_log_error() always contain the term
    "failed". In the case of cancelled commands during EH they are reported
    back by the VIOS using error codes. This can be confusing to somebody
    looking at these log messages as to whether a command was successfully
    cancelled. The following real log message for example it is unclear if the
    transaction was actaully cancelled.

    sd 0:0:1:1: Cancelling outstanding commands.
    sd 0:0:1:1: [sde] Command (28) failed: transaction cancelled (2:6) flags: 0 fcp_rsp: 0, resid=0, scsi_status: 0

    Remove prefixing of "failed" to all error logged messages. The
    ibmvfc_log_error() function translates the returned error/status codes to a
    human readable message already.

    Signed-off-by: Tyrel Datwyler
    Signed-off-by: Martin K. Petersen

    Tyrel Datwyler
     

21 Mar, 2019

2 commits

  • The event pool used for queueing commands is destroyed fairly early in the
    ibmvscsi_remove() code path. Since, this happens prior to the call so
    scsi_remove_host() it is possible for further calls to queuecommand to be
    processed which manifest as a panic due to a NULL pointer dereference as
    seen here:

    PANIC: "Unable to handle kernel paging request for data at address
    0x00000000"

    Context process backtrace:

    DSISR: 0000000042000000 ????Syscall Result: 0000000000000000
    4 [c000000002cb3820] memcpy_power7 at c000000000064204
    [Link Register] [c000000002cb3820] ibmvscsi_send_srp_event at d000000003ed14a4
    5 [c000000002cb3920] ibmvscsi_send_srp_event at d000000003ed14a4 [ibmvscsi] ?(unreliable)
    6 [c000000002cb39c0] ibmvscsi_queuecommand at d000000003ed2388 [ibmvscsi]
    7 [c000000002cb3a70] scsi_dispatch_cmd at d00000000395c2d8 [scsi_mod]
    8 [c000000002cb3af0] scsi_request_fn at d00000000395ef88 [scsi_mod]
    9 [c000000002cb3be0] __blk_run_queue at c000000000429860
    10 [c000000002cb3c10] blk_delay_work at c00000000042a0ec
    11 [c000000002cb3c40] process_one_work at c0000000000dac30
    12 [c000000002cb3cd0] worker_thread at c0000000000db110
    13 [c000000002cb3d80] kthread at c0000000000e3378
    14 [c000000002cb3e30] ret_from_kernel_thread at c00000000000982c

    The kernel buffer log is overfilled with this log:

    [11261.952732] ibmvscsi: found no event struct in pool!

    This patch reorders the operations during host teardown. Start by calling
    the SRP transport and Scsi_Host remove functions to flush any outstanding
    work and set the host offline. LLDD teardown follows including destruction
    of the event pool, freeing the Command Response Queue (CRQ), and unmapping
    any persistent buffers. The event pool destruction is protected by the
    scsi_host lock, and the pool is purged prior of any requests for which we
    never received a response. Finally, move the removal of the scsi host from
    our global list to the end so that the host is easily locatable for
    debugging purposes during teardown.

    Cc: # v2.6.12+
    Signed-off-by: Tyrel Datwyler
    Signed-off-by: Martin K. Petersen

    Tyrel Datwyler
     
  • For each ibmvscsi host created during a probe or destroyed during a remove
    we either add or remove that host to/from the global ibmvscsi_head
    list. This runs the risk of concurrent modification.

    This patch adds a simple spinlock around the list modification calls to
    prevent concurrent updates as is done similarly in the ibmvfc driver and
    ipr driver.

    Fixes: 32d6e4b6e4ea ("scsi: ibmvscsi: add vscsi hosts to global list_head")
    Cc: # v4.10+
    Signed-off-by: Tyrel Datwyler
    Signed-off-by: Martin K. Petersen

    Tyrel Datwyler
     

19 Dec, 2018

1 commit

  • Most SCSI drivers want to enable "clustering", that is merging of
    segments so that they might span more than a single page. Remove the
    ENABLE_CLUSTERING define, and require drivers to explicitly set
    DISABLE_CLUSTERING to disable this feature.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Martin K. Petersen

    Christoph Hellwig
     

31 Jul, 2018

1 commit


03 Jul, 2018

1 commit

  • Currently an open firmware property is copied into partition_name variable
    without keeping a room for \0.

    Later one, this variable (partition_name), which is 97 bytes long, is
    strncpyed into ibmvcsci_host_data->madapter_info->partition_name, which is
    96 bytes long, possibly truncating it 'again' and removing the \0.

    This patch simply decreases the partition name to 96 and just copy using
    strlcpy() which guarantees that the string is \0 terminated. I think there
    is no issue if this there is a truncation in this very first copy, i.e,
    when the open firmware property is read and copied into the driver for the
    very first time;

    This issue also causes the following warning on GCC 8:

    drivers/scsi/ibmvscsi/ibmvscsi.c:281:2: warning: strncpy output may be truncated copying 96 bytes from a string of length 96 [-Wstringop-truncation]
    ...
    inlined from ibmvscsi_probe at drivers/scsi/ibmvscsi/ibmvscsi.c:2221:7:
    drivers/scsi/ibmvscsi/ibmvscsi.c:265:3: warning: strncpy specified bound 97 equals destination size [-Wstringop-truncation]

    CC: Bart Van Assche
    CC: Tyrel Datwyler
    Signed-off-by: Breno Leitao
    Acked-by: Tyrel Datwyler
    Signed-off-by: Martin K. Petersen

    Breno Leitao
     

20 Jun, 2018

1 commit


15 Mar, 2018

1 commit

  • Following an RSCN, ibmvfc will issue an ADISC to determine if the
    underlying target has changed, comparing the SCSI ID, WWPN, and WWNN to
    determine how to handle the rport in discovery. However, the comparison
    of the WWPN and WWNN was performing a memcmp between a big endian field
    against a CPU endian field, which resulted in the wrong answer on LE
    systems. This was observed as unexpected errors getting logged at boot
    time as targets were getting relogins when not needed.

    Signed-off-by: Brian King
    Signed-off-by: Martin K. Petersen

    Brian King
     

31 Jan, 2018

1 commit

  • The fcp_rsp_info structure as defined in the FC spec has an initial 3
    bytes reserved field. The ibmvfc driver mistakenly defined this field as
    4 bytes resulting in the rsp_code field being defined in what should be
    the start of the second reserved field and thus always being reported as
    zero by the driver.

    Ideally, we should wire ibmvfc up with libfc for the sake of code
    deduplication, and ease of maintaining standardized structures in a
    single place. However, for now simply fixup the definition in ibmvfc for
    backporting to distros on older kernels. Wiring up with libfc will be
    done in a followup patch.

    Cc:
    Reported-by: Hannes Reinecke
    Signed-off-by: Tyrel Datwyler
    Signed-off-by: Martin K. Petersen

    Tyrel Datwyler
     

23 Jan, 2018

1 commit


02 Nov, 2017

1 commit

  • In preparation for unconditionally passing the struct timer_list pointer to
    all timer callbacks, switch to using the new timer_setup() and from_timer()
    to pass the timer pointer explicitly.

    Cc: "Martin K. Petersen"
    Cc: Tyrel Datwyler
    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Cc: Michael Ellerman
    Cc: "James E.J. Bottomley"
    Cc: linux-scsi@vger.kernel.org
    Cc: linuxppc-dev@lists.ozlabs.org
    Signed-off-by: Kees Cook
    Reviewed-by: Martin K. Petersen
    Acked-by: Tyrel Datwyler

    Kees Cook
     

26 Aug, 2017

2 commits


02 Jul, 2017

2 commits

  • dev_pm_ops are not supposed to change at runtime. All functions
    working with dev_pm_ops provided by work with const
    dev_pm_ops. So mark the non-const structs as const.

    File size before:
    text data bss dec hex filename
    41937 1296 20 43253 a8f5 drivers/scsi/ibmvscsi/ibmvfc.o

    File size After adding 'const':
    text data bss dec hex filename
    42129 1104 20 43253 a8f5 drivers/scsi/ibmvscsi/ibmvfc.o

    Signed-off-by: Arvind Yadav
    Acked-by: Tyrel Datwyler
    Signed-off-by: Martin K. Petersen

    Arvind Yadav
     
  • dev_pm_ops are not supposed to change at runtime. All functions working
    with dev_pm_ops provided by work with const
    dev_pm_ops. So mark the non-const structs as const.

    File size before:
    text data bss dec hex filename
    17956 1456 8 19420 4bdc drivers/scsi/ibmvscsi/ibmvscsi.o

    File size After adding 'const':
    text data bss dec hex filename
    18164 1264 8 19436 4bec drivers/scsi/ibmvscsi/ibmvscsi.o

    Signed-off-by: Arvind Yadav
    Acked-by: Tyrel Datwyler
    Signed-off-by: Martin K. Petersen

    Arvind Yadav
     

19 Apr, 2017

1 commit


07 Feb, 2017

1 commit

  • Instead define the timeout behavior purely based on the host_template
    eh_timed_out method and wire up the existing transport implementations
    in the host templates. This also clears up the confusion that the
    transport template method overrides the host template one, so some
    drivers have to re-override the transport template one.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Hannes Reinecke
    Reviewed-by: Tyrel Datwyler
    Signed-off-by: Martin K. Petersen

    Christoph Hellwig
     

09 Dec, 2016

3 commits

  • The first byte of each CRQ entry is used to indicate whether an entry is
    a valid response or free for the VIOS to use. After processing a
    response the driver sets the valid byte to zero to indicate the entry is
    now free to be reused. Add a memory barrier after this write to ensure
    no other stores are reordered when updating the valid byte.

    Signed-off-by: Tyrel Datwyler
    Reviewed-by: Brian King
    Signed-off-by: Martin K. Petersen

    Tyrel Datwyler
     
  • An unrecogonized or unsupported SRP response has its opcode currently
    logged in decimal format. Log it in hex format instead so it can easily
    be validated against the SRP specs values which are in hex.

    Signed-off-by: Tyrel Datwyler
    Reviewed-by: Johannes Thumshirn
    Signed-off-by: Martin K. Petersen

    Tyrel Datwyler
     
  • Add each vscsi host adatper to a new global list_head named
    ibmvscsi_head. There is no functional change. This is meant primarily as
    a convience for locating adapters from within the debugger or crash
    utility.

    [mkp: fixed typo]

    Signed-off-by: Tyrel Datwyler
    Reviewed-by: Johannes Thumshirn
    Signed-off-by: Martin K. Petersen

    Tyrel Datwyler
     

18 Nov, 2016

5 commits

  • fc_bsg_jobdone() and bsg_job_done() are 1:1 copies now so use the
    bsg-lib one instead of the FC private implementation.

    Signed-off-by: Johannes Thumshirn
    Reviewed-by: Hannes Reinecke
    Acked-by: Tyrel Datwyler
    Signed-off-by: Martin K. Petersen

    Johannes Thumshirn
     
  • Change FC drivers to use 'struct bsg_job' from bsg-lib.h instead of
    'struct fc_bsg_job' from scsi_transport_fc.h and remove 'struct
    fc_bsg_job'.

    Signed-off-by: Johannes Thumshirn
    Reviewed-by: Hannes Reinecke
    Acked-by: Tyrel Datwyler
    Signed-off-by: Martin K. Petersen

    Johannes Thumshirn
     
  • Provide fc_bsg_to_rport() helper that will become handy when we're
    moving from struct fc_bsg_job to a plain struct bsg_job. Also move all
    LLDDs to use the new helper.

    Signed-off-by: Johannes Thumshirn
    Reviewed-by: Hannes Reinecke
    Acked-by: Tyrel Datwyler
    Signed-off-by: Martin K. Petersen

    Johannes Thumshirn
     
  • Provide fc_bsg_to_shost() helper that will become handy when we're
    moving from struct fc_bsg_job to a plain struct bsg_job. Also use this
    little helper in the LLDDs.

    Signed-off-by: Johannes Thumshirn
    Reviewed-by: Hannes Reinecke
    Acked-by: Tyrel Datwyler
    Signed-off-by: Martin K. Petersen

    Johannes Thumshirn
     
  • Export fc_bsg_jobdone so drivers can use it directly instead of doing
    the round-trip via struct fc_bsg_job::job_done() and use it in the
    LLDDs. That way we can also unify the interfaces of fc_bsg_jobdone and
    bsg_job_done.

    As we've converted all LLDDs over to use fc_bsg_jobdone() directly, we
    can remove the function pointer from struct fc_bsg_job as well.

    Signed-off-by: Johannes Thumshirn
    Reviewed-by: Hannes Reinecke
    Reviewed-by: Christoph Hellwig
    Acked-by: Tyrel Datwyler
    Signed-off-by: Martin K. Petersen

    Johannes Thumshirn