From nobody Fri Nov 1 07:21:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1708101570; cv=none; d=zohomail.com; s=zohoarc; b=bI9+iNsM2XxR8XUoROy9JfrfpttoyEN+s07zGgLpVjI2f17XaZwg98F2pmHcn8ziygXNIIuSZDNL4wBR3eW+NlkSxUz8MbNw0K6rC9c+g2S9y8/Tx9BsCGRDjOL1dWk2MVVoATVGamux9i7OSWQ9ZOc3Y9TTdtQLGwOlv3LpyHs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708101570; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=LY87PsqI5CseL6bunSV/a+wwJBYv7wofoTM3s0oA7jk=; b=CNaRSGdIjbTC+VNFx96mp8pucZBnExh/HhWGoTNRjTaJ+fjT1hPFL8/roeD5vSJmOts7kGR8f/xg+uT9FjGIxyPJAqPJUU/87IvlackQQAXOO2f2wGWXmJ8eBGXxgFDofUa7yWlXIRLDTscaXnIAzi356/RqXFplBHq5y6315xQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708101570161351.71730112343585; Fri, 16 Feb 2024 08:39:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rb1Dj-0001PQ-Ph; Fri, 16 Feb 2024 11:37:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rb1Di-0001MY-He for qemu-devel@nongnu.org; Fri, 16 Feb 2024 11:37:50 -0500 Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rb1DX-00045h-GL for qemu-devel@nongnu.org; Fri, 16 Feb 2024 11:37:50 -0500 Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2d10ad265d5so12905841fa.0 for ; Fri, 16 Feb 2024 08:37:38 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id m4-20020a05600c280400b0040fe308ff25sm2733004wmb.24.2024.02.16.08.37.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 08:37:35 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id C73195F9E1; Fri, 16 Feb 2024 16:30:27 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708101458; x=1708706258; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LY87PsqI5CseL6bunSV/a+wwJBYv7wofoTM3s0oA7jk=; b=bm5u2WkxjWABIl4Qi9ppMd0tfyhyPJKZ5C4f1IyNzLW/OaW/Vq1CVPFV/6UEhIjYC1 +feNHv7SWHbr2wR/4k32fpLeQWPozHBPQRVs+Nn55q/3gvjfDxkrfftRC6VOv7vq2ozR 8kVClczcl2ccSCYszYyquIXzCpQEcrszjaz2no2vbroFu2JGe89iOLjg66ZdeWdtowSR vHtv0y7j2YVaOZSlStq8M2CvkybrtIiiCPjmulWkbEdSPDFhzTJSYhmj2MsHJlG7+Giq +k577WuwH2J7a756Ze/QlNcedikQJdjPDrmTynVK4DgKC8koicOuihXDPqftOKdt1xTA VtNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708101458; x=1708706258; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LY87PsqI5CseL6bunSV/a+wwJBYv7wofoTM3s0oA7jk=; b=jlf7SyF7g7hoQ2jG2qF9nMz2CXYArGQmSO82vvO09Cs2RSnFKtz35lnxFGMNHQ8SaS mwnQ8NmxatU6zfjn7mMUG//VlwBaZyy292xE0q+7eNw24WkTuT7yIO/MR4tJPmeKctxP PNg18p0XaobjjRWSgjaA6gT/jdD8Es9Zo/67K1upgG95bHJvoEgM2aOIQyg4jJsDVWN6 8tBLUbzApFZpVnTtk400CfzEtUsLK92SrhvggtNVrTWM643gg6r7jeI97pAwvRz9r85H G+u6WdPdpghiJ4ZI2fEDxv+u0h0x3Ix67IIxKpiQRf9ZVfmSc7mthzDyFUkcHVi5bZL/ 1cbA== X-Gm-Message-State: AOJu0YzGa/d6tmaTCBQyzqsWxg22dk+alEstxVp4z1JGCFrWRYcbQB7N eAyNbfcvej3Y7qC5iXEqsbKNTB3JxfbvkyUN7GmLNpAuQFPJgBM7xFRK+sGv3gM= X-Google-Smtp-Source: AGHT+IE8pPyveV8Vlvza90Z4Lj4siM18NVcQPXJ9rGlAiKbbc7Qdjn+CleszgmQwhp7VrHZJgm577g== X-Received: by 2002:a2e:9607:0:b0:2d2:1107:3a3 with SMTP id v7-20020a2e9607000000b002d2110703a3mr3184316ljh.10.1708101457868; Fri, 16 Feb 2024 08:37:37 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Yoshinori Sato , David Hildenbrand , Weiwei Li , Richard Henderson , Michael Rolnik , Ilya Leoshkevich , Peter Maydell , qemu-ppc@nongnu.org, Paolo Bonzini , qemu-riscv@nongnu.org, Cleber Rosa , Thomas Huth , Song Gao , qemu-arm@nongnu.org, Pierrick Bouvier , John Snow , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Nicholas Piggin , qemu-s390x@nongnu.org, Laurent Vivier , "Edgar E. Iglesias" , Daniel Henrique Barboza , Yanan Wang , Palmer Dabbelt , Marcel Apfelbaum , Brian Cain , Mahmoud Mandour , Alexandre Iooss , Bin Meng , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Daniel Henrique Barboza , Eduardo Habkost , Alistair Francis , Liu Zhiwei Subject: [PATCH 15/23] cpu: call plugin init hook asynchronously Date: Fri, 16 Feb 2024 16:30:17 +0000 Message-Id: <20240216163025.424857-16-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240216163025.424857-1-alex.bennee@linaro.org> References: <20240216163025.424857-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::231; envelope-from=alex.bennee@linaro.org; helo=mail-lj1-x231.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1708101572016100001 From: Pierrick Bouvier This ensures we run during a cpu_exec, which allows to call start/end exclusive from this init hook (needed for new scoreboard API introduced later). async work is run before any tb is translated/executed, so we can guarantee plugin init will be called before any other hook. The previous change made sure that any idle/resume cb call will not be done before initializing plugin for a given vcpu. Reviewed-by: Richard Henderson Signed-off-by: Pierrick Bouvier Message-Id: <20240213094009.150349-5-pierrick.bouvier@linaro.org> Signed-off-by: Alex Benn=C3=A9e --- hw/core/cpu-common.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index fe16d0d9df8..68786360ea5 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -194,6 +194,11 @@ static void cpu_common_parse_features(const char *type= name, char *features, } } =20 +static void qemu_plugin_vcpu_init__async(CPUState *cpu, run_on_cpu_data un= used) +{ + qemu_plugin_vcpu_init_hook(cpu); +} + static void cpu_common_realizefn(DeviceState *dev, Error **errp) { CPUState *cpu =3D CPU(dev); @@ -217,9 +222,9 @@ static void cpu_common_realizefn(DeviceState *dev, Erro= r **errp) cpu_resume(cpu); } =20 - /* Plugin initialization must wait until the cpu is fully realized. */ + /* Plugin initialization must wait until the cpu start executing code = */ if (tcg_enabled()) { - qemu_plugin_vcpu_init_hook(cpu); + async_run_on_cpu(cpu, qemu_plugin_vcpu_init__async, RUN_ON_CPU_NUL= L); } =20 /* NOTE: latest generic point where the cpu is fully realized */ --=20 2.39.2