From patchwork Tue May 28 14:59:52 2024 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: 799503 Delivered-To: patch@linaro.org Received: by 2002:adf:e110:0:b0:35b:5a80:51b4 with SMTP id t16csp281189wrz; Tue, 28 May 2024 08:02:04 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVegSlCMz4g2brRJ2tNY/k7BNe+qZIoKvIKUpe8WWR8PWfFgnjIqJnH4LYCf9prV1KcTrG58JIE1YgWbBUkWi0N X-Google-Smtp-Source: AGHT+IE9Z/VEBBTvTLUY8sn9KRVexeFrR/ejfgYqyExPLVCCA0uNhwjsz0mnV860QvC5CnICgbHz X-Received: by 2002:a05:6e02:152d:b0:372:875a:41dd with SMTP id e9e14a558f8ab-3737b2bd8afmr144328205ab.16.1716908523662; Tue, 28 May 2024 08:02:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716908523; cv=none; d=google.com; s=arc-20160816; b=TSzEEVV8oUW0SExHKSOUbumMOGviVDhzN3R1Oj2rb6DFkn8nZVFEkAGgdrYhcGTvg2 hRaDzzzH3/dbo+yjfwH0DTs7To/NlKJF2U9iQKPJyifPM04fEi4RM84G7gyI0/V20qtk 0+xiAfQOi1sV/249s6ay3myvbviuugN3vY/xzsAZloFsMnGbUM3h5VjpoYNP+auRXljE ZTZR6cge+XDISnlYHxdRAFUff3uMb3r8fzC2jTPsqyYRLgocz9R/yvSdJOR39XjkO27z S76xqyRrfAI477lQBhENKxMsWFTuYoLnf5K1qjsuwFaO5+s9L6v1l/my/6xfa72DlyPT 0nsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PFr0hL1Ar1UbWkc2eKqlJoQWp8y4Pl+E2QiBqPA7F5Y=; fh=g71ocj76I19MS7AD71vLKnbNbl87LKTjuBKf8cOVRXA=; b=vAzxJIlYi9Iv7CyW2Ninqrj2CDy+212f7LGU/5OCVne2wki9X3ppLLBh6arg806yLP u8vteWFSq4cyokkmMO6aF6DFbNY8aokS8g60tIZtlLxglEanfJXDKBtp/bGx9aOfO961 nb+CT4iZGLia3HrpLwaEbZ6zT8Wbj1GmQbZXMZoFWtU3LoLyuHlGJeyrx1BNo3t+ePC/ 7Wui5CMB4GtXMoxdbgeGkkbGeD7k5wWdxtFBtpcyOTiRW02iy0AKq8ozmjBky668ZYAG gDO4dB9100n5obW7Ud3SVJDwE+AHVDJd7Vh6ezj0qrM3LMqwjIrBji31ax9a0agYA4MT pPhQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=U5WlW2S6; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e9e14a558f8ab-3738969e79esi34274175ab.163.2024.05.28.08.02.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2024 08:02:03 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=U5WlW2S6; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sByJY-0000jV-5L; Tue, 28 May 2024 11:00:36 -0400 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 1sByJW-0000j8-1Y for qemu-devel@nongnu.org; Tue, 28 May 2024 11:00:34 -0400 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sByJU-00078y-CU for qemu-devel@nongnu.org; Tue, 28 May 2024 11:00:33 -0400 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-5295f201979so1055197e87.2 for ; Tue, 28 May 2024 08:00:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716908429; x=1717513229; 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=PFr0hL1Ar1UbWkc2eKqlJoQWp8y4Pl+E2QiBqPA7F5Y=; b=U5WlW2S6zWgelvtLovxI/v4ub50XSEMhTdcTCwQHDVH1YF1Ibs7qjpC+6QIwXQssjF l1KigkKv1vTJ8oIl9DBOyynkUA5ZtvZB0QZIEFM15Ig8NhPENFM/a7wDRXeDbzpxjCK8 s/TPwtyTFW9t/uYd8btdp1y2Km80Qbd8uBGaLkS7OSGxWwNMr/wAqWW4qC160E0eLAdW 5Wu/DcDl7AneoTJAbFm9tpc7UIrGIcPvhtSk1HvWGGhp2tvi3fJxTDjKVflutrGhUjZ/ VpG90SRMmKCNfz7qykoC0ZftnSOMxHVuAx++FreJw3Yf5slMUjdjWVoaMtUW+ZdOSGEP +0BQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716908429; x=1717513229; 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=PFr0hL1Ar1UbWkc2eKqlJoQWp8y4Pl+E2QiBqPA7F5Y=; b=tGwWn+8p+TlB+CUmwl1+B3D7vyJsSdA2PcYCFTdx01aDVZyzCBUSK/brZeMdXh1wf0 UziJE5ZujXMhYAC4VVedixAo5813lGbD3W9XnAqsNpT5IExZxREiIxjZwCqJh0BrEDMi bbVFG0REJ1tGCWh6x+090frwerQT3kAhHTNVFy7cM7W+pDZ1yTobGDJCiAG094GaPMmd m0KupU4BGHQIGHqK6Kx4rwdYxOL4WAa3VMhRk0hnMICDyLQTC30azVnkoOJnNvX/PF8P KxsWE7v13GbvtUemx6Ez52vzyn4HocCiVAvU8rG9RJ2esVm6n0zLoeYZVUQc10ItwEpJ Kc4w== X-Gm-Message-State: AOJu0YwKXNO8sVzDs3qML+OCJPG/SFTRoCdOG2KzPW84C9OYAx0UD/E6 CY89P/WALX7TJk9mD+w7mE8At6jY8qZixKcog3xH4/rixEiS255cmbXSIby7pY5yuR6feVqXekw 9 X-Received: by 2002:ac2:4acf:0:b0:529:593f:3f3c with SMTP id 2adb3069b0e04-529666d5dfemr8138200e87.53.1716908429187; Tue, 28 May 2024 08:00:29 -0700 (PDT) Received: from m1x-phil.lan ([176.187.214.26]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cc4feadsm617200466b.127.2024.05.28.08.00.28 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 28 May 2024 08:00:28 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Paolo Bonzini , Richard Henderson Subject: [PATCH 6/6] accel/tcg: Move qemu_plugin_vcpu_init__async() to plugins/ Date: Tue, 28 May 2024 16:59:52 +0200 Message-ID: <20240528145953.65398-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240528145953.65398-1-philmd@linaro.org> References: <20240528145953.65398-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::133; envelope-from=philmd@linaro.org; helo=mail-lf1-x133.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Calling qemu_plugin_vcpu_init__async() on the vCPU thread is a detail of plugins, not relevant to TCG vCPU management. Signed-off-by: Philippe Mathieu-Daudé --- accel/tcg/cpu-exec-common.c | 11 ++--------- plugins/core.c | 8 +++++++- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/accel/tcg/cpu-exec-common.c b/accel/tcg/cpu-exec-common.c index 3c4a4c9f21..02499bfb1d 100644 --- a/accel/tcg/cpu-exec-common.c +++ b/accel/tcg/cpu-exec-common.c @@ -57,19 +57,12 @@ void cpu_loop_exit_atomic(CPUState *cpu, uintptr_t pc) cpu_loop_exit_restore(cpu, pc); } -#ifdef CONFIG_PLUGIN -static void qemu_plugin_vcpu_init__async(CPUState *cpu, run_on_cpu_data unused) -{ - qemu_plugin_vcpu_init_hook(cpu); -} -#endif - bool tcg_exec_realize_assigned(CPUState *cpu, Error **errp) { #ifdef CONFIG_PLUGIN cpu->plugin_state = qemu_plugin_create_vcpu_state(); - /* Plugin initialization must wait until the cpu start executing code */ - async_run_on_cpu(cpu, qemu_plugin_vcpu_init__async, RUN_ON_CPU_NULL); + + qemu_plugin_vcpu_init_hook(cpu); #endif return true; diff --git a/plugins/core.c b/plugins/core.c index 0726bc7f25..0eda47ba33 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -245,7 +245,7 @@ static void plugin_grow_scoreboards__locked(CPUState *cpu) end_exclusive(); } -void qemu_plugin_vcpu_init_hook(CPUState *cpu) +static void qemu_plugin_vcpu_init__async(CPUState *cpu, run_on_cpu_data unused) { bool success; @@ -261,6 +261,12 @@ void qemu_plugin_vcpu_init_hook(CPUState *cpu) plugin_vcpu_cb__simple(cpu, QEMU_PLUGIN_EV_VCPU_INIT); } +void qemu_plugin_vcpu_init_hook(CPUState *cpu) +{ + /* Plugin initialization must wait until the cpu start executing code */ + async_run_on_cpu(cpu, qemu_plugin_vcpu_init__async, RUN_ON_CPU_NULL); +} + void qemu_plugin_vcpu_exit_hook(CPUState *cpu) { bool success;