Bug 261377 - mrsas: if controller reset is in progress, refrain from firing DCMDs to firmware from shutdown context
Summary: mrsas: if controller reset is in progress, refrain from firing DCMDs to firm...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 13.0-RELEASE
Hardware: amd64 Any
: --- Affects Many People
Assignee: Warner Losh
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-01-21 13:16 UTC by Chandrakanth Patil
Modified: 2023-12-28 11:31 UTC (History)
6 users (show)

See Also:


Attachments
refrain firing DCMDs if controller reset is in progress (1.21 KB, application/mbox)
2022-01-21 13:16 UTC, Chandrakanth Patil
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Chandrakanth Patil 2022-01-21 13:16:57 UTC
Created attachment 231210 [details]
refrain firing DCMDs if controller reset is in progress

When controller reset is in progress, a few of the firmware registers are in-accessible state so if drivers access any of those registers at that time will result in undefined behaviour in firmware.

In this case, controller reset is in progress, and system shutdown is issued, then the shutdown function in the driver will be invoked where it is waiting for a max of 15 sec for a reset to finish and if reset is not finished within that time frame then it is going ahead and firing the flush cache and shutdown DCMDs to firmware which will end up accessing the queues which are not initialised due to undergoing reset leads to FMU error in firmware

So fix is to return to OS with proper error from shutdown if controller reset is not finished after waiting 15 sec.

I have attached the patch which will fix this issue. 

This issue is applicable to variants: 13.0, 13.1, 12.3, 12.1
If possible we can back-port other required variants.
Comment 1 Chandrakanth Patil 2022-04-04 07:11:39 UTC
Please review this patch. It needs to be included in the upcoming release.
Comment 2 Warner Losh freebsd_committer freebsd_triage 2022-04-05 14:23:14 UTC
I think this patch is in error, though the error is likely mostly harmless.

mrsas_shutdown is a newbus routine, so it should not be returning FAIL, but an errno from errno.h. FAIL happens to be 1, which EPERM which isn't quite right. Other drivers in the tree, however, return 0 in similar circumstances.

Having said that, however, the return value is completely ignored, so this mismatch isn't a problem.
Comment 3 commit-hook freebsd_committer freebsd_triage 2022-04-05 14:38:33 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=241bb95552a39d440519162b544c776adcb7cf57

commit 241bb95552a39d440519162b544c776adcb7cf57
Author:     Chandrakanth Patil <chandrakanth.patil@broadcom.com>
AuthorDate: 2022-01-21 12:11:49 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-04-05 14:38:14 +0000

    mrsas: remove additional MPT command allocation for R1 FP command

    There is an additional MPT command allocation for R1 fp command which
    will lead to MPT command unavailablity in case of rigorous R1 FP IOs.

    Remove additional MPT command allocation for R1 FP.

    Reviewed by: imp
    PR: 261377

 sys/dev/mrsas/mrsas_cam.c | 1 -
 1 file changed, 1 deletion(-)
Comment 4 Warner Losh freebsd_committer freebsd_triage 2022-04-05 14:53:15 UTC
Looks like I tagged the wrong bug number for this commit (I swapped the two, dangit)


URL: https://cgit.FreeBSD.org/src/commit/?id=79c4c4be9618470711480f46ef2cd3a15c00cdd2
Comment 5 commit-hook freebsd_committer freebsd_triage 2022-04-06 16:27:43 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=2ebe51859723fd3cb4cf02dc560441fc0ec50dc1

commit 2ebe51859723fd3cb4cf02dc560441fc0ec50dc1
Author:     Chandrakanth Patil <chandrakanth.patil@broadcom.com>
AuthorDate: 2022-01-21 12:11:49 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-04-06 16:27:25 +0000

    mrsas: remove additional MPT command allocation for R1 FP command

    There is an additional MPT command allocation for R1 fp command which
    will lead to MPT command unavailablity in case of rigorous R1 FP IOs.

    Remove additional MPT command allocation for R1 FP.

    Reviewed by: imp
    PR: 261377

    (cherry picked from commit 241bb95552a39d440519162b544c776adcb7cf57)

 sys/dev/mrsas/mrsas_cam.c | 1 -
 1 file changed, 1 deletion(-)
Comment 6 commit-hook freebsd_committer freebsd_triage 2022-04-06 17:47:00 UTC
A commit in branch releng/13.1 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=cf523b815c780f741b5f4b7d1cd1258d0118ad1f

commit cf523b815c780f741b5f4b7d1cd1258d0118ad1f
Author:     Chandrakanth Patil <chandrakanth.patil@broadcom.com>
AuthorDate: 2022-01-21 12:11:49 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-04-06 17:45:50 +0000

    mrsas: remove additional MPT command allocation for R1 FP command

    There is an additional MPT command allocation for R1 fp command which
    will lead to MPT command unavailablity in case of rigorous R1 FP IOs.

    Remove additional MPT command allocation for R1 FP.

    Approved by: re@ (gjb)
    Reviewed by: imp
    PR: 261377

    (cherry picked from commit 241bb95552a39d440519162b544c776adcb7cf57)
    (cherry picked from commit 2ebe51859723fd3cb4cf02dc560441fc0ec50dc1)

 sys/dev/mrsas/mrsas_cam.c | 1 -
 1 file changed, 1 deletion(-)
Comment 7 Mark Linimon freebsd_committer freebsd_triage 2023-12-28 11:31:44 UTC
^Triage: assign to committer who also MFCed.