From nobody Mon Apr 29 15:48:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1498388995097489.59043176555383; Sun, 25 Jun 2017 04:09:55 -0700 (PDT) Received: from localhost ([::1]:42105 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dP5QO-0004bF-H4 for importer@patchew.org; Sun, 25 Jun 2017 07:09:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49664) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dP5PR-0004Dr-92 for qemu-devel@nongnu.org; Sun, 25 Jun 2017 07:08:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dP5PN-000604-7G for qemu-devel@nongnu.org; Sun, 25 Jun 2017 07:08:53 -0400 Received: from roura.ac.upc.edu ([147.83.33.10]:48805 helo=roura.ac.upc.es) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dP5PM-0005zP-Rp for qemu-devel@nongnu.org; Sun, 25 Jun 2017 07:08:49 -0400 Received: from correu-1.ac.upc.es (correu-1.ac.upc.es [147.83.30.91]) by roura.ac.upc.es (8.13.8/8.13.8) with ESMTP id v5PB8jWf021396; Sun, 25 Jun 2017 13:08:45 +0200 Received: from localhost (unknown [132.68.53.125]) by correu-1.ac.upc.es (Postfix) with ESMTPSA id 3D333141A; Sun, 25 Jun 2017 13:08:40 +0200 (CEST) From: =?utf-8?b?TGx1w61z?= Vilanova To: qemu-devel@nongnu.org Date: Sun, 25 Jun 2017 14:08:38 +0300 Message-Id: <149838891852.10366.11525912227070211356.stgit@frigg.lan> X-Mailer: git-send-email 2.11.0 User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by roura.ac.upc.es id v5PB8jWf021396 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] 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: Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Events with the "vcpu" property need to be set globally (i.e., as if they d= idn't have that property) while we have not yet created any vCPU. Signed-off-by: Llu=C3=ADs Vilanova --- 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 6266e6380d..99a8ed5157 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=C3=ADs Vilanova + * Copyright (C) 2014-2017 Llu=C3=ADs Vilanova * * This work is licensed under the terms of the GNU GPL, version 2 or late= r. * 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 !=3D 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 =3D *ev->dstate; if (state_pre !=3D state) { if (state) {