Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: kbusch@kernel.org (Keith Busch)
Subject: [PATCH v2 2/4] nvme: add thermal zone infrastructure
Date: Wed, 22 May 2019 09:44:48 -0600	[thread overview]
Message-ID: <20190522154448.GA5393@localhost.localdomain> (raw)
In-Reply-To: <CAC5umyi4t-r+0WbGjfa=_6ym_n=vcx5855nwL6NxuXH_HhYXkA@mail.gmail.com>

On Thu, May 23, 2019@12:44:04AM +0900, Akinobu Mita wrote:
> 2019?5?22?(?) 1:20 Keith Busch <kbusch at kernel.org>:
> >
> > On Wed, May 22, 2019@01:04:07AM +0900, Akinobu Mita wrote:
> > > +int nvme_thermal_zones_register(struct nvme_ctrl *ctrl)
> > > +{
> > > +     struct nvme_smart_log *log;
> > > +     int ret;
> > > +     int i;
> > > +
> > > +     log = kzalloc(sizeof(*log), GFP_KERNEL);
> > > +     if (!log)
> > > +             return 0; /* non-fatal error */
> > > +
> > > +     ret = nvme_get_log(ctrl, NVME_NSID_ALL, NVME_LOG_SMART, 0,
> > > +                        log, sizeof(*log), 0);
> > > +     if (ret) {
> > > +             dev_err(ctrl->device, "Failed to get SMART log: %d\n", ret);
> > > +             ret = ret > 0 ? -EINVAL : ret;
> >
> > A ret > 0 means the device provided a response, so don't return a
> > negative for that condition, please. That's just going to break
> > controllers that don't provide smart data, like qemu.
> 
> After looking at __nvme_submit_sync_cmd(), it returns -EINTR if the device
> doesn't respond.  So, should this return a negative only when nvme_get_log()
> returns -EINTR?
> 
>         ret = nvme_get_log();
>         if (ret) {
>                 dev_err(...);
>                 if (ret != -EINTR)
>                         ret = 0;
>                 goto free_log;
>         }

We return a different negative error if we can't allocate a request,
like what happens if the controller is dead, like a surprise hot remove.

There's a simpler way to look at this: if ret >= 0, we may proceed,
otherwise we're done with this controller. Don't make it any more
complicated than that.

  reply	other threads:[~2019-05-22 15:44 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-21 16:04 [PATCH v2 0/4] nvme: add thermal zone devices Akinobu Mita
2019-05-21 16:04 ` [PATCH v2 1/4] nvme: Export get and set features Akinobu Mita
2019-05-21 17:23   ` Chaitanya Kulkarni
2019-05-22 15:24     ` Akinobu Mita
2019-05-21 16:04 ` [PATCH v2 2/4] nvme: add thermal zone infrastructure Akinobu Mita
2019-05-21 16:15   ` Keith Busch
2019-05-22 15:44     ` Akinobu Mita
2019-05-22 15:44       ` Keith Busch [this message]
2019-05-22 15:52         ` Akinobu Mita
2019-05-21 21:05   ` Heitke, Kenneth
2019-05-22 15:23     ` Akinobu Mita
2019-05-24  2:35   ` Eduardo Valentin
2019-05-24 13:57     ` Akinobu Mita
2019-06-03  2:18       ` Eduardo Valentin
2019-06-03 15:03         ` Akinobu Mita
2019-05-21 16:04 ` [PATCH v2 3/4] nvme: notify thermal framework when temperature threshold events occur Akinobu Mita
2019-05-21 16:04 ` [PATCH v2 4/4] nvme-pci: support thermal zone Akinobu Mita
2019-05-22 17:46   ` Christoph Hellwig
2019-05-23 14:21     ` Akinobu Mita

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190522154448.GA5393@localhost.localdomain \
    --to=kbusch@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox