[PATCH V2 1/1] nvme: Add verbose error logging
Alan Adamson
alan.adamson at oracle.com
Tue Jan 4 10:18:27 PST 2022
> On Dec 27, 2021, at 8:07 AM, Keith Busch <kbusch at kernel.org> wrote:
>
> On Thu, Dec 23, 2021 at 01:57:26PM -0800, Alan Adamson wrote:
>> +
>> +static const char * const nvme_errors[] = {
>> + "Success",
>> + "Invalid Command Opcode",
>> + "Invalid Field in Command",
>> + "Command ID Conflict",
>> + "Data Transfer Error",
>> + "Commands Aborted due to Power Loss Notification",
>> + "Internal Error",
>> + "Command Abort Requested",
>> + "Command Aborted due to SQ Deletion",
>> + "Command Aborted due to Failed Fused Command",
>> + "Command Aborted due to Missing Fused Command",
>> + "Invalid Namespace or Format",
>> + "Command Sequence Error",
>> + "Invalid SGL Segment Descriptor",
>> + "Invalid Number of SGL Descriptors",
>> + "Data SGL Length Invalid",
>> + "Metadata SGL Length Invalid",
>> + "SGL Descriptor Type Invalid",
>> + "Invalid Use of Controller Memory Buffer",
>> + "PRP Offset Invalid",
>> + "Atomic Write Unit Exceeded",
>> + "Operation Denied",
>> + "SGL Offset Invalid",
>> + "Reserved",
>> + "Host Identifier Inconsistent Format",
>> + "Keep Alive Timeout Expired",
>> + "Keep Alive Timeout Invalid",
>> + "Command Aborted due to Preempt and Abort",
>> + "Sanitize Failed",
>> + "Sanitize In Progress",
>> + "SGL Data Block Granularity Invalid",
>> + "Command Not Supported for Queue in CMB",
>> + "Namespace is Write Protected",
>> + "Command Interrupted",
>> + "Transient Transport Error",
>> + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
>
> Tracking these NULL's is going to be problematic and error prone.
I don’t disagree, definitely wasn’t fun putting them in there:)
If we don’t define the NULLs, what happens if the hardware responds with a undefined error status?
We will attempt to log a undefined/non-string.
Alan
>
> I recommend indexing the strings as you define them. For example:
>
> static const char * const nvme_errors[] = {
> [NVME_SC_SUCCESS] = "Success",
> [NVME_SC_INVALID_OPCODE] = "Invalid Command Opcode",
>
> etc...
>
> Then you don't need to bother tracking the undefined indexes or making
> sure everything is in order.
More information about the Linux-nvme
mailing list