From patchwork Thu May 30 19:42:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 800210 Delivered-To: patch@linaro.org Received: by 2002:a5d:65c4:0:b0:35b:5a80:51b4 with SMTP id e4csp401595wrw; Thu, 30 May 2024 12:44:32 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVllafRbLfKhPqAtVp6ZxAUpexWo06+gQ4BaqReBOWEu4lmNPE7m5b4imXpsdt/JAFrvW4DUmIniI7kX0++GlQP X-Google-Smtp-Source: AGHT+IFv7xhD8vKBjs33vp1szEAAIWy/7aNgygFalaDELc+H48LMhiLlnlwMXgLICCVu6mntHY7l X-Received: by 2002:a05:6870:7012:b0:23c:1f34:730 with SMTP id 586e51a60fabf-25060de60a5mr3562310fac.49.1717098272297; Thu, 30 May 2024 12:44:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717098272; cv=none; d=google.com; s=arc-20160816; b=ISuqRJkrWx8CVEhqv6/Ef91y/1wJGXQ3yhs4653leD2cKUTxYcZQL6bSA1YB97dGbw 9b+d9bf1AarkUoUMphsjEzPjRlC8agubbwjOOD830TjzZeQuVMBC6FVzlZa5jtKvG1Jx kfMkJGlt0Z6w2adEJE5fn9w7JAQ+QPnVuBBqbhTfacm/kgkirnxgjxXn4rSvDq+OPzda 0Jdq/+/XTOED1+iZsjWJmZGiQNey+onOAZMHmtzTb+Bjp68Mp4YQ0c5y3I3yNdbhYl7T wS7+uyxO3zwZrkGXYtp0yClJPAYZ/QRvu4IXmlWYIb8m53jZ3Mn1SWqaeipnYrE51MVv dMbw== 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:message-id:date:subject:cc:to:from:dkim-signature; bh=65gU5Nwavd2bAlOw69K09QPcTa07oz7htXi9Z4Z1lS8=; fh=aWK/WapK4xf8SGfzgOGJ7AoHDKO+C0u8XFOVHWsQNds=; b=VhDW+yL7DBUVCm0S5U3IRS/coo2audzLCWR1cD+EZbxYMWo2TjwztB7mKud9Plu18y unGoPAVs2QsRQALT5Yh6s2t5XFs9MlVlaH/ths7xUgTX7+4ALEUFi/567i4EUxHY7URF Elrykpc44wiuUOmq6TiA4YFGydETZx4QaWsaWpmQzBUYXr8jvDEGvUrkJQ+tAe0fUawo gPIn5EufbXmztHA4T+CvuqLf8IfwvETA3qeSOGmIN7cqSGfx/7EqYHHK7w46uJSExedl fEfdYtVjvGF5nFMr1Z4TXKG7lBunWRLs/MQ5gS3tCYV2/Opb5+D8P0iXKElXR/3FZKh7 X+Hg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kZ2wpcUY; 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 d75a77b69052e-43ff2466ca5si3127471cf.267.2024.05.30.12.44.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 30 May 2024 12:44:32 -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=kZ2wpcUY; 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 1sClfv-0005bg-BG; Thu, 30 May 2024 15:42:59 -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 1sClfu-0005bR-Hg for qemu-devel@nongnu.org; Thu, 30 May 2024 15:42:58 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sClfs-0006HH-2n for qemu-devel@nongnu.org; Thu, 30 May 2024 15:42:58 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-42120fc8d1dso13738105e9.2 for ; Thu, 30 May 2024 12:42:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717098171; x=1717702971; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=65gU5Nwavd2bAlOw69K09QPcTa07oz7htXi9Z4Z1lS8=; b=kZ2wpcUYLW56K9PnAbqjplmDl/2DOX0/vfKZg9jsbva4+QdKeGmQYpGfW9hmymmHh7 7p7HlGUzsW/fW06QvxPSu1OO+SPw0WqXGyzOjKL3toUuOF//Nkm491PPrgnX3yDddbF8 S4K71CbAgaAqWFTs5KXbXfEpIPMdnk+j0dQVA+7J5hOO/99/GEEsr+cgfpWofabkFrB+ Ng4qZWBTWT6DgPHSzVVfQEsb/GetyYj4s3Ma5u+MGhogS6y7d3PY1tVYM/J7v8jPcYWO sMDxWXytuaH51XKbsA0k65lQZJFG5mQoQgIsE8tDTs7plHwcjKTnHIggwvvUSdKKF6nD DWkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717098171; x=1717702971; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=65gU5Nwavd2bAlOw69K09QPcTa07oz7htXi9Z4Z1lS8=; b=A3LUAoXCHkoxF8d44Cpxgsv6QLH1FpVf/aCH7n0cZrPaXCgYj5wY8YYAZExDnhQl+7 4FkWXXsD1SdlfYcfUbEboITBFG+creRFnAVcwK7HgK2vCwdyfF6bnH8vTCQAvk5efmhy lMGL2H4n45/CntSq8q+SRoVH2yUwpa6eBCpmBlEAt0fWo7z7awDhUncAMEUXcMkONldL z59Xynn1zUBMxIymdQbB1tOlkqUce6DT5rNpcg/gJbp0qVhlBdke9DMhZ/O5PcPmYDYO OJOXzbn8lkVWPC66Uf9x1Cm/hb04A+xDikLDrYSEpW4R0P0E9RHQUyawroR2Lq9SQ5cN AcGQ== X-Gm-Message-State: AOJu0YxQiMc8Hf0eNFe3lvKbfCIgIGuEVMat+1SBxT9v0cn2uXL34huK iWuHYHASZ6ZkSD+J4TEuG62GDuKZbh+oLCn/9ZeQfuvrr/iYQeUSZ37jEnMMEWg= X-Received: by 2002:a05:600c:470a:b0:41a:e995:b915 with SMTP id 5b1f17b1804b1-421278130cbmr28854985e9.1.1717098171508; Thu, 30 May 2024 12:42:51 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57a31bb8253sm146492a12.29.2024.05.30.12.42.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 12:42:51 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 8D54E5F8CB; Thu, 30 May 2024 20:42:50 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , Cameron Esfahani , Alexandre Iooss , Yanan Wang , Paolo Bonzini , Eduardo Habkost , Sunil Muthuswamy , Richard Henderson , Pierrick Bouvier , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= , Mahmoud Mandour , Reinoud Zandijk , =?utf-8?q?Alex_Benn=C3=A9e?= , kvm@vger.kernel.org, Roman Bolshakov Subject: [PATCH 0/5] cpus: a few tweaks to CPU realization Date: Thu, 30 May 2024 20:42:45 +0100 Message-Id: <20240530194250.1801701-1-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x329.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 The recent IPS plugin exposed a race condition between vcpu_init callbacks and the other vcpu state callbacks. I originally thought there was some wider re-factoring to be done to clean this up but it turns out things are broadly where they should be. However some of the stuff allocated in the vCPU threads can clearly be done earlier so I've moved enough from cpu_common_realizefn to cpu_common_initfn to allow plugins to queue work before the threads start solving the race. Please review. Alex Bennée (5): hw/core: expand on the alignment of CPUState cpu: move Qemu[Thread|Cond] setup into common code cpu-target: don't set cpu->thread_id to bogus value plugins: remove special casing for cpu->realized core/cpu-common: initialise plugin state before thread creation include/hw/core/cpu.h | 18 ++++++++++++++---- accel/dummy-cpus.c | 3 --- accel/hvf/hvf-accel-ops.c | 4 ---- accel/kvm/kvm-accel-ops.c | 3 --- accel/tcg/tcg-accel-ops-mttcg.c | 4 ---- accel/tcg/tcg-accel-ops-rr.c | 14 +++++++------- cpu-target.c | 1 - hw/core/cpu-common.c | 25 +++++++++++++++++-------- plugins/core.c | 6 +----- target/i386/nvmm/nvmm-accel-ops.c | 3 --- target/i386/whpx/whpx-accel-ops.c | 3 --- 11 files changed, 39 insertions(+), 45 deletions(-)