From nobody Tue Nov 26 08:45:38 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=1709121993; cv=none; d=zohomail.com; s=zohoarc; b=CnZ/xE5zky1Jh73Z1C9dNkcdpnJHlwLzfZHVZAZmSSaQv9AywMTSkXkOBPxGW/w3rr8VgOtRZwwyhYT2stMQgjDKooyg0rMl9xW05Hm0UYSNogDkujP8iJl2pgtw6rveNrpbEzVzYNkfvPZ3Cumet4kuZ+fyNlJMkjjEEZkGkKQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1709121993; 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=p+CwTreRkCfrSZnPVcfTsMUgX3CVXEY/vFHik/E/mjA=; b=V0sfFckLhhLuapNB5rp8LNDTQ0/KBgcCY+yHyV+yjPY9Afzf51ND1hNwQHNu0Lz0HLGNt0leKDAHybVJ4/usJ/Eld50QFAkCQco6L4ZChILNaVoQ5kN7bzrhX/OVO7gpcA1ZyseyQKZKy5AtP8Eq78nWsQ1SeGJhIkXUmPjgiSo= 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 1709121993790196.4163431305641; Wed, 28 Feb 2024 04:06:33 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rfIea-0005Km-D9; Wed, 28 Feb 2024 07:03:16 -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 1rfIeR-0004qn-MU for qemu-devel@nongnu.org; Wed, 28 Feb 2024 07:03:09 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rfIeP-000368-5B for qemu-devel@nongnu.org; Wed, 28 Feb 2024 07:03:07 -0500 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-33de64c91abso1498901f8f.1 for ; Wed, 28 Feb 2024 04:03:04 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a10-20020a5d4d4a000000b0033d13530134sm14173688wru.106.2024.02.28.04.02.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 04:02:59 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id C5A4D5F923; Wed, 28 Feb 2024 11:57:03 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709121783; x=1709726583; 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=p+CwTreRkCfrSZnPVcfTsMUgX3CVXEY/vFHik/E/mjA=; b=E6HXij9pDarR8WFjK7MfS2Ma8Lwak6J7kuk1KhJK9L4xrwj8K+6/xiF6ofPUYIveLM cdoV4p7xKKZRvS3OG2p5EZBbQ2uHUAAr0H5j7OwpNkHly4wKMw0EYMzAV/DpP0U/Qggf WwF4kO2VF1YO+nFop3VmIrqf3ittMgrrZnfL+f+2gStjIL/fNzxH0ZMU2AVA8HE8yH8O isf/5HiEJB36PI3Wmn0IekRV4bW/E0NsZRDjOV3tjRRRqHSvGJEcHSBUeFxlpc9EXiCi H83A+6TqYAp31iKcyMehcMX4R5ycf499JkT6UHxFJCXg7xWeufcf6Gmj8fmGbA7xqMqJ sRYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709121783; x=1709726583; 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=p+CwTreRkCfrSZnPVcfTsMUgX3CVXEY/vFHik/E/mjA=; b=vQImUcCoD2l/4RwgR1G4Lco0ejt80ESauCZRChzlyvEgWWsk+FBhHN49fSpiM2OdKq DskdBzxo14XV9P46m/+K4k9mPpgx1FWYRxKmTLym9sLHfd3K/IGMJLMHb4JlGQ0MZxEz ob7Prp7g3vLHgZ1uNX4WRt13y19iD0Uee7+ajDr1yLQckPDL8Tz+U+pEndiTJbsTjRPU 3dNTR7tUG5pLCfcAr2pmjx8EhbDhApM60FEHWDNBVhJchw8bat3+pQFjx65cJ31W5DXv zHqZ+Vsk1qGBkpoOMqzk1lNM/+07nieRIUQTsk1O9WLLVVXE3U2qAQc++UdQmweqEXdu Jn6g== X-Gm-Message-State: AOJu0Yy0CZPml2oIdoTFeKNl+iu9HueV5se4BpcRqu0zNIJj9eikFEuZ HVjaThbnvwxl7hkbVeTZ9G8WZ59wxOMpk8TUrSAYq36lR42eX8wYqg6O/vtwnnQ= X-Google-Smtp-Source: AGHT+IFqmRJpIk0MEbGeH445WnhVyvek6ohJv4skkjMB8s+POhe5q51rTAe1t83K2uOBgEsBP13acQ== X-Received: by 2002:a5d:6649:0:b0:33d:aa78:ed82 with SMTP id f9-20020a5d6649000000b0033daa78ed82mr9214879wrw.34.1709121783637; Wed, 28 Feb 2024 04:03:03 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Pierrick Bouvier , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Eduardo Habkost , Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Yanan Wang Subject: [PULL 19/29] cpu: call plugin init hook asynchronously Date: Wed, 28 Feb 2024 11:56:51 +0000 Message-Id: <20240228115701.1416107-20-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240228115701.1416107-1-alex.bennee@linaro.org> References: <20240228115701.1416107-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::430; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x430.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: 1709121995927100003 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 Message-Id: <20240227144335.1196131-20-alex.bennee@linaro.org> 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