From patchwork Fri Sep 15 17:39:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 814352 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 3xv2k212D9z9s7c for ; Sat, 16 Sep 2017 03:40:42 +1000 (AEST) Received: from localhost ([::1]:54427 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dsubY-0003t4-A1 for incoming@patchwork.ozlabs.org; Fri, 15 Sep 2017 13:40:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60687) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dsuaz-0003qv-KK for qemu-devel@nongnu.org; Fri, 15 Sep 2017 13:40:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dsuay-0005LM-IV for qemu-devel@nongnu.org; Fri, 15 Sep 2017 13:40:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49774) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dsuay-0005LE-CS for qemu-devel@nongnu.org; Fri, 15 Sep 2017 13:40:04 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 68C21C058EAA; Fri, 15 Sep 2017 17:40:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 68C21C058EAA Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=stefanha@redhat.com Received: from localhost (ovpn-117-224.ams2.redhat.com [10.36.117.224]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1D3767E107; Fri, 15 Sep 2017 17:39:55 +0000 (UTC) From: Stefan Hajnoczi To: Date: Fri, 15 Sep 2017 18:39:50 +0100 Message-Id: <20170915173950.21404-2-stefanha@redhat.com> In-Reply-To: <20170915173950.21404-1-stefanha@redhat.com> References: <20170915173950.21404-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 15 Sep 2017 17:40:03 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 1/1] 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: Peter Maydell , =?utf-8?q?Llu=C3=ADs_Vilanov?= =?utf-8?q?a?= , Stefan Hajnoczi Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Lluís Vilanova 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 Message-id: 150525662577.19850.13767570977540117247.stgit@frigg.lan Signed-off-by: Stefan Hajnoczi --- 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); + } } }