From: Sven Schnelle <svens@linux.ibm.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
Mete Durlu <meted@linux.ibm.com>
Subject: Re: [PATCH] tracing: use ring_buffer_record_is_set_on() in tracer_tracing_is_on()
Date: Tue, 06 Feb 2024 07:32:08 +0100 [thread overview]
Message-ID: <yt9d34u63xxz.fsf@linux.ibm.com> (raw)
In-Reply-To: <20240205092353.523cc1ef@rorschach.local.home> (Steven Rostedt's message of "Mon, 5 Feb 2024 09:23:53 -0500")
Steven Rostedt <rostedt@goodmis.org> writes:
> On Mon, 05 Feb 2024 14:16:30 +0100
> Sven Schnelle <svens@linux.ibm.com> wrote:
>>
>> Another issue i'm hitting sometimes is this part:
>>
>> csum1=`md5sum trace`
>> sleep $SLEEP_TIME
>> csum2=`md5sum trace`
>>
>> if [ "$csum1" != "$csum2" ]; then
>> fail "Tracing file is still changing"
>> fi
>>
>> This is because the command line was replaced in the
>> saved_cmdlines_buffer, an example diff between both files
>> is:
>
> [..]
>
>>
>> This can be improved by:
>>
>> echo 32768 > /sys/kernel/tracing/saved_cmdlines_size
>>
>> But this is of course not a fix - should we maybe replace the program
>> name with <...> before comparing, remove the check completely, or do
>> anything else? What do you think?
>
> Hmm, actually I would say that this exposes a real bug. Not a major
> one, but one that I find annoying. The saved commandlines should only
> be updated when a trace event occurs. But really, it should only be
> updated if one is added to the ring buffer. If the ring buffer isn't
> being updated, we shouldn't be adding new command lines.
>
> There may be a location that has tracing off but still updating the
> cmdlines which will break the saved cache.
Looking at trace_save_cmdline():
tpid = tsk->pid & (PID_MAX_DEFAULT - 1); where PID_MAX_DEFAULT = 0x8000
so this is basically
tpid = tsk->pid & 0x7fff;
further on:
// might clash with other pid if (otherpid & 0x7fff) == (tsk->pid & 0x7fff)
idx = savedcmd->map_pid_to_cmdline[tpid];
if (idx == NO_CMDLINE_MAP) {
// This will pick an existing entry if there are
// more than cmdline_num entries present
idx = (savedcmd->cmdline_idx + 1) % savedcmd->cmdline_num;
savedcmd->map_pid_to_cmdline[tpid] = idx;
savedcmd->cmdline_idx = idx;
}
So i think the problem that sometimes '<...>' instead of the correct
comm is logged is just expected behaviour given the code above.
next prev parent reply other threads:[~2024-02-06 6:36 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-05 6:53 [PATCH] tracing: use ring_buffer_record_is_set_on() in tracer_tracing_is_on() Sven Schnelle
2024-02-05 12:55 ` Steven Rostedt
2024-02-05 13:16 ` Sven Schnelle
2024-02-05 14:23 ` Steven Rostedt
2024-02-05 15:09 ` Sven Schnelle
2024-02-06 6:32 ` Sven Schnelle [this message]
2024-02-06 8:48 ` Sven Schnelle
2024-02-06 11:01 ` Steven Rostedt
2024-02-07 5:50 ` Sven Schnelle
2024-02-07 11:09 ` Steven Rostedt
2024-02-07 12:07 ` Mete Durlu
2024-02-07 12:28 ` Steven Rostedt
2024-02-07 13:33 ` Sven Schnelle
2024-02-07 15:47 ` Steven Rostedt
2024-02-08 10:25 ` Mete Durlu
2024-02-12 18:53 ` Steven Rostedt
2024-02-12 22:54 ` Mete Durlu
2024-02-12 23:12 ` Steven Rostedt
2024-02-06 7:05 ` Mete Durlu
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=yt9d34u63xxz.fsf@linux.ibm.com \
--to=svens@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=meted@linux.ibm.com \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.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