From patchwork Wed Mar 23 17:17:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12790006 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 98DAFC433EF for ; Wed, 23 Mar 2022 17:35:30 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.294026.499758 (Exim 4.92) (envelope-from ) id 1nX4tA-0004Rw-Ss; Wed, 23 Mar 2022 17:35:16 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 294026.499758; Wed, 23 Mar 2022 17:35:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nX4tA-0004Rp-PM; Wed, 23 Mar 2022 17:35:16 +0000 Received: by outflank-mailman (input) for mailman id 294026; Wed, 23 Mar 2022 17:35:16 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nX4dT-0004Zy-K0 for xen-devel@lists.xenproject.org; Wed, 23 Mar 2022 17:19:03 +0000 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [2607:f8b0:4864:20::631]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 5561da2e-aacd-11ec-a405-831a346695d4; Wed, 23 Mar 2022 18:19:02 +0100 (CET) Received: by mail-pl1-x631.google.com with SMTP id c23so2183651plo.0 for ; Wed, 23 Mar 2022 10:19:02 -0700 (PDT) Received: from localhost.localdomain (198.red-83-50-65.dynamicip.rima-tde.net. [83.50.65.198]) by smtp.gmail.com with ESMTPSA id u15-20020a056a00098f00b004faa58d44eesm455060pfg.145.2022.03.23.10.18.55 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 23 Mar 2022 10:19:01 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 5561da2e-aacd-11ec-a405-831a346695d4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0hihgfEmLJPNBEh4WW6rYf49XmgK0ovI41W1a0emuNk=; b=MrdYb7945anCfYH1VRiFA5pAW7S4hoZOOF1Pdv+2ZTrCvIPQ0tdNE6NgZGHvIaYl6F plkh3wIlaqYoXktAcEAtQmOqlHJdMmidt+Oa/wnRaHYaNMUJZ9CkCSrlqjquwFaZdWSC HPnXLzJcabcEufzwkRoVTxfpe1EHQA8+scJQyC9OkHIYWUa2UKWUlEhDYRHbD8EXQtLR hGXTs3LTe0tNECvEc0QQ3gavKzuFIBW5V+W6pGyNgy0F8X1RKcixk5n93FXcTecHiIep G1WrbmTHafbZqiFIsAW0M4VWI5qRob0xYjL9jnDgfVfth7/f271rS43Pm6WxxiTOI/Ta havA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0hihgfEmLJPNBEh4WW6rYf49XmgK0ovI41W1a0emuNk=; b=1OfMaxDMPcPasAsY7fbV2TiWVgXCVPfg6D625qP50cS7Yxzu0413ZYLJSLAkHYKOiN +h2Y+haFNJeWqgk2NRZpPtA1Sqo+SCjPECnctUuPi2WgxLL2c4LMHYjRqX1/FNjsavTw +4HQr3Wm6JCj3DSid5XlvBbvk9+jE+A005PhVLGtyhtfd10d3eJ2nJ9FrocaoH0U3qvf lKzPRkjjk1qS9tdpl9MKGNE35PCOvQmGZizcgZkCT6dzQARAdC3NSwi3LdM6tu4rvkF6 EFmOmretVXFfJYYQ4NwcDPhkfz9ngw+XbH5LVbmKHKqeNTD8RsYKCy/s99+pzI4JXrx0 N+yQ== X-Gm-Message-State: AOAM531itduDtQnQVXu3zavZTAypP/HBBC+IdP2e3emVysmw7Fq/D7SG r+0ok+S8J5O8KWvQQkrYhwQ= X-Google-Smtp-Source: ABdhPJwdV5/nAguIIYnMM8I+otidppMXPEnBBQGuuNIH21Igt/CypcRNRBAVG30eApAdY410n71pzg== X-Received: by 2002:a17:90a:8581:b0:1b2:7541:af6c with SMTP id m1-20020a17090a858100b001b27541af6cmr842235pjn.48.1648055941418; Wed, 23 Mar 2022 10:19:01 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Wenchao Wang , Laurent Vivier , David Hildenbrand , Yanan Wang , Cameron Esfahani , Marcelo Tosatti , Sunil Muthuswamy , Anthony Perard , haxm-team@intel.com, Paul Durrant , Richard Henderson , xen-devel@lists.xenproject.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Roman Bolshakov , Reinoud Zandijk , Marcel Apfelbaum , Kamil Rytarowski , Paolo Bonzini , Peter Xu , Eduardo Habkost , Stefano Stabellini , Thomas Huth , Colin Xu Subject: [PATCH v4 05/13] accel/tcg: Init TCG cflags in vCPU thread handler Date: Wed, 23 Mar 2022 18:17:43 +0100 Message-Id: <20220323171751.78612-6-philippe.mathieu.daude@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220323171751.78612-1-philippe.mathieu.daude@gmail.com> References: <20220323171751.78612-1-philippe.mathieu.daude@gmail.com> MIME-Version: 1.0 From: Philippe Mathieu-Daudé Move TCG cflags initialization to thread handler. Remove the duplicated assert checks. Signed-off-by: Philippe Mathieu-Daudé --- accel/tcg/tcg-accel-ops-mttcg.c | 5 ++--- accel/tcg/tcg-accel-ops-rr.c | 7 +++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/accel/tcg/tcg-accel-ops-mttcg.c b/accel/tcg/tcg-accel-ops-mttcg.c index ea2b741deb..80609964a6 100644 --- a/accel/tcg/tcg-accel-ops-mttcg.c +++ b/accel/tcg/tcg-accel-ops-mttcg.c @@ -71,6 +71,8 @@ static void *mttcg_cpu_thread_fn(void *arg) assert(tcg_enabled()); g_assert(!icount_enabled()); + tcg_cpu_init_cflags(cpu, current_machine->smp.max_cpus > 1); + rcu_register_thread(); force_rcu.notifier.notify = mttcg_force_rcu; force_rcu.cpu = cpu; @@ -140,9 +142,6 @@ void mttcg_start_vcpu_thread(CPUState *cpu) { char thread_name[VCPU_THREAD_NAME_SIZE]; - g_assert(tcg_enabled()); - tcg_cpu_init_cflags(cpu, current_machine->smp.max_cpus > 1); - cpu->thread = g_new0(QemuThread, 1); cpu->halt_cond = g_malloc0(sizeof(QemuCond)); qemu_cond_init(cpu->halt_cond); diff --git a/accel/tcg/tcg-accel-ops-rr.c b/accel/tcg/tcg-accel-ops-rr.c index b287110766..de8af32af7 100644 --- a/accel/tcg/tcg-accel-ops-rr.c +++ b/accel/tcg/tcg-accel-ops-rr.c @@ -153,7 +153,9 @@ static void *rr_cpu_thread_fn(void *arg) Notifier force_rcu; CPUState *cpu = arg; - assert(tcg_enabled()); + g_assert(tcg_enabled()); + tcg_cpu_init_cflags(cpu, false); + rcu_register_thread(); force_rcu.notify = rr_force_rcu; rcu_add_force_rcu_notifier(&force_rcu); @@ -276,9 +278,6 @@ void rr_start_vcpu_thread(CPUState *cpu) static QemuCond *single_tcg_halt_cond; static QemuThread *single_tcg_cpu_thread; - g_assert(tcg_enabled()); - tcg_cpu_init_cflags(cpu, false); - if (!single_tcg_cpu_thread) { cpu->thread = g_new0(QemuThread, 1); cpu->halt_cond = g_new0(QemuCond, 1);