From: Slavomir Kaslev <kaslevs@vmware.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-trace-devel@vger.kernel.org, slavomir.kaslev@gmail.com
Subject: Re: [RFC PATCH v6 04/11] trace-cmd: Add buffer instance flags for tracing in guest and agent context
Date: Mon, 18 Feb 2019 16:24:02 +0200 [thread overview]
Message-ID: <20190218142401.GA11734@box> (raw)
In-Reply-To: <20190214150520.3c6bb8ac@gandalf.local.home>
On Thu, Feb 14, 2019 at 03:05:20PM -0500, Steven Rostedt wrote:
> On Thu, 14 Feb 2019 16:13:28 +0200
> Slavomir Kaslev <kaslevs@vmware.com> wrote:
>
> > Add BUFFER_FL_GUEST and BUFFER_FL_AGENT flags to differentiate when
> > trace-record.c is being called to trace guest or the VM tracing agent.
> >
> > Also disable functions talking to the local tracefs when called in recording
> > guest instances context.
> >
> > Signed-off-by: Slavomir Kaslev <kaslevs@vmware.com>
> > ---
> > tracecmd/include/trace-local.h | 2 ++
> > tracecmd/trace-record.c | 55 ++++++++++++++++++++++++++++++++--
> > 2 files changed, 55 insertions(+), 2 deletions(-)
> >
> > diff --git a/tracecmd/include/trace-local.h b/tracecmd/include/trace-local.h
> > index a1a06e9..f19c8bb 100644
> > --- a/tracecmd/include/trace-local.h
> > +++ b/tracecmd/include/trace-local.h
> > @@ -149,6 +149,8 @@ char *strstrip(char *str);
> > enum buffer_instance_flags {
> > BUFFER_FL_KEEP = 1 << 0,
> > BUFFER_FL_PROFILE = 1 << 1,
> > + BUFFER_FL_GUEST = 1 << 2,
> > + BUFFER_FL_AGENT = 1 << 3,
> > };
> >
> > struct func_list {
> > diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
> > index 8beefab..107d3d1 100644
> > --- a/tracecmd/trace-record.c
> > +++ b/tracecmd/trace-record.c
> > @@ -781,6 +781,9 @@ static void __clear_trace(struct buffer_instance *instance)
> > FILE *fp;
> > char *path;
> >
> > + if (instance->flags & BUFFER_FL_GUEST)
> > + return;
> > +
> > /* reset the trace */
> > path = get_instance_file(instance, "trace");
> > fp = fopen(path, "w");
> > @@ -1264,6 +1267,9 @@ set_plugin_instance(struct buffer_instance *instance, const char *name)
> > char *path;
> > char zero = '0';
> >
> > + if (instance->flags & BUFFER_FL_GUEST)
> > + return;
> > +
> > path = get_instance_file(instance, "current_tracer");
> > fp = fopen(path, "w");
> > if (!fp) {
> > @@ -1360,6 +1366,9 @@ static void disable_func_stack_trace_instance(struct buffer_instance *instance)
> > int size;
> > int ret;
> >
> > + if (instance->flags & BUFFER_FL_GUEST)
> > + return;
> > +
> > path = get_instance_file(instance, "current_tracer");
> > ret = stat(path, &st);
> > tracecmd_put_tracing_file(path);
>
>
> I think we should add a:
>
> #define is_guest(instance) ((instance)->flags & BUFFER_FL_GUEST)
>
> Helper macro here, and all these should be turned into:
>
> if (is_guest(instance))
> return;
>
> Less error prone, and looks cleaner.
>
> We could add a is_agent() too in later patches.
Makes sense. I added both is_agent and is_guest for the next iteration of this
patchset.
next prev parent reply other threads:[~2019-02-18 14:24 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-14 14:13 [RFC PATCH v6 00/11] Add VM kernel tracing over vsockets and FIFOs Slavomir Kaslev
2019-02-14 14:13 ` [RFC PATCH v6 01/11] trace-cmd: Detect if vsockets are available Slavomir Kaslev
2019-02-14 14:13 ` [RFC PATCH v6 02/11] trace-cmd: Add tracecmd_create_recorder_virt function Slavomir Kaslev
2019-02-14 14:13 ` [RFC PATCH v6 03/11] trace-cmd: Add TRACE_REQ and TRACE_RESP messages Slavomir Kaslev
2019-02-14 18:51 ` Steven Rostedt
2019-02-14 14:13 ` [RFC PATCH v6 04/11] trace-cmd: Add buffer instance flags for tracing in guest and agent context Slavomir Kaslev
2019-02-14 20:05 ` Steven Rostedt
2019-02-18 14:24 ` Slavomir Kaslev [this message]
2019-02-14 14:13 ` [RFC PATCH v6 05/11] trace-cmd: Add VM kernel tracing over vsockets transport Slavomir Kaslev
2019-02-14 20:03 ` Steven Rostedt
2019-02-18 14:26 ` Slavomir Kaslev
2019-02-18 14:28 ` Slavomir Kaslev
2019-02-14 14:13 ` [RFC PATCH v6 06/11] trace-cmd: Use splice(2) for vsockets if available Slavomir Kaslev
2019-02-14 14:13 ` [RFC PATCH v6 07/11] trace-cmd: Add `trace-cmd setup-guest` command Slavomir Kaslev
2019-02-14 20:41 ` Steven Rostedt
2019-02-18 14:37 ` Slavomir Kaslev
2019-02-18 17:44 ` Steven Rostedt
2019-02-18 20:07 ` Slavomir Kaslev
2019-02-18 20:54 ` Slavomir Kaslev
2019-02-14 14:13 ` [RFC PATCH v6 08/11] trace-cmd: Try to autodetect number of guest CPUs in setup-guest if not specified Slavomir Kaslev
2019-02-14 14:13 ` [RFC PATCH v6 09/11] trace-cmd: Add setup-guest flag for attaching FIFOs to the guest VM config Slavomir Kaslev
2019-02-14 14:13 ` [RFC PATCH v6 10/11] trace-cmd: Add splice() recording from FIFO without additional pipe buffer Slavomir Kaslev
2019-02-14 21:07 ` Steven Rostedt
2019-02-14 14:13 ` [RFC PATCH v6 11/11] trace-cmd: Add VM tracing over FIFOs transport Slavomir Kaslev
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=20190218142401.GA11734@box \
--to=kaslevs@vmware.com \
--cc=linux-trace-devel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=slavomir.kaslev@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).