From nobody Tue Feb 10 13:34:21 2026 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=1708706678; cv=none; d=zohomail.com; s=zohoarc; b=e8jmQLsUAUIh0xCvAsHb0QGL1SoOByuC1BS6mAa0CIK+OWYDe/HRhfmuaaQhrIV+lpIrgRewD3UoM3pkC3jfHfJoVqvWA7ReIEiw0yHKq7DDWkufd8A9uAq+WwMOZx7uHoTIz3cgb3zWox5iFTKoTiFQerPNQtaEfKoFcJuJwaY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708706678; 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=QlTtfEIz9YoDIkDwNDrl4f3P12lt7DoAgQVsvmSGdr1MeltC9YBgmcR/7C2HUyMNo6Jz5a0H8AW9tjVFRzQ8Te95mY8JZkFvyqfQtWDvVu12QnIrKBidlQ6/REGzNVOdFAkgupFyFdca+1jcx6EuGYI6IyY5Vxj0VAc5ESsb6p4= 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 1708706678917700.2969466235048; Fri, 23 Feb 2024 08:44:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdYdN-0003mu-00; Fri, 23 Feb 2024 11:42:49 -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 1rdYK3-0004Og-GG for qemu-devel@nongnu.org; Fri, 23 Feb 2024 11:22:51 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rdYJa-0006Ab-0t for qemu-devel@nongnu.org; Fri, 23 Feb 2024 11:22:51 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-41298411aefso974525e9.1 for ; Fri, 23 Feb 2024 08:22:20 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id l28-20020a05600c1d1c00b0041276d96351sm3030084wms.3.2024.02.23.08.22.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 08:22:14 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 2D1255F932; Fri, 23 Feb 2024 16:22:04 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708705339; x=1709310139; 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=b4taVSx3bMw9mGBzdThwAvQavpu0ylO00tdva45BOVxMZUawkN2tGu3L6lFov/pexD o5ZvOFg2XA29NUyjfeBioehLdyLUtTL4gG6M+2fzqI8VQtoRjF/79nWPA/k9EgGQjLE/ Q+xxhqXqKBcucdEIYbWg7nNBuCSI0Wcl8ZzlRmBO4V9QTt6o8P1OFdoAqPrDT7VLY0xb ECFeePeh8DKfOkkJxGs5bH0P9GrgmZtdg0juwojYN3HY1RWE2PDN1QIQ/WCtUViPn1LN hDrziiU5O1+QZXPsGhrawq3w7wbVDobR5eY1lZE/V3Teu/qW6uQmMQX3Ra8wnFaXtTbi pIdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708705339; x=1709310139; 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=L9QnKNP0kwqhimmyBmmMtMwXEQ1GDndYlsX64UnIqQPfR7g8t/13Mb40aoosbkW/DM G6znT75QV6+4lhme06FkaOC+uVkVp+m6/QysvIN1KOntMZpqm1aVnVLUUVYlI9L0sAZn HTrInSdHE9+dMChtvFtAXVs1C/2eLOzlXTNdO9/eS3Mgskry729sRicGq3DYz0TsEqQL X7veW13yqH+2osGBqAuZ+9Hj4St+CbFr6pXYEnuvHwsI3eg+qGlLsp1YsxXGCwRcBH2p liC1ToGhGqW//QZCyei6EmMGX4Y8jCkiEF/y8ZY0XypO93EjYkFV44IqsPw/kqm3+N1e eUOQ== X-Gm-Message-State: AOJu0Yy88MIZ65bz0S8r2xlsymuq+RVDehSp9BjBfUB4BM1md8rYNcIw j+/WTeYr/wK4R25a0hkIhPU8MCZsZlJM+rBZewsrGJasdM+Fd3I4Hqjx3JCYAPg= X-Google-Smtp-Source: AGHT+IEMr7arwsRq51jbZYNZhA+ROKzX1chC+jc+H7M5THUtBFtOMdjOnJHmYa8QThWYesn1isNx7w== X-Received: by 2002:a05:600c:46d0:b0:412:983c:be10 with SMTP id q16-20020a05600c46d000b00412983cbe10mr302101wmo.12.1708705339464; Fri, 23 Feb 2024 08:22:19 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Song Gao , qemu-s390x@nongnu.org, Liu Zhiwei , Pierrick Bouvier , Thomas Huth , Daniel Henrique Barboza , Bin Meng , Yanan Wang , Laurent Vivier , qemu-ppc@nongnu.org, David Hildenbrand , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Ilya Leoshkevich , Cleber Rosa , Nicholas Piggin , Marcel Apfelbaum , Eduardo Habkost , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexandre Iooss , Peter Maydell , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Daniel Henrique Barboza , qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Palmer Dabbelt , Mahmoud Mandour , John Snow , Weiwei Li , Alistair Francis , Yoshinori Sato , Brian Cain , Paolo Bonzini , "Edgar E. Iglesias" , Michael Rolnik Subject: [PATCH v2 17/27] cpu: call plugin init hook asynchronously Date: Fri, 23 Feb 2024 16:21:52 +0000 Message-Id: <20240223162202.1936541-18-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240223162202.1936541-1-alex.bennee@linaro.org> References: <20240223162202.1936541-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::331; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x331.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: 1708706679720100003 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