Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Mayuresh Chitale" <mayuresh.chitale@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v7 05/14] gtrace: Add functions to start/stop tracing on a component path
Date: Thu, 26 Nov 2026 10:05:52 +0000	[thread overview]
Message-ID: <sashiko-outbox-235233@kernel.org> (raw)
In-Reply-To: <6fcdae2ebe6a263f872357b2aff272f9cf7ebe32.1795512532.git.mayuresh.chitale@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] gtrace: active component not stopped on driver removal in
  gtrace_remove()
- [Low] gtrace: missing @owner kernel-doc entry for struct gtrace_path
--

commit 3c35cac2de4c3236ac92bfa75608dd492c2b0158
Author: Mayuresh Chitale <mayuresh.chitale@oss.qualcomm.com>

gtrace: Add functions to start/stop tracing on a component path

This commit adds gtrace_path_start() and gtrace_path_stop() along with
per-component start reference counting and driver start/stop callbacks to
start and stop tracing across all components in a path.

> diff --git a/drivers/hwtracing/gtrace/gtrace-core.c b/drivers/hwtracing/gtrace/gtrace-core.c
> index 728235fc9bfe2..754c5f71168ba 100644
> --- a/drivers/hwtracing/gtrace/gtrace-core.c
> +++ b/drivers/hwtracing/gtrace/gtrace-core.c
[ ... ]
> @@ -137,8 +151,11 @@ static void gtrace_remove(struct device *dev)
>  	const struct gtrace_driver *gtdrv = to_gtrace_driver(dev->driver);
>  	struct gtrace_component *comp = to_gtrace_component(dev);
>  	struct gtrace_comp_priv *cpriv = to_gtrace_comp_priv(comp);
> +	unsigned long flags;
>  
> +	raw_spin_lock_irqsave(&cpriv->lock, flags);
>  	cpriv->ready = false;
> +	raw_spin_unlock_irqrestore(&cpriv->lock, flags);
>  	if (gtdrv->remove)
>  		gtdrv->remove(comp);
>  }

[Severity: Medium]
Should gtrace_remove() stop the component when cpriv->start_count is
non-zero?

If a component driver is unbound while a trace path is active,
gtrace_remove() clears cpriv->ready without calling gtdrv->stop(comp).
When gtrace_path_stop() later calls __gtrace_comp_stop(), it decrements
cpriv->start_count to 0, sees !cpriv->ready, and returns -ENODEV without
calling gtdrv->stop(comp) either, leaving hardware tracing active.

Also, if the driver is re-probed before existing active paths are
stopped, cpriv->ready becomes true again while cpriv->start_count is still
positive from the previous binding, causing later start/stop calls to skip
gtdrv->start(comp) or call gtdrv->stop(comp) on a newly probed component
that was never started.

> diff --git a/include/linux/gtrace.h b/include/linux/gtrace.h
> index 562cd1eca1626..77b2835c1647d 100644
> --- a/include/linux/gtrace.h
> +++ b/include/linux/gtrace.h
> @@ -295,6 +295,7 @@ struct gtrace_path {
>  	enum gtrace_component_mode	mode;
>  	u32				trace_id;
>  #define GTRACE_INVALID_TRACE_ID	U32_MAX
> +	pid_t				owner;
>  };

[Severity: Low]
struct gtrace_path has a kernel-doc comment block above it, so adding the
owner member without an @owner description will trigger a kernel-doc
warning under W=1 builds.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1795512532.git.mayuresh.chitale@oss.qualcomm.com?part=5

  reply	other threads:[~2026-11-26 10:05 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26  9:55 [PATCH v7 00/14] Linux RISC-V trace framework and drivers Mayuresh Chitale
2026-11-26  9:55 ` [PATCH v7 01/14] dt-bindings: Add RISC-V trace component bindings Mayuresh Chitale
2026-11-26 10:07   ` sashiko-bot
2026-11-26  9:55 ` [PATCH v7 02/14] hwtracing: gtrace: Initial implementation of gtrace framework Mayuresh Chitale
2026-11-26  9:55 ` [PATCH v7 03/14] gtrace: Add RISC-V platform driver for the " Mayuresh Chitale
2026-11-26 10:12   ` sashiko-bot
2026-11-26  9:55 ` [PATCH v7 04/14] gtrace: Add functions to create/destroy a trace component path Mayuresh Chitale
2026-11-26 10:07   ` sashiko-bot
2026-11-26  9:55 ` [PATCH v7 05/14] gtrace: Add functions to start/stop tracing on a " Mayuresh Chitale
2026-11-26 10:05   ` sashiko-bot [this message]
2026-11-26  9:55 ` [PATCH v7 06/14] gtrace: Add RISC-V Trace encoder driver Mayuresh Chitale
2026-11-26 10:09   ` sashiko-bot
2026-11-26  9:55 ` [PATCH v7 07/14] gtrace: Add function to copy into perf AUX buffer Mayuresh Chitale
2026-11-26 10:05   ` sashiko-bot
2026-11-26  9:55 ` [PATCH v7 08/14] perf: Add gtrace AUX buffer trace format type Mayuresh Chitale
2026-11-26  9:55 ` [PATCH v7 09/14] gtrace: Add RISC-V Trace ramsink driver Mayuresh Chitale
2026-11-26 10:13   ` sashiko-bot
2026-11-26  9:55 ` [PATCH v7 10/14] riscv: Enable DMA_RESTRICTED_POOL in defconfig Mayuresh Chitale
2026-11-26  9:55 ` [PATCH v7 11/14] gtrace: Add perf driver for tracing using perf tool Mayuresh Chitale
2026-11-26  9:55 ` [PATCH v7 12/14] perf tools: Add RISC-V trace PMU record capabilities Mayuresh Chitale
2026-11-26  9:55 ` [PATCH v7 13/14] perf tools: Initial support for gtrace decoder Mayuresh Chitale
2026-11-26  9:55 ` [PATCH v7 14/14] MAINTAINERS: Add entry for RISC-V trace framework Mayuresh Chitale

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=sashiko-outbox-235233@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=mayuresh.chitale@oss.qualcomm.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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