DMA Engine development
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@oss.nxp.com>
To: Logan Gunthorpe <logang@deltatee.com>
Cc: sashiko-reviews@lists.linux.dev, dmaengine@vger.kernel.org,
	vkoul@kernel.org, Frank.Li@kernel.org
Subject: Re: [PATCH v5 4/4] dmaengine: switchtec-dma: add pmon sysfs attributes
Date: Wed, 25 Nov 2026 13:42:01 -0600	[thread overview]
Message-ID: <awc6CeW_vnMQBWPe@SMW015318> (raw)
In-Reply-To: <9f243227-c668-4980-8cd2-8c7e45940cf6@deltatee.com>

On Tue, Nov 24, 2026 at 04:53:30PM -0600, Logan Gunthorpe wrote:
>
>
> On 2026-11-24 13:04, Frank Li wrote:
> > On Tue, Nov 24, 2026 at 03:59:03PM +0000, sashiko-bot@kernel.org wrote:
> >> Thank you for your contribution! Sashiko AI review found 1 potential
> >> issue to consider:
> >> - [Low] dmaengine: switchtec-dma: multi-line menu output in
> >>   latency_selector_show()
> >> --
> >>
> >> commit 88f647b9334dbbed040eb8ea50d2882f9874a0c9
> >> Author: Logan Gunthorpe <logang@deltatee.com>
> >>
> >> dmaengine: switchtec-dma: add pmon sysfs attributes
> >>
> >> This commit adds a "switchtec-pmon" sysfs attribute group to expose
> >> Switchtec DMA performance monitor registers per channel.
> >>
> >>> diff --git a/drivers/dma/switchtec_dma.c b/drivers/dma/switchtec_dma.c
> >>> index 1ebe17095c61a..774b418330ed7 100644
> >>> --- a/drivers/dma/switchtec_dma.c
> >>> +++ b/drivers/dma/switchtec_dma.c
> >> [ ... ]
> >>> @@ -1215,8 +1222,274 @@ static const struct attribute_group switchtec_config_group = {
> >>>  	.attrs = switchtec_config_attrs,
> >>>  };
> >> [ ... ]
> >>> +static ssize_t latency_selector_show(struct device *dev,
> >>> +				     struct device_attribute *attr, char *page)
> >>> +{
> >> [ ... ]
> >>> +	len = sysfs_emit(page,
> >>> +			 "To select a latency type, write the type number\n");
> >>> +	len += sysfs_emit_at(page, len, "(1 ~ 5) to latency_selector\n\n");
> >>> +
> >>> +	len += sysfs_emit_at(page, len, "Latency Types:\n");
> >>> +	len += sysfs_emit_at(page, len, "(1) SE Fetch latency");
> >>> +	if (lat & SWITCHTEC_LAT_SE_FETCH)
> >>> +		len += sysfs_emit_at(page, len, " (*)\n");
> >>> +	else
> >>> +		len += sysfs_emit_at(page, len, "\n");
> >>> +
> >>> +	len += sysfs_emit_at(page, len, "(2) VDM latency");
> >>> +	if (lat & SWITCHTEC_LAT_VDM)
> >>> +		len += sysfs_emit_at(page, len, " (*)\n");
> >>> +	else
> >>> +		len += sysfs_emit_at(page, len, "\n");
> >>> +
> >>> +	len += sysfs_emit_at(page, len, "(3) Read Immediate latency");
> >>> +	if (lat & SWITCHTEC_LAT_RD_IMM)
> >>> +		len += sysfs_emit_at(page, len, " (*)\n");
> >>> +	else
> >>> +		len += sysfs_emit_at(page, len, "\n");
> >>> +
> >>> +	len += sysfs_emit_at(page, len, "(4) SE Processing latency");
> >>> +	if (lat & SWITCHTEC_LAT_SE_PROCESS)
> >>> +		len += sysfs_emit_at(page, len, " (*)\n");
> >>> +	else
> >>> +		len += sysfs_emit_at(page, len, "\n");
> >>> +
> >>> +	len += sysfs_emit_at(page, len, "(5) FW NP TLP latency");
> >>> +	if (lat & SWITCHTEC_LAT_FW_NP)
> >>> +		len += sysfs_emit_at(page, len, " (*)\n");
> >>> +	else
> >>> +		len += sysfs_emit_at(page, len, "\n");
> >>> +
> >>> +	return len;
> >>> +}
> >>> +
> >>> +static ssize_t latency_selector_store(struct device *dev,
> >>> +				      struct device_attribute *attr,
> >>> +				      const char *page, size_t count)
> >>> +{
> >> [ ... ]
> >>> +	if (kstrtoint(page, 0, &lat_type) < 0)
> >>> +		return -EINVAL;
> >>
> >> [Severity: Low]
> >> Does latency_selector_show() violate the sysfs one-value-per-file rule in
> >> Documentation/filesystems/sysfs.rst?
> >>
> >> Reading latency_selector emits multi-line usage instructions and a
> >> numbered menu marking the active bit with "(*)", whereas
> >> latency_selector_store() parses a single integer from 1 to 5 via
> >> kstrtoint(), so the attribute's output cannot be parsed as a single value
> >> or written back to the file.  Could latency_selector expose a single value
> >> (or a single-line space-separated list of tokens with brackets around the
> >> active selection, documented under Documentation/ABI/), or move the
> >> human-formatted menu to debugfs?
> >
> > Yes, this is one problem, which need be addressed.
> > the sysfs one-value-per-file rule
> I responded to this in v4[1].
>
> We were really hoping to skirt that rule seeing we view the self
> documenting feature of the field worth having. If you really want to
> push this issue please let us know so we can create a new version
> promptly. I'd really like to get this merged this cycle.

I don't think it is critical now and marked at patchwork to wait for vinod
to pick.

sys interface is ABI. It may become difficult to change it in future. I
suggest consider it to debugfs or follow sysfs rule during wait for
vinod.

Frank

>
> Thanks,
>
> Logan
>
>
> [1]
> https://lore.kernel.org/all/dbe72187-4c12-4a8f-a63f-0c4238e50ec5@deltatee.com/

      reply	other threads:[~2026-11-25 19:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 15:50 [PATCH v5 0/4] Add sysfs interface to switchtec-dma Logan Gunthorpe
2026-11-24 15:50 ` [PATCH v5 1/4] dmaengine: add per-channel sysfs attribute groups via chan_groups Logan Gunthorpe
2026-11-24 15:50 ` [PATCH v5 2/4] dmaengine: ioatdma: convert per-channel sysfs to chan_groups Logan Gunthorpe
2026-11-24 15:50 ` [PATCH v5 3/4] dmaengine: switchtec-dma: add config sysfs attributes Logan Gunthorpe
2026-11-24 15:50 ` [PATCH v5 4/4] dmaengine: switchtec-dma: add pmon " Logan Gunthorpe
2026-11-24 15:59   ` sashiko-bot
2026-11-24 19:04     ` Frank Li
2026-11-24 22:53       ` Logan Gunthorpe
2026-11-25 19:42         ` Frank Li [this message]

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=awc6CeW_vnMQBWPe@SMW015318 \
    --to=frank.li@oss.nxp.com \
    --cc=Frank.Li@kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=logang@deltatee.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vkoul@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