Re: [PATCH v2 0/3] scsi: mpi3mr: Fix error return, start_time, and timeout check in mpi3mr_bring_ioc_ready()

From: Laurence Oberman

Date: Fri Nov 20 2026 - 15:30:55 EST


On Fri, 2026-11-20 at 11:00 -0800, Ian Rogers wrote:
> Split the mpi3mr_bring_ioc_ready() error-handling and retry fixes
> into
> three independent patches with individual Fixes: tags as requested by
> Laurence Oberman:
>
> 1. Return -1 instead of 0 on failure exits in
> mpi3mr_bring_ioc_ready()
>    when retval is 0 (such as unrecoverable controller faults, hot-
> unplug
>    during reset/diag-save waits, or ready-state faults and timeouts
>    after mpi3mr_setup_admin_qpair() sets retval = 0).
> 2. Initialize start_time = jiffies on entry and guard the post-enable
>    timestamp reset with a boolean flag so pre-enable failures and
>    subsequent retries never read an uninitialized start_time.
> 3. Rewrite 'elapsed_time_sec < (mrioc->ready_timeout - 60)' as
>    'elapsed_time_sec + 60 < mrioc->ready_timeout' to avoid 32-bit
>    unsigned underflow if a controller reports ready_timeout < 60.
>
> v2:
>   - Split v1 into three patches, each with its own Fixes: tag
> (Laurence
>     Oberman).
>   - Move 'if (!retval) retval = -1;' to 'out_device_not_present:' in
>     patch 1 so a single hunk covers both out_failed fallthroughs and
>     early out_device_not_present jumps cleanly for stable backports.
>   - Add Laurence's Reviewed-by tag on patches 1 and 2, and note the
>     510s (570s - 60s) firmware timeout math from commit 9634bb07083c
> in
>     patch 3.
>
> v1:
> https://lore.kernel.org/r/20261119170900.1530138-1-irogers@xxxxxxxxxx
>
> Ian Rogers (3):
>   scsi: mpi3mr: Return error on all failure exits in
>     mpi3mr_bring_ioc_ready()
>   scsi: mpi3mr: Initialize start_time on all paths in
>     mpi3mr_bring_ioc_ready()
>   scsi: mpi3mr: Avoid ready_timeout underflow in
>     mpi3mr_bring_ioc_ready()
>
>  drivers/scsi/mpi3mr/mpi3mr_fw.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)

Hello Ian

Thanks for the quick v2. Tested the series on 7.4.0-rc1 with a
Broadcom SAS40xx/41xx (FW 8.5.1.0.0.1), two SAS disks attached.

Firmware advertises "ready timeout: 510 seconds" (ioc_info
0xff000000), before and after the series.

Tests, all with mpi3mr_bring_ioc_ready() reaching ready on the first
attempt and no "retrying to bring IOC ready" or "failed to bring"
messages:

- boot probe
- modprobe -r / modprobe (mpi3mr_init_ioc path)
- sg_reset -H under fio 4k randread QD32 (mpi3mr_reinit_ioc path);
host reset completed in ~45s including diag save and port enable,
fio completed with no errors
- PCI remove/rescan of the controller
- 20 iterations of reload + host reset under fio: 40 successful
ready transitions, no retries, no failures, no fio errors

The failure paths themselves were not exercised, as they are hard to
trigger on healthy hardware; this confirms no regression on the good
path.

Minor, 3/3 changelog: the IOC info timeout field is 8 bits in 2s
units, so ready_timeout tops out at 510s and the retry window at 450s;
the "510 seconds" in 9634bb07083c most likely refers to the maximum
ready timeout rather than the retry cap, so 570s cannot be advertised.
Doesn't affect the code change. Martin may be able to fix it up on
apply.

The question to Broadcom on firmware advertising ready_timeout < 60
is still open for 3/3; on this controller it makes no difference.

For the series:

Tested-by: Laurence Oberman <loberman@xxxxxxxxxx>

Regards
Laurence