lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Fri, 1 Nov 2019 12:14:25 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     Akinobu Mita <akinobu.mita@...il.com>
Cc:     Keith Busch <kbusch@...nel.org>, Chris Healy <cphealy@...il.com>,
        Jens Axboe <axboe@...com>, Christoph Hellwig <hch@....de>,
        Sagi Grimberg <sagi@...mberg.me>,
        LKML <linux-kernel@...r.kernel.org>,
        linux-nvme@...ts.infradead.org, Linux PM <linux-pm@...r.kernel.org>
Subject: Re: [PATCH v3] nvme: Add hardware monitoring support

On Sat, Nov 02, 2019 at 01:19:03AM +0900, Akinobu Mita wrote:
> 2019年11月1日(金) 12:56 Guenter Roeck <linux@...ck-us.net>:
> > +void nvme_hwmon_init(struct nvme_ctrl *ctrl)
> > +{
> > +       struct device *dev = ctrl->device;
> 
> Should we use 'ctrl->dev' instead of 'ctrl->device'?
> 

Excellent point, and most definitely yes. I should have done that
from the beginning.

> The 'ctrl->device' is a pointer to char device and the '->of_node' member
> is NULL.
> 
> So if devm_hwmon_device_register_with_info() (i.e. __hwmon_device_register)
> is called with 'ctrl->device', it doesn't attempt to register a sensor to a
> DT thermal zone (i.e. hwmon_thermal_add_sensor() is not called at all).
> 
> This change was required, when I tried this nvme hwmon patch with the
> following DT thermal setup.
> 
> https://lore.kernel.org/linux-devicetree/1561990354-4084-3-git-send-email-akinobu.mita@gmail.com/
> 
> > +       struct nvme_hwmon_data *data;
> > +       struct device *hwmon;
> > +       int err;
> > +
> > +       data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
> > +       if (!data)
> > +               return;
> > +
> > +       data->ctrl = ctrl;
> > +       mutex_init(&data->read_lock);
> > +
> > +       err = nvme_hwmon_get_smart_log(data);
> > +       if (err) {
> > +               dev_warn(dev, "Failed to read smart log (error %d)\n", err);
> > +               devm_kfree(dev, data);
> > +               return;
> > +       }
> > +
> > +       hwmon = devm_hwmon_device_register_with_info(dev, dev_name(dev), data,
> > +                                                    &nvme_hwmon_chip_info,
> > +                                                    NULL);
> 
> If the above change is applied, the second 'name' argument is changed
> from 'nvme0' to '0000:01:00.0' as a side effect.  So we may want to
> change the second argument, too.
> 

Yes. I'll just name it "nvme"; after all, that is sufficient and more
consistent with other drivers. Currently, we get something like
	nvme0-pci-0100
	nvme1-pci-2500
if there are multiple drives, where the "0" and "1" are not really
necessary.

Thanks!
Guenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ