From patchwork Tue Sep 12 22:50:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Llu=C3=ADs_Vilanova?= X-Patchwork-Id: 813113 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xsKlY2dkKz9sPt for ; Wed, 13 Sep 2017 08:51:04 +1000 (AEST) Received: from localhost ([::1]:39153 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dru1F-0007B1-Ji for incoming@patchwork.ozlabs.org; Tue, 12 Sep 2017 18:51:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39189) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dru0s-0007Aq-BM for qemu-devel@nongnu.org; Tue, 12 Sep 2017 18:50:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dru0p-0007HL-EV for qemu-devel@nongnu.org; Tue, 12 Sep 2017 18:50:38 -0400 Received: from roura.ac.upc.es ([147.83.33.10]:58818) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dru0p-0007G2-2c for qemu-devel@nongnu.org; Tue, 12 Sep 2017 18:50:35 -0400 Received: from correu-2.ac.upc.es (correu-2.ac.upc.es [147.83.30.92]) by roura.ac.upc.es (8.13.8/8.13.8) with ESMTP id v8CMoWww024335; Wed, 13 Sep 2017 00:50:33 +0200 Received: from localhost (unknown [31.210.187.58]) by correu-2.ac.upc.es (Postfix) with ESMTPSA id 4491F3A3; Wed, 13 Sep 2017 00:50:27 +0200 (CEST) From: =?utf-8?b?TGx1w61z?= Vilanova To: qemu-devel@nongnu.org Date: Wed, 13 Sep 2017 01:50:25 +0300 Message-Id: <150525662577.19850.13767570977540117247.stgit@frigg.lan> X-Mailer: git-send-email 2.14.1 User-Agent: StGit/0.18 MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by roura.ac.upc.es id v8CMoWww024335 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-Received-From: 147.83.33.10 Subject: [Qemu-devel] [PATCH v2] trace: Immediately apply per-vCPU state changes if a vCPU is being created X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: stefanha@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 Reviewed-by: Emilio G. Cota --- Changes in v2 ============= * Use RUN_ON_CPU_NULL [Emilio G. Cota]. * Rebase on fcea73709b. --- trace/control-target.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/trace/control-target.c b/trace/control-target.c index 4e36101997..706b2cee9d 100644 --- a/trace/control-target.c +++ b/trace/control-target.c @@ -88,13 +88,17 @@ 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 { + trace_event_synchronize_vcpu_state_dynamic(vcpu, RUN_ON_CPU_NULL); + } } }