[PATCHv2] nvme/hwmon: rework to avoid devm allocation

Hannes Reinecke hare at suse.de
Tue Jan 19 14:07:46 EST 2021


On 1/19/21 3:56 PM, Guenter Roeck wrote:
> On Tue, Jan 19, 2021 at 07:43:18AM +0100, Hannes Reinecke wrote:
>> The original design to use device-managed resource allocation
>> doesn't really work as the NVMe controller has a vastly different
>> lifetime than the hwmon sysfs attributes, causing warning about
>> duplicate sysfs entries upon reconnection.
>> This patch reworks the hwmon allocation to avoid device-managed
>> resource allocation, and uses the NVMe controller as parent for
>> the sysfs attributes.
> 
> I don't really know enough about the nvme infrastructure to understand
> this part of the change. Couple of questions: Why is the parent change
> needed, and does the "sensors" command still work after this change ?
> 
Problem is that it's not really a 'new' infrastructure, it's 
NVMe-over-fabrics, which behaves slightly different from the PCI-based 
NVMe devices.
In particular we can and will have connectivity failures, requiring the 
controller to be reset or recreated.
And as the hwmon sysfs attributes were never removed correctly in the 
first place we're seeing these errors.
It isn't easily recreated on PCI devices as the sysfs attributes will 
only ever be removed on shutdown (or module unload).
So I fear the issue was with us since day-1.

As for the parent change: for fabrics the '->dev' device points to a 
static nvmf_device, which is identical for every fabrics controller.
So you really need to use the actual device in '->device' to have a 
different parent device for different controllers.
So for PCI that means that the 'hwmon' device moved one element down 
(from the PCI device to the nvme controller).
But shouldn't make much of a difference; I'll check on if 'sensors' 
continues to work.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare at suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer



More information about the Linux-nvme mailing list