qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] trace/simple: Enable tracing on startup only if the user specifies a trace option
@ 2020-08-16 17:46 duboisj
  2020-09-03 11:48 ` Markus Armbruster
  2020-09-11 10:08 ` Stefan Hajnoczi
  0 siblings, 2 replies; 7+ messages in thread
From: duboisj @ 2020-08-16 17:46 UTC (permalink / raw)
  To: qemu-trivial, qemu-devel; +Cc: armbru, Josh DuBois

From: Josh DuBois <josh@joshdubois.com>

Tracing can be enabled at the command line or via the
monitor. Command-line trace options are recorded during
trace_opt_parse(), but tracing is not enabled until the various
front-ends later call trace_init_file(). If the user passes a trace
option on the command-line, remember that and enable tracing during
trace_init_file().  Otherwise, trace_init_file() should record the
trace file specified by the frontend and avoid enabling traces
until the user requests them via the monitor.

This fixes 1b7157be3a8c4300fc8044d40f4b2e64a152a1b4 and also
db25d56c014aa1a96319c663e0a60346a223b31e, by allowing the user
to enable traces on the command line and also avoiding
unwanted trace-<pid> files when the user has not asked for them.

Fixes: 1b7157be3a8c4300fc8044d40f4b2e64a152a1b4
Signed-off-by: Josh DuBois <josh@joshdubois.com>
---
 trace/control.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/trace/control.c b/trace/control.c
index 6558b5c906..8f94f09444 100644
--- a/trace/control.c
+++ b/trace/control.c
@@ -39,6 +39,7 @@ static TraceEventGroup *event_groups;
 static size_t nevent_groups;
 static uint32_t next_id;
 static uint32_t next_vcpu_id;
+static bool init_trace_on_startup;
 
 QemuOptsList qemu_trace_opts = {
     .name = "trace",
@@ -225,7 +226,9 @@ void trace_init_file(const char *file)
 {
 #ifdef CONFIG_TRACE_SIMPLE
     st_set_trace_file(file);
-    st_set_trace_file_enabled(true);
+    if (init_trace_on_startup) {
+        st_set_trace_file_enabled(true);
+    }
 #elif defined CONFIG_TRACE_LOG
     /*
      * If both the simple and the log backends are enabled, "--trace file"
@@ -299,6 +302,7 @@ char *trace_opt_parse(const char *optarg)
     }
     trace_init_events(qemu_opt_get(opts, "events"));
     trace_file = g_strdup(qemu_opt_get(opts, "file"));
+    init_trace_on_startup = true;
     qemu_opts_del(opts);
 
     return trace_file;
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] trace/simple: Enable tracing on startup only if the user specifies a trace option
  2020-08-16 17:46 [PATCH] trace/simple: Enable tracing on startup only if the user specifies a trace option duboisj
@ 2020-09-03 11:48 ` Markus Armbruster
  2020-09-11  5:03   ` Markus Armbruster
  2020-09-11 10:08 ` Stefan Hajnoczi
  1 sibling, 1 reply; 7+ messages in thread
From: Markus Armbruster @ 2020-09-03 11:48 UTC (permalink / raw)
  To: duboisj; +Cc: qemu-trivial, Stefan Hajnoczi, qemu-devel, Josh DuBois

duboisj@gmail.com writes:

> From: Josh DuBois <josh@joshdubois.com>
>
> Tracing can be enabled at the command line or via the
> monitor. Command-line trace options are recorded during
> trace_opt_parse(), but tracing is not enabled until the various
> front-ends later call trace_init_file(). If the user passes a trace
> option on the command-line, remember that and enable tracing during
> trace_init_file().  Otherwise, trace_init_file() should record the
> trace file specified by the frontend and avoid enabling traces
> until the user requests them via the monitor.
>
> This fixes 1b7157be3a8c4300fc8044d40f4b2e64a152a1b4 and also
> db25d56c014aa1a96319c663e0a60346a223b31e, by allowing the user
> to enable traces on the command line and also avoiding
> unwanted trace-<pid> files when the user has not asked for them.
>
> Fixes: 1b7157be3a8c4300fc8044d40f4b2e64a152a1b4
> Signed-off-by: Josh DuBois <josh@joshdubois.com>
> ---
>  trace/control.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/trace/control.c b/trace/control.c
> index 6558b5c906..8f94f09444 100644
> --- a/trace/control.c
> +++ b/trace/control.c
> @@ -39,6 +39,7 @@ static TraceEventGroup *event_groups;
>  static size_t nevent_groups;
>  static uint32_t next_id;
>  static uint32_t next_vcpu_id;
> +static bool init_trace_on_startup;
>  
>  QemuOptsList qemu_trace_opts = {
>      .name = "trace",
> @@ -225,7 +226,9 @@ void trace_init_file(const char *file)
>  {
>  #ifdef CONFIG_TRACE_SIMPLE
>      st_set_trace_file(file);
> -    st_set_trace_file_enabled(true);
> +    if (init_trace_on_startup) {
> +        st_set_trace_file_enabled(true);
> +    }
>  #elif defined CONFIG_TRACE_LOG
>      /*
>       * If both the simple and the log backends are enabled, "--trace file"
> @@ -299,6 +302,7 @@ char *trace_opt_parse(const char *optarg)
>      }
>      trace_init_events(qemu_opt_get(opts, "events"));
>      trace_file = g_strdup(qemu_opt_get(opts, "file"));
> +    init_trace_on_startup = true;
>      qemu_opts_del(opts);
>  
>      return trace_file;

Stops the littering for me.

Stefan, please have a closer look.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] trace/simple: Enable tracing on startup only if the user specifies a trace option
  2020-09-03 11:48 ` Markus Armbruster
@ 2020-09-11  5:03   ` Markus Armbruster
  0 siblings, 0 replies; 7+ messages in thread
From: Markus Armbruster @ 2020-09-11  5:03 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: qemu-trivial, duboisj, qemu-devel, Josh DuBois

Markus Armbruster <armbru@redhat.com> writes:

> duboisj@gmail.com writes:
>
>> From: Josh DuBois <josh@joshdubois.com>
>>
>> Tracing can be enabled at the command line or via the
>> monitor. Command-line trace options are recorded during
>> trace_opt_parse(), but tracing is not enabled until the various
>> front-ends later call trace_init_file(). If the user passes a trace
>> option on the command-line, remember that and enable tracing during
>> trace_init_file().  Otherwise, trace_init_file() should record the
>> trace file specified by the frontend and avoid enabling traces
>> until the user requests them via the monitor.
>>
>> This fixes 1b7157be3a8c4300fc8044d40f4b2e64a152a1b4 and also
>> db25d56c014aa1a96319c663e0a60346a223b31e, by allowing the user
>> to enable traces on the command line and also avoiding
>> unwanted trace-<pid> files when the user has not asked for them.
>>
>> Fixes: 1b7157be3a8c4300fc8044d40f4b2e64a152a1b4
>> Signed-off-by: Josh DuBois <josh@joshdubois.com>
>> ---
>>  trace/control.c | 6 +++++-
>>  1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/trace/control.c b/trace/control.c
>> index 6558b5c906..8f94f09444 100644
>> --- a/trace/control.c
>> +++ b/trace/control.c
>> @@ -39,6 +39,7 @@ static TraceEventGroup *event_groups;
>>  static size_t nevent_groups;
>>  static uint32_t next_id;
>>  static uint32_t next_vcpu_id;
>> +static bool init_trace_on_startup;
>>  
>>  QemuOptsList qemu_trace_opts = {
>>      .name = "trace",
>> @@ -225,7 +226,9 @@ void trace_init_file(const char *file)
>>  {
>>  #ifdef CONFIG_TRACE_SIMPLE
>>      st_set_trace_file(file);
>> -    st_set_trace_file_enabled(true);
>> +    if (init_trace_on_startup) {
>> +        st_set_trace_file_enabled(true);
>> +    }
>>  #elif defined CONFIG_TRACE_LOG
>>      /*
>>       * If both the simple and the log backends are enabled, "--trace file"
>> @@ -299,6 +302,7 @@ char *trace_opt_parse(const char *optarg)
>>      }
>>      trace_init_events(qemu_opt_get(opts, "events"));
>>      trace_file = g_strdup(qemu_opt_get(opts, "file"));
>> +    init_trace_on_startup = true;
>>      qemu_opts_del(opts);
>>  
>>      return trace_file;
>
> Stops the littering for me.
>
> Stefan, please have a closer look.

Ping?



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] trace/simple: Enable tracing on startup only if the user specifies a trace option
  2020-08-16 17:46 [PATCH] trace/simple: Enable tracing on startup only if the user specifies a trace option duboisj
  2020-09-03 11:48 ` Markus Armbruster
@ 2020-09-11 10:08 ` Stefan Hajnoczi
  2020-09-29  7:46   ` Markus Armbruster
  1 sibling, 1 reply; 7+ messages in thread
From: Stefan Hajnoczi @ 2020-09-11 10:08 UTC (permalink / raw)
  To: duboisj; +Cc: qemu-trivial, qemu-devel, Josh DuBois, armbru

[-- Attachment #1: Type: text/plain, Size: 1190 bytes --]

On Sun, Aug 16, 2020 at 12:46:10PM -0500, duboisj@gmail.com wrote:
> From: Josh DuBois <josh@joshdubois.com>
> 
> Tracing can be enabled at the command line or via the
> monitor. Command-line trace options are recorded during
> trace_opt_parse(), but tracing is not enabled until the various
> front-ends later call trace_init_file(). If the user passes a trace
> option on the command-line, remember that and enable tracing during
> trace_init_file().  Otherwise, trace_init_file() should record the
> trace file specified by the frontend and avoid enabling traces
> until the user requests them via the monitor.
> 
> This fixes 1b7157be3a8c4300fc8044d40f4b2e64a152a1b4 and also
> db25d56c014aa1a96319c663e0a60346a223b31e, by allowing the user
> to enable traces on the command line and also avoiding
> unwanted trace-<pid> files when the user has not asked for them.
> 
> Fixes: 1b7157be3a8c4300fc8044d40f4b2e64a152a1b4
> Signed-off-by: Josh DuBois <josh@joshdubois.com>
> ---
>  trace/control.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)

Thanks, applied to my tracing-next tree:
https://github.com/stefanha/qemu/commits/tracing-next

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] trace/simple: Enable tracing on startup only if the user specifies a trace option
  2020-09-11 10:08 ` Stefan Hajnoczi
@ 2020-09-29  7:46   ` Markus Armbruster
  2020-10-20  9:19     ` Markus Armbruster
  0 siblings, 1 reply; 7+ messages in thread
From: Markus Armbruster @ 2020-09-29  7:46 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: qemu-trivial, duboisj, qemu-devel, Josh DuBois

Stefan Hajnoczi <stefanha@gmail.com> writes:

> On Sun, Aug 16, 2020 at 12:46:10PM -0500, duboisj@gmail.com wrote:
>> From: Josh DuBois <josh@joshdubois.com>
>> 
>> Tracing can be enabled at the command line or via the
>> monitor. Command-line trace options are recorded during
>> trace_opt_parse(), but tracing is not enabled until the various
>> front-ends later call trace_init_file(). If the user passes a trace
>> option on the command-line, remember that and enable tracing during
>> trace_init_file().  Otherwise, trace_init_file() should record the
>> trace file specified by the frontend and avoid enabling traces
>> until the user requests them via the monitor.
>> 
>> This fixes 1b7157be3a8c4300fc8044d40f4b2e64a152a1b4 and also
>> db25d56c014aa1a96319c663e0a60346a223b31e, by allowing the user
>> to enable traces on the command line and also avoiding
>> unwanted trace-<pid> files when the user has not asked for them.
>> 
>> Fixes: 1b7157be3a8c4300fc8044d40f4b2e64a152a1b4
>> Signed-off-by: Josh DuBois <josh@joshdubois.com>
>> ---
>>  trace/control.c | 6 +++++-
>>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> Thanks, applied to my tracing-next tree:
> https://github.com/stefanha/qemu/commits/tracing-next
>
> Stefan

Pull request?



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] trace/simple: Enable tracing on startup only if the user specifies a trace option
  2020-09-29  7:46   ` Markus Armbruster
@ 2020-10-20  9:19     ` Markus Armbruster
  2020-10-20 19:29       ` Josh DuBois
  0 siblings, 1 reply; 7+ messages in thread
From: Markus Armbruster @ 2020-10-20  9:19 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: qemu-trivial, duboisj, qemu-devel, Josh DuBois

Markus Armbruster <armbru@redhat.com> writes:

> Stefan Hajnoczi <stefanha@gmail.com> writes:
>
>> On Sun, Aug 16, 2020 at 12:46:10PM -0500, duboisj@gmail.com wrote:
>>> From: Josh DuBois <josh@joshdubois.com>
>>> 
>>> Tracing can be enabled at the command line or via the
>>> monitor. Command-line trace options are recorded during
>>> trace_opt_parse(), but tracing is not enabled until the various
>>> front-ends later call trace_init_file(). If the user passes a trace
>>> option on the command-line, remember that and enable tracing during
>>> trace_init_file().  Otherwise, trace_init_file() should record the
>>> trace file specified by the frontend and avoid enabling traces
>>> until the user requests them via the monitor.
>>> 
>>> This fixes 1b7157be3a8c4300fc8044d40f4b2e64a152a1b4 and also
>>> db25d56c014aa1a96319c663e0a60346a223b31e, by allowing the user
>>> to enable traces on the command line and also avoiding
>>> unwanted trace-<pid> files when the user has not asked for them.
>>> 
>>> Fixes: 1b7157be3a8c4300fc8044d40f4b2e64a152a1b4
>>> Signed-off-by: Josh DuBois <josh@joshdubois.com>
>>> ---
>>>  trace/control.c | 6 +++++-
>>>  1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> Thanks, applied to my tracing-next tree:
>> https://github.com/stefanha/qemu/commits/tracing-next
>>
>> Stefan
>
> Pull request?

Pretty-please?



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] trace/simple: Enable tracing on startup only if the user specifies a trace option
  2020-10-20  9:19     ` Markus Armbruster
@ 2020-10-20 19:29       ` Josh DuBois
  0 siblings, 0 replies; 7+ messages in thread
From: Josh DuBois @ 2020-10-20 19:29 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-trivial, Stefan Hajnoczi, Josh DuBois, qemu-devel

Thanks for keeping on following-up, Markus.  

I know it's a small one, but it's still nice to have a small patch feel loved ;)

> On Oct 20, 2020, at 4:19 AM, Markus Armbruster <armbru@redhat.com> wrote:
> 
> Markus Armbruster <armbru@redhat.com> writes:
> 
>> Stefan Hajnoczi <stefanha@gmail.com> writes:
>> 
>>> On Sun, Aug 16, 2020 at 12:46:10PM -0500, duboisj@gmail.com wrote:
>>>> From: Josh DuBois <josh@joshdubois.com>
>>>> 
>>>> Tracing can be enabled at the command line or via the
>>>> monitor. Command-line trace options are recorded during
>>>> trace_opt_parse(), but tracing is not enabled until the various
>>>> front-ends later call trace_init_file(). If the user passes a trace
>>>> option on the command-line, remember that and enable tracing during
>>>> trace_init_file().  Otherwise, trace_init_file() should record the
>>>> trace file specified by the frontend and avoid enabling traces
>>>> until the user requests them via the monitor.
>>>> 
>>>> This fixes 1b7157be3a8c4300fc8044d40f4b2e64a152a1b4 and also
>>>> db25d56c014aa1a96319c663e0a60346a223b31e, by allowing the user
>>>> to enable traces on the command line and also avoiding
>>>> unwanted trace-<pid> files when the user has not asked for them.
>>>> 
>>>> Fixes: 1b7157be3a8c4300fc8044d40f4b2e64a152a1b4
>>>> Signed-off-by: Josh DuBois <josh@joshdubois.com>
>>>> ---
>>>> trace/control.c | 6 +++++-
>>>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>> 
>>> Thanks, applied to my tracing-next tree:
>>> https://github.com/stefanha/qemu/commits/tracing-next
>>> 
>>> Stefan
>> 
>> Pull request?
> 
> Pretty-please?
> 



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-10-20 19:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-16 17:46 [PATCH] trace/simple: Enable tracing on startup only if the user specifies a trace option duboisj
2020-09-03 11:48 ` Markus Armbruster
2020-09-11  5:03   ` Markus Armbruster
2020-09-11 10:08 ` Stefan Hajnoczi
2020-09-29  7:46   ` Markus Armbruster
2020-10-20  9:19     ` Markus Armbruster
2020-10-20 19:29       ` Josh DuBois

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).