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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAC5umyiJT300+MunDi4wwwAgSxiqx7_rersbNRvybcNoo3kGDg@mail.gmail.com>
Date:   Wed, 6 Nov 2019 00:44:56 +0900
From:   Akinobu Mita <akinobu.mita@...il.com>
To:     Guenter Roeck <linux@...ck-us.net>
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 v4] nvme: Add hardware monitoring support

2019年11月6日(水) 0:38 Akinobu Mita <akinobu.mita@...il.com>:
>
> 2019年11月2日(土) 23:55 Guenter Roeck <linux@...ck-us.net>:
> > diff --git a/drivers/nvme/host/nvme-hwmon.c b/drivers/nvme/host/nvme-hwmon.c
> > new file mode 100644
> > index 000000000000..28b4b7f43bb0
> > --- /dev/null
> > +++ b/drivers/nvme/host/nvme-hwmon.c
> > @@ -0,0 +1,181 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * NVM Express hardware monitoring support
> > + * Copyright (c) 2019, Guenter Roeck
> > + */
> > +
> > +#include <linux/hwmon.h>
> > +#include <asm/unaligned.h>
> > +
> > +#include "nvme.h"
> > +
> > +struct nvme_hwmon_data {
> > +       struct nvme_ctrl *ctrl;
> > +       struct nvme_smart_log log;
> > +       struct mutex read_lock;
> > +};
> > +
> > +static int nvme_hwmon_get_smart_log(struct nvme_hwmon_data *data)
> > +{
> > +       int ret;
> > +
> > +       ret = nvme_get_log(data->ctrl, NVME_NSID_ALL, NVME_LOG_SMART, 0,
> > +                          &data->log, sizeof(data->log), 0);
> > +
> > +       return ret <= 0 ? ret : -EIO;
> > +}
> > +
> > +static int nvme_hwmon_read(struct device *dev, enum hwmon_sensor_types type,
> > +                          u32 attr, int channel, long *val)
> > +{
> > +       struct nvme_hwmon_data *data = dev_get_drvdata(dev);
> > +       struct nvme_smart_log *log = &data->log;
> > +       int temp;
> > +       int err;
> > +
> > +       /*
> > +        * First handle attributes which don't require us to read
> > +        * the smart log.
> > +        */
> > +       switch (attr) {
> > +       case hwmon_temp_max:
> > +               *val = (data->ctrl->wctemp - 273) * 1000;
> > +               return 0;
> > +       case hwmon_temp_crit:
> > +               *val = (data->ctrl->cctemp - 273) * 1000;
>
> This attribute should be 'hwmon_temp_max_alarm' rather than
> 'hwmon_temp_crit_alarm'?

Oops, I misquoted the code.

This comment should be addressed to the code below:

+       case hwmon_temp_crit_alarm:
+               *val = !!(log->critical_warning & NVME_SMART_CRIT_TEMPERATURE);
+               break;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ