Re: [PATCH] Add support for PCIe SSD status LED management

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 5/5/2021 11:12 AM, Keith Busch wrote:
On Fri, Apr 16, 2021 at 03:20:10PM -0400, Stuart Hayes wrote:
This patch adds support for the PCIe SSD Status LED Management
interface, as described in the "_DSM Additions for PCIe SSD Status LED
Management" ECN to the PCI Firmware Specification revision 3.2.

It will add a single (led_classdev) LED for any PCIe device that has the
relevant _DSM. The ten possible status states are exposed using
attributes current_states and supported_states. Reading current_states
(and supported_states) will show the definition and value of each bit:

There is significant overlap in this ECN with the PCIe native enclosure
management (NPEM) capability. Would it be possible for the sysfs
interface to provide an abstraction such that both these implementations
could subscribe to?

It wouldn't be too hard to check for the NPEM capability here and provide access to it as well using the same LED interface, especially since the state bits are the same. The module could just check for NPEM capability at the same time it is checking for the _DSM. I guess that could be added on later without too much trouble, too... I don't think anything about the interface would have to change to add support for NPEM.

FWIW, it looks like NPEM support is already supported in user space in ledmon. (I only wrote a kernel module for this, because it uses a _DSM which can't readily be accessed in user space.)


On 5/5/2021 9:46 PM, Krzysztof Wilczyński wrote:
Hi Keith,

cat /sys/class/leds/0000:88:00.0::pcie_ssd_status/supported_states
ok                              0x0004 [ ]
locate                          0x0008 [*]
fail                            0x0010 [ ]
rebuild                         0x0020 [ ]
pfa                             0x0040 [ ]
hotspare                        0x0080 [ ]
criticalarray                   0x0100 [ ]
failedarray                     0x0200 [ ]
invaliddevice                   0x0400 [ ]
disabled                        0x0800 [ ]
--
supported_states = 0x0008

cat /sys/class/leds/0000:88:00.0::pcie_ssd_status/current_states
locate                          0x0008 [ ]

As per what Keith already noted, this is a very elaborate output as far
as sysfs goes - very human-readable, but it would be complex to parse
should some software would be interested in showing this values in a way
or another.

I would propose output similar to this one:

   $ cat /sys/block/sda/queue/scheduler
   mq-deadline-nodefault [bfq] none

If you prefer to show the end-user a string, rather than a numeric
value.  This approach could support both the supported and current
states (similarly to how it works for the I/O scheduler), thus there
would be no need to duplicate the code between the two attributes.

What do you think?

Some enclosures may support just one blinky state at a time. Other
implementations might have multiple LEDs and colors, so you could, for
example, "locate" something that is also "failed", with both states
visible simultaneously. You could capture the current states with the
"scheduler" type display, but setting new states may be more
complicated.

Ah, excellent point.  I didn't think about this - the use-case you
provided.  This would, indeed, be far more complex to deal with when
accepting a write.  I can see why Stuart did it the way he did
currently.

Krzysztof


I copied the format of this output from acpi_debug_level / acpi_debug_layer in drivers/acpi/sysfs.c. I thought it might be reasonably easy enough for a machine to parse this for the number, since it is always on the last line and always immediately following the only "=".

I don't object to using just a number, but I submitted an earlier version of this some months ago (which didn't use the LED subsystem) which only had the number, and Bjorn commented that decoding that was a bit of a pain, and that the PCI specs (which contain the bit definitions) isn't public. I guess I could just add the definitions in the documentation if this is too verbose for sysfs.



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux