All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] trace: Immediately apply per-vCPU state changes if a vCPU is being created
@ 2017-09-06 15:27 Lluís Vilanova
  2017-09-06 22:24 ` Emilio G. Cota
  0 siblings, 1 reply; 2+ messages in thread
From: Lluís Vilanova @ 2017-09-06 15:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha, Stefan Hajnoczi

Right now, function trace_event_set_vcpu_state_dynamic() asynchronously enables
events in the case a vCPU is executing TCG code. If the vCPU is being created
this makes some events like "guest_cpu_enter" to not be traced.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 trace/control-target.c |   19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/trace/control-target.c b/trace/control-target.c
index 4e36101997..0056da6a46 100644
--- a/trace/control-target.c
+++ b/trace/control-target.c
@@ -88,13 +88,18 @@ void trace_event_set_vcpu_state_dynamic(CPUState *vcpu,
             clear_bit(vcpu_id, vcpu->trace_dstate_delayed);
             (*ev->dstate)--;
         }
-        /*
-         * Delay changes until next TB; we want all TBs to be built from a
-         * single set of dstate values to ensure consistency of generated
-         * tracing code.
-         */
-        async_run_on_cpu(vcpu, trace_event_synchronize_vcpu_state_dynamic,
-                         RUN_ON_CPU_NULL);
+        if (vcpu->created) {
+            /*
+             * Delay changes until next TB; we want all TBs to be built from a
+             * single set of dstate values to ensure consistency of generated
+             * tracing code.
+             */
+            async_run_on_cpu(vcpu, trace_event_synchronize_vcpu_state_dynamic,
+                             RUN_ON_CPU_NULL);
+        } else {
+            run_on_cpu_data ignored;
+            trace_event_synchronize_vcpu_state_dynamic(vcpu, ignored);
+        }
     }
 }
 

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

* Re: [Qemu-devel] [PATCH] trace: Immediately apply per-vCPU state changes if a vCPU is being created
  2017-09-06 15:27 [Qemu-devel] [PATCH] trace: Immediately apply per-vCPU state changes if a vCPU is being created Lluís Vilanova
@ 2017-09-06 22:24 ` Emilio G. Cota
  0 siblings, 0 replies; 2+ messages in thread
From: Emilio G. Cota @ 2017-09-06 22:24 UTC (permalink / raw)
  To: Lluís Vilanova; +Cc: qemu-devel, stefanha, Stefan Hajnoczi

On Wed, Sep 06, 2017 at 18:27:10 +0300, Lluís Vilanova wrote:
> Right now, function trace_event_set_vcpu_state_dynamic() asynchronously enables
> events in the case a vCPU is executing TCG code. If the vCPU is being created
> this makes some events like "guest_cpu_enter" to not be traced.
> 
> Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
> ---
>  trace/control-target.c |   19 ++++++++++++-------
>  1 file changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/trace/control-target.c b/trace/control-target.c
> index 4e36101997..0056da6a46 100644
> --- a/trace/control-target.c
> +++ b/trace/control-target.c
> @@ -88,13 +88,18 @@ void trace_event_set_vcpu_state_dynamic(CPUState *vcpu,
>              clear_bit(vcpu_id, vcpu->trace_dstate_delayed);
>              (*ev->dstate)--;
>          }
> -        /*
> -         * Delay changes until next TB; we want all TBs to be built from a
> -         * single set of dstate values to ensure consistency of generated
> -         * tracing code.
> -         */
> -        async_run_on_cpu(vcpu, trace_event_synchronize_vcpu_state_dynamic,
> -                         RUN_ON_CPU_NULL);
> +        if (vcpu->created) {
> +            /*
> +             * Delay changes until next TB; we want all TBs to be built from a
> +             * single set of dstate values to ensure consistency of generated
> +             * tracing code.
> +             */
> +            async_run_on_cpu(vcpu, trace_event_synchronize_vcpu_state_dynamic,
> +                             RUN_ON_CPU_NULL);
> +        } else {
> +            run_on_cpu_data ignored;
> +            trace_event_synchronize_vcpu_state_dynamic(vcpu, ignored);

I'd prefer RUN_ON_CPU_NULL here instead of the ignored param.
Other than that,

Reviewed-by: Emilio G. Cota <cota@braap.org>

		E.

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

end of thread, other threads:[~2017-09-06 22:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-06 15:27 [Qemu-devel] [PATCH] trace: Immediately apply per-vCPU state changes if a vCPU is being created Lluís Vilanova
2017-09-06 22:24 ` Emilio G. Cota

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.