mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Li Pengfei <ljdlns1987@gmail.com>
To: rostedt@goodmis.org
Cc: mhiramat@kernel.org, mathieu.desnoyers@efficios.com,
	mark.rutland@arm.com, linux-trace-kernel@vger.kernel.org,
	linux-kernel@vger.kernel.org, zhangbo56@xiaomi.com,
	lipengfei28@xiaomi.com
Subject: Re: [RFC PATCH v4 1/3] trace: add lock-free stackmap for stack trace deduplication
Date: Tue,  1 Sep 2026 11:10:06 +0800	[thread overview]
Message-ID: <20260901031006.357894-1-lipengfei28@xiaomi.com> (raw)
In-Reply-To: <20260821235129.078dd489@fedora>

From: Pengfei Li <lipengfei28@xiaomi.com>

On Fri, 21 Aug 2026 23:51:29 -0400 Steven Rostedt wrote:
> Honestly, I don't think we need to be as strict on reset as you are
> trying to be. What is the worse thing that happens if a reset happens
> while the buffer is not cleared and the trace still exists?

Nothing that hurts the kernel. The map side stands on its own: the
resetting flag turns away new get_id() callers, synchronize_rcu()
drains the in-flight ones, and reset frees nothing - it only memsets
storage it still owns. So there is no use-after-free and no torn
read to worry about.

What is left is purely what userspace reads back. The buffer can
still hold TRACE_STACK_ID events after the map has been cleared, and
those ids resolve in one of two ways: either stack_map has no entry
for the id, or - once tracing continues and the slot gets reused -
the id now resolves to an unrelated stack. The second one is the
uglier of the two, since it is silent misattribution rather than an
obvious gap. Either way it is misleading output, not corruption.

Since that is the whole exposure, I agree it does not warrant
machinery to close the traceon window. v5 documents reset as
best-effort and leaves it at that.

If you would rather relax it further - drop the -EBUSY when tracing
is on, and stop clearing the ring buffer, leaving reset to only clear
the map - I am happy to do that. I would send it as a follow-up
rather than hold v5 on it, since the id-reuse case above is the only
thing the buffer clear was buying and it is cosmetic.

Thanks,
Pengfei

  reply	other threads:[~2026-09-01  3:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-16  6:41 [RFC PATCH v4 0/3] trace: stack trace deduplication for ftrace ring buffer Li Pengfei
2026-06-16  6:41 ` [RFC PATCH v4 1/3] trace: add lock-free stackmap for stack trace deduplication Li Pengfei
2026-07-14 21:11   ` Steven Rostedt
2026-07-15  3:12     ` Li Pengfei
2026-08-03  2:20       ` Li Pengfei
2026-08-22  3:51       ` Steven Rostedt
2026-09-01  3:10         ` Li Pengfei [this message]
2026-06-16  6:41 ` [RFC PATCH v4 2/3] trace: integrate stackmap into ftrace stack recording path Li Pengfei
2026-07-14 21:53   ` Steven Rostedt
2026-06-16  6:41 ` [RFC PATCH v4 3/3] trace: add documentation, selftest and tooling for stackmap Li Pengfei
2026-07-06  6:31 ` [RFC PATCH v4 0/3] trace: stack trace deduplication for ftrace ring buffer Li Pengfei
2026-07-10 19:14   ` Steven Rostedt

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=20260901031006.357894-1-lipengfei28@xiaomi.com \
    --to=ljdlns1987@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=lipengfei28@xiaomi.com \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=zhangbo56@xiaomi.com \
    /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

all inboxes | Powered by JetHome®