From patchwork Tue May 28 14:59:46 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: 799498 Delivered-To: patch@linaro.org Received: by 2002:adf:e110:0:b0:35b:5a80:51b4 with SMTP id t16csp280755wrz; Tue, 28 May 2024 08:01:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWeM2/mtPOWS6OqXXO7T/ZmZnkYyUdBH7tRbyyjfdd00MZeHNPwQTfun8QhRxrlh2TFh7o1j/ng85v972FteSjp X-Google-Smtp-Source: AGHT+IHzh1rr3JgtgfknHe75tsiZabkcjWbeo7A7WrMh0EjH3kNhpJkmCRTD2GDRvuTa5xFvJoxp X-Received: by 2002:a05:6870:1642:b0:24f:c95b:ac2 with SMTP id 586e51a60fabf-24fc95b3788mr10593691fac.39.1716908487375; Tue, 28 May 2024 08:01:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716908487; cv=none; d=google.com; s=arc-20160816; b=Yhyr++lGWJzAuyzmodeLJncsw01Q4j0Jq/8+izV2jRmpE9QYCJR9RzjaODILRkms1m 1Q6Y8o/yCu5SraH68kOGyKwycSNSyIcWLkgma/ETvl6riw+ZiXQLVNpBqzSdr61bztQx tHhYqGfWAxgvK49h5ZOyn8xrcFiu4dovMRuANKfzpYM1MktWsvq6NXRdM5t2jRlLBvm2 0olEi/FLYPEdrVjgUw8658v6jU4VVRZfd+4IMD8xVRBt7X/KLg6EkfdDUAHiGzPHoQ7i 1stC6vewkkuuBgG59bFJ9SX2mWv92xQZTYoRCxbLcr7/o+lqD2zUcLetrgmxv8K+xoyj jAcQ== 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=mTKuvHP1QSNGLlDZjOj7K/EbEPOmCMuDO5B33J0CCSg=; fh=g71ocj76I19MS7AD71vLKnbNbl87LKTjuBKf8cOVRXA=; b=vJiwcdxWUGy/cBZEg2p3r9xgGXNRRTDudlRYKNak1eJlYBcv7AnJUk471LgNM63Ov+ Fk/bjope4pk2ru0GEk/EM2wu/WjqfFR6k9bf6N/rNThFKNxKBNTGjK3B/18StcFXragl 76hpPD2T3ZNBgfHtZG/TOk676cl4Ihbg5aPGbEAHeU7jVEodedu+H/Ua4Ie6NcjVz4kr uVDuf23TevFdGPkwHVHG0SmNJyyjrEEbGY7/emG0y6cwnTNLM4ZuAL0fRBSa3OMLDbEo ubTQwDB9NhMENlU1bSdbVetkPrMvWh2IN0Igh0YBjiLzXoX/UzAXYR3eu+nlJ6G/rMoI l6nA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cNVaqva0; 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 ada2fe7eead31-48b93611c2dsi310835137.16.2024.05.28.08.01.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2024 08:01:27 -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=cNVaqva0; 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 1sByJ2-0000Y7-24; Tue, 28 May 2024 11:00:04 -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 1sByIz-0000X1-VK for qemu-devel@nongnu.org; Tue, 28 May 2024 11:00:02 -0400 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sByIx-0006ov-BU for qemu-devel@nongnu.org; Tue, 28 May 2024 11:00:01 -0400 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-52965199234so1081600e87.2 for ; Tue, 28 May 2024 07:59:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716908396; x=1717513196; 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=mTKuvHP1QSNGLlDZjOj7K/EbEPOmCMuDO5B33J0CCSg=; b=cNVaqva0huvawL8G6yI6cnGurgQglSqgYP6mIWvxwv1TSkyoIqtzX09JUhBSxaqdTh U6bwCl9zw2xnByCJJIByp95wOVx1FO0oriapocWNHFG+/1lb3Gz4t0174Cgh61EFEvGj Uj+XCwzO5RLM2M6BHBZHgIF6LtyaOyPxrgAFXn62IEsMFJL44AOVffyAGZYSsqUzjCFH azZXgklfxx6gpk4X3T7MPHb63D4jzo3+GKd3KeBfKM1MrT8xG6WWJNqsa5RHHcfwBV/D /oypzlxhL28VUJDWBzA15XQ+kAkF+1rMhDiKdqO/oR+03nZfa1TQVDztlIdPGibDXIlU TSNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716908396; x=1717513196; 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=mTKuvHP1QSNGLlDZjOj7K/EbEPOmCMuDO5B33J0CCSg=; b=Qdw1LMxOmV2GfhacFPB57NEwIT3nZrq40SJzErpnVO1rnXVnuLaHxIweJO8Uwhwyxq Mf3zAt4dOD1M3xlDE47e+5i2ym8e0GDPYPBPbSOea+bidqz4Zx7olg5upcuRzX39+FbQ 2aLZxzuMHYVZi1kQCrN5IywpL50y6z045emYDA/E9ne5OwdojtRq9t59li5kQkSM0cw+ UMC653kkMp5zOCKoRSZLMo//+hE69iPSF4pZbIl+jmwSw9HO9qkGoeXBvOVwL66Oh4Wx mK+VdCwQFHKla8uhMRLNnsNiMZygVn6wU/wedw/u94m4SUdb5K5ILZBDNJA3gz8/xN0c ecpQ== X-Gm-Message-State: AOJu0Yw9xFMqQfToazlbf3LpSMM1L9s+WQfSNKEddHxyMWioZyD0WXUU s3NbXJzZFDuBU1mgg4aMxfo/Lb6x9yvqAs1rXjD8J7BMSAqXY4VvDTapShNnyRYNGbhWpYg7a2X o X-Received: by 2002:a05:6512:1112:b0:529:b717:2a0e with SMTP id 2adb3069b0e04-529b7172ce6mr2957608e87.18.1716908395810; Tue, 28 May 2024 07:59:55 -0700 (PDT) Received: from m1x-phil.lan ([176.187.214.26]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-579cd4c85c7sm3688721a12.20.2024.05.28.07.59.54 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 28 May 2024 07:59:55 -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 0/6] accel: Restrict TCG plugin (un)registration to TCG accel Date: Tue, 28 May 2024 16:59:46 +0200 Message-ID: <20240528145953.65398-1-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12e; envelope-from=philmd@linaro.org; helo=mail-lf1-x12e.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 Hi, TL;DR; this series remove TCG plugin code from generic accel code. Since the introduction of the scoreboard in plugins, the INIT hook use the vCPU index, which is only available somewhere during the vCPU REALIZE() step (see below for call tree). In order to clarify that, we split accel_cpu_common_[un]realize as *unassigned and *assigned steps. This allow to remove the plugin [un]registration code from common accel code. Another approach suggested by rth is to add a PostRealize() handler in DeviceClass. This was already experimented here: https://lore.kernel.org/qemu-devel/20240209123226.32576-1-philmd@linaro.org/ Since it is a change harder to sell, I took this simplified path which just make the vCPU REALIZE a bit more complex, but not really an concern since the current call tree is https://etherpad.opendev.org/p/QEMU_vCPU_life. Philippe Mathieu-Daudé (6): system/runstate: Remove unused 'qemu/plugin.h' header accel/tcg: Move common declarations to 'internal-common.h' accel: Clarify accel_cpu_common_[un]realize() use unassigned vCPU accel: Introduce accel_cpu_common_[un]realize_assigned() handlers accel: Restrict TCG plugin (un)registration to TCG accel accel/tcg: Move qemu_plugin_vcpu_init__async() to plugins/ accel/tcg/internal-common.h | 17 ++++++++++++++++ accel/tcg/internal-target.h | 14 ------------- include/qemu/accel.h | 39 ++++++++++++++++++++++++++++++------- include/qemu/plugin.h | 6 ------ accel/accel-target.c | 34 +++++++++++++++++++++++++++----- accel/tcg/cpu-exec-common.c | 20 +++++++++++++++++++ accel/tcg/cpu-exec.c | 4 ++-- accel/tcg/tcg-all.c | 8 +++++--- cpu-target.c | 10 ++++++++-- hw/core/cpu-common.c | 25 ------------------------ plugins/core.c | 8 +++++++- system/runstate.c | 1 - 12 files changed, 120 insertions(+), 66 deletions(-) Reviewed-by: Richard Henderson Reviewed-by: Pierrick Bouvier