Linux Trace Kernel
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Marco Elver <elver@google.com>
Cc: Kees Cook <keescook@chromium.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Oleg Nesterov <oleg@redhat.com>,
	linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
	Dmitry Vyukov <dvyukov@google.com>,
	kasan-dev@googlegroups.com
Subject: Re: [PATCH] tracing: Add task_prctl_unknown tracepoint
Date: Wed, 6 Nov 2024 10:28:56 -0500	[thread overview]
Message-ID: <20241106102856.00ad694e@gandalf.local.home> (raw)
In-Reply-To: <20241106101823.4a5d556d@gandalf.local.home>

On Wed, 6 Nov 2024 10:18:23 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:

> > Some trial and error led me to conclude it's a race between the logic
> > looking up the comm and the process exiting: If the test program exits
> > soon after the traced event, it doesn't print the comm. Adding a
> > generous usleep() before it exits reliably prints the comm.  
> 
> Thanks for letting me know. Let me see if I can fix that!

Hmm, that still doesn't make sense. Is this just a single line or do you
have other events being recorded?

The way the caching works is during the sched_switch tracepoint which still
gets called when the task exits. If a trace event is triggered, it sets a
per cpu flags to have the next sched_switch record the comm for both the
previous and next tasks.

Now the reason it can miss is that there's contention on the lock that
saves the comms (it does a trylock and if it fails, it just skips it). Or
if another task hits the same "comm cache line".

This is why I wonder if you have other events being traced.

-- Steve

  reply	other threads:[~2024-11-06 15:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-05 13:34 [PATCH] tracing: Add task_prctl_unknown tracepoint Marco Elver
2024-11-05 16:31 ` Steven Rostedt
2024-11-05 16:53   ` Marco Elver
2024-11-05 17:02     ` Steven Rostedt
2024-11-05 17:22       ` Marco Elver
2024-11-06  9:22         ` Marco Elver
2024-11-06 15:18           ` Steven Rostedt
2024-11-06 15:28             ` Steven Rostedt [this message]
2024-11-06 18:12               ` Marco Elver
2024-11-06 21:23                 ` Steven Rostedt
2024-11-06 21:59                   ` Marco Elver
2024-11-06 22:30                     ` 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=20241106102856.00ad694e@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=dvyukov@google.com \
    --cc=elver@google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=oleg@redhat.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