Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: Tokunori Ikegami <ikegami.t@gmail.com>
Cc: linux-nvme@lists.infradead.org
Subject: Re: [PATCH] nvme-pci: add NVMe controller statistics
Date: Wed, 28 May 2025 14:35:07 -0600	[thread overview]
Message-ID: <aDdze52GrviTSmFj@kbusch-mbp> (raw)
In-Reply-To: <20250528170350.5514-1-ikegami.t@gmail.com>

On Thu, May 29, 2025 at 02:02:56AM +0900, Tokunori Ikegami wrote:
> +static ssize_t stats_show(struct device *dev, struct device_attribute *attr,
> +			  char *buf)
> +{
> +	struct nvme_ctrl *ctrl = dev_get_drvdata(dev);
> +	struct nvme_stats *stats = &ctrl->stats;
> +
> +	return sysfs_emit(buf,
> +			  "timeouts: %lu, aborts: %lu, resets: %lu, disables: %lu\n",
> +			  stats->timeouts, stats->aborts, stats->resets,
> +			  stats->disables);
> +}

Specifically on sysfs attributes, the intended use was one file, one
attribute, one value. That makes programatically parsing these much
easier. So what you'd do instead is create 4 new files called
"timeouts", "aborts", "resets", and "disables", and each just print out
a sinlge number instead of this more complex output. If you're concerned
with polluting the nvme device's sysfs directory, you can also make a
sub-directory called "stats" to collect such things.

That principle hasn't always been strictly followed, but let's not
introduce new deviants.

As to what you're tracking and reporting here, I'm not convinced it's
useful. It's just a snapshot of what's happened for the lifetime of that
instance, which may not be very long.


  reply	other threads:[~2025-05-28 20:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-28 17:02 [PATCH] nvme-pci: add NVMe controller statistics Tokunori Ikegami
2025-05-28 20:35 ` Keith Busch [this message]
2025-05-29 17:38   ` Tokunori Ikegami

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=aDdze52GrviTSmFj@kbusch-mbp \
    --to=kbusch@kernel.org \
    --cc=ikegami.t@gmail.com \
    --cc=linux-nvme@lists.infradead.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