From patchwork Tue Jul 11 08:35:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 786509 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3x6Fmz2sKVz9s8J for ; Tue, 11 Jul 2017 18:36:51 +1000 (AEST) Received: from localhost ([::1]:44940 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUqf3-0007ra-83 for incoming@patchwork.ozlabs.org; Tue, 11 Jul 2017 04:36:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33300) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUqeJ-0007kJ-P4 for qemu-devel@nongnu.org; Tue, 11 Jul 2017 04:36:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUqeI-0008Ek-T7 for qemu-devel@nongnu.org; Tue, 11 Jul 2017 04:36:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48716) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dUqeI-0008EW-NU for qemu-devel@nongnu.org; Tue, 11 Jul 2017 04:36:02 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9D58A80F9B; Tue, 11 Jul 2017 08:36:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9D58A80F9B Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=stefanha@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 9D58A80F9B Received: from localhost (ovpn-116-125.ams2.redhat.com [10.36.116.125]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0B2911834A; Tue, 11 Jul 2017 08:35:57 +0000 (UTC) From: Stefan Hajnoczi To: Date: Tue, 11 Jul 2017 09:35:51 +0100 Message-Id: <20170711083552.17433-2-stefanha@redhat.com> In-Reply-To: <20170711083552.17433-1-stefanha@redhat.com> References: <20170711083552.17433-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 11 Jul 2017 08:36:01 +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/2] trace: Fix early setting of events with the "vcpu" property 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=20Vilanova?= , Stefan Hajnoczi Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Lluís Vilanova Events with the "vcpu" property need to be set globally (i.e., as if they didn't have that property) while we have not yet created any vCPU. Signed-off-by: Lluís Vilanova Message-id: 149838891852.10366.11525912227070211356.stgit@frigg.lan Signed-off-by: Stefan Hajnoczi --- trace/control-target.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/trace/control-target.c b/trace/control-target.c index 6266e63..99a8ed5 100644 --- a/trace/control-target.c +++ b/trace/control-target.c @@ -1,7 +1,7 @@ /* * Interface for configuring and controlling the state of tracing events. * - * Copyright (C) 2014-2016 Lluís Vilanova + * Copyright (C) 2014-2017 Lluís Vilanova * * This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. @@ -38,12 +38,16 @@ void trace_event_set_state_dynamic(TraceEvent *ev, bool state) { CPUState *vcpu; assert(trace_event_get_state_static(ev)); - if (trace_event_is_vcpu(ev)) { + if (trace_event_is_vcpu(ev) && likely(first_cpu != NULL)) { CPU_FOREACH(vcpu) { trace_event_set_vcpu_state_dynamic(vcpu, ev, state); } } else { - /* Without the "vcpu" property, dstate can only be 1 or 0 */ + /* + * Without the "vcpu" property, dstate can only be 1 or 0. With it, we + * haven't instantiated any vCPU yet, so we will set a global state + * instead, and trace_init_vcpu will reconcile it afterwards. + */ bool state_pre = *ev->dstate; if (state_pre != state) { if (state) {