From: Steven Rostedt <rostedt@goodmis.org>
To: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
Cc: linux-trace-devel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] trace-cmd: Add validation for reading and writing trace.dat files
Date: Tue, 23 Feb 2021 17:18:19 -0500 [thread overview]
Message-ID: <20210223171819.3b42b9e8@gandalf.local.home> (raw)
In-Reply-To: <20210219053156.2235035-2-tz.stoyanov@gmail.com>
On Fri, 19 Feb 2021 07:31:55 +0200
"Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com> wrote:
> trace.dat files have multiple sections, which must be in strict order. A
> new logic is implemented, which checks the order of all mandatory
> sections when reading and writing trace files. This validation is
> useful when the file is constructed in different machines -
> host / guest or listener tracing. In those use cases, part of the file
> is generated in the client machine and is transferred to the server as
> a sequence of bytes. The server should validate the format of the received
> portion of the file and the order of the sections in it.
>
> Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
> ---
> /* --- Opening and Reading the trace.dat file --- */
>
> +enum {
> + TRACECMD_FILE_INIT,
> + TRACECMD_FILE_HEADERS,
> + TRACECMD_FILE_FTRACE_EVENTS,
> + TRACECMD_FILE_ALL_EVENTS,
> + TRACECMD_FILE_KALLSYMS,
> + TRACECMD_FILE_PRINTK,
> + TRACECMD_FILE_CMD_LINES,
> + TRACECMD_FILE_CPU_COUNT,
> + TRACECMD_FILE_OPTIONS,
> + TRACECMD_FILE_CPU_LATENCY,
> + TRACECMD_FILE_CPU_FLYRECORD,
I still really don't think we want to make LATENCY and FLYRECORD states.
Because they are not a state of the trace.dat file, but a type.
Unless we document here that they are the last states of the file, and once
reached, the state can not change.
But is that the case? We may want states about reading
> +};
> +
> enum {
> TRACECMD_OPTION_DONE,
> TRACECMD_OPTION_DATE,
> @@ -115,9 +129,7 @@ enum {
> enum {
> TRACECMD_FL_IGNORE_DATE = (1 << 0),
> TRACECMD_FL_BUFFER_INSTANCE = (1 << 1),
> - TRACECMD_FL_LATENCY = (1 << 2),
> - TRACECMD_FL_IN_USECS = (1 << 3),
> - TRACECMD_FL_FLYRECORD = (1 << 4),
> + TRACECMD_FL_IN_USECS = (1 << 2),
> };
>
> @@ -2665,9 +2678,9 @@ static int read_options_type(struct tracecmd_input *handle)
> * Check if this is a latency report or flyrecord.
> */
> if (strncmp(buf, "latency", 7) == 0)
> - handle->flags |= TRACECMD_FL_LATENCY;
> + handle->file_state = TRACECMD_FILE_CPU_LATENCY;
> else if (strncmp(buf, "flyrecord", 9) == 0)
> - handle->flags |= TRACECMD_FL_FLYRECORD;
> + handle->file_state = TRACECMD_FILE_CPU_FLYRECORD;
What happens when we change states after this? Or is this going to always
be the last state of the file?
What if we want to change the state after we read the CPUs, or for the
latency, we may want to change the state after reading the trace file.
The more I think about this, the more having them be states does not make
sense. They are the type of file, and should stay as flags.
What benefit do you see for keeping them a state?
-- Steve
next prev parent reply other threads:[~2021-02-23 22:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-19 5:31 [PATCH v2 0/2] Fix listener and add trace file validation Tzvetomir Stoyanov (VMware)
2021-02-19 5:31 ` [PATCH v2 1/2] trace-cmd: Add validation for reading and writing trace.dat files Tzvetomir Stoyanov (VMware)
2021-02-23 22:18 ` Steven Rostedt [this message]
2021-02-24 5:22 ` Tzvetomir Stoyanov
2021-02-24 23:08 ` Steven Rostedt
2021-02-24 23:18 ` Steven Rostedt
2021-02-26 4:02 ` Tzvetomir Stoyanov
2021-02-26 5:02 ` Steven Rostedt
2021-02-19 5:31 ` [PATCH v2 2/2] trace-cmd: Fix broken listener and add error checks Tzvetomir Stoyanov (VMware)
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=20210223171819.3b42b9e8@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-trace-devel@vger.kernel.org \
--cc=tz.stoyanov@gmail.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;
as well as URLs for NNTP newsgroup(s).