From patchwork Mon Jan 6 20:02:51 2025 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: 13927807 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 366271DD9A6 for ; Mon, 6 Jan 2025 20:03:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736193787; cv=none; b=mmGifAMuP3gqGWRmzSVVKZDkzc07uEGKHmadNTPyLBMNnov1on7yNvFp+A65+e97Yu9GyVN9+pooDWj2vqOL59rjvznEhdZlJthrmy4HToJZXi+LhWaBfP5Ztq6CcPsbIWJP5bFcnAMfRMSSB0cpGqw0PJNO/boTmaeJkEsTolI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736193787; c=relaxed/simple; bh=BNHpS4glZyoiXUMHz6FKIlmB1PYCsfVOgxZrMXfj3Ms=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=g9Q/SixpJkgMpgCIZ6t/am1NdDUY6zeih7kDLrwCVTn/Tn/umSQK/ar9wOD3inCVWfcYoqwzWgTXMvbnkJBwi6tNwJOJOKP0DnUeng22ChlijrSGbd21UbWI2Jwhiv7A9UgmC7JwB7bA/SbrMMGX5AgU6AAmhq8pvCSFXiUPOgI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Pbh92jEU; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Pbh92jEU" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-436281c8a38so105989715e9.3 for ; Mon, 06 Jan 2025 12:03:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736193783; x=1736798583; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=IVQDyU0aZGqnbGo58WYklNw0MeL8aFrKkG5Vri/XHzI=; b=Pbh92jEUeUYTsixLKUpcvfQeib7I8BSrZZ7YVeR4Jc5AwD/8ZatcatrLUjJgwB0KvV 5eWuGVRGJpJwxkZe5AQuNKtpLhsi7VCtN7lNDAaZAKE8lVhCN9SMapkna8Atun4Dolst qs+RSegHvNNTunkT5wWcYdrYn+5Jltqv4PWLzPsyh0OWV13GEDGqvutSpnUG7BcG9EIY CAfrkRGspBd8Az8ImUl1547TQaG+DIGZ9UvA4u4X8Gdbc9YJuQpDKBmjNrrhKZz/0lUa bs9I4LWUK5j36W5wnXl0hxmSc7vDDPq8FiOi/ZRAPAX4Z7OjdJHZMyxBvUQ1Rbg7DtPT 5c5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736193783; x=1736798583; 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=IVQDyU0aZGqnbGo58WYklNw0MeL8aFrKkG5Vri/XHzI=; b=ONCncTSkl8/Zl0MJzhy8IZpN4biashC8O1wFCtrlmf0cSAPusTp3ATQVJ3nfLvoUmM DmKVbL69km9nPqGCB7EC/MZOIXWGrDUcalOhXTnSxbrSBoRGhXm7o5Q6XPiYA/nYDQjj L4W40hM8mkvsS4cFoQnhpXFUodIqUnivvYg3K9q0cbP5jbqw+bXiPqkFdHesxCAmc/Zf ufsW+pwTB+x6jgXZP9JoRqRelSYAXivEHFG0UYpCr0ccUlAC8lPeuvQ5nR2RFOYUkzeM 5Ma0VDPxSD9WwzLpw4ienvdIer0sNCBevD1lLNfEoCdJsMR0c5Sn3xkYgGFvBPljwRvk QQuQ== X-Forwarded-Encrypted: i=1; AJvYcCVi3R7nnVPNm/3p3puQk6ii4tjUdc/UT2a75nj6Y8WPzj4y7uf4Fbj0oyWVQfX2Pr8SxJ8=@vger.kernel.org X-Gm-Message-State: AOJu0Yxp8l/3sCRBXpiKq1qqiypmDp5A1jJmt5BGJYivar1zWYFC5BE/ Ww1so4Zgz0S9R0UCjZktZDoqqi3pYPpTZtT0fFhYHWo9u5D0x/EPwojrAy3AaTE= X-Gm-Gg: ASbGncupAQS/uT8boZTJgEDdQqjp1cQ5FyranbR60+gUP/QvDyXqcQyWUx3TzLS+5mZ d075qshguYTG/BTrRVTI9k0ZIAXSUcekrKT033Binn68n3p2zhbKnKfytUjopzaUEclyuLBlRUb FqtmWzyYKaNMNiw8fZoLHgx7+kM4UNgmw2POSz99Mzt/FTMkdcKk8MCRXgsuSYPbjE0LevQvpM0 LCiJZ9wiY3og60N8+IrFgyBDd2HkndPsLCrXwN3m3Q/iK1DCDD1lRC1QgX3eyBfN8XXqER4dcas XLnJGX6XVmsqzVvsBN37SZLX1tx+HKw= X-Google-Smtp-Source: AGHT+IEvY1dOIYQWFga9MrJsSFG0JoKzIh1x57mMzgTfD/hBdAZ0c+WqLtNl81G5solsww92cOjYAA== X-Received: by 2002:a05:600c:450f:b0:434:fb65:ebbb with SMTP id 5b1f17b1804b1-436686461cbmr539399575e9.17.1736193783280; Mon, 06 Jan 2025 12:03:03 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43656b3b2a4sm611962245e9.27.2025.01.06.12.02.59 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 06 Jan 2025 12:03:01 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Daniel Henrique Barboza , =?utf-8?b?RnLDqWQ=?= =?utf-8?b?w6lyaWMgQmFycmF0?= , Stefano Stabellini , Ilya Leoshkevich , Cameron Esfahani , Paolo Bonzini , kvm@vger.kernel.org, Alexander Graf , Paul Durrant , David Hildenbrand , Halil Pasic , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Marcel Apfelbaum , xen-devel@lists.xenproject.org, qemu-arm@nongnu.org, =?utf-8?q?C=C3=A9dric_?= =?utf-8?q?Le_Goater?= , Yanan Wang , Reinoud Zandijk , Peter Maydell , qemu-s390x@nongnu.org, Riku Voipio , Anthony PERARD , Alistair Francis , Sunil Muthuswamy , Christian Borntraeger , Nicholas Piggin , Richard Henderson , Marcelo Tosatti , Thomas Huth , Roman Bolshakov , "Edgar E . Iglesias" , Zhao Liu , Phil Dennis-Jordan , David Woodhouse , Harsh Prateek Bora , Nina Schoetterl-Glausch , "Edgar E. Iglesias" , Eduardo Habkost , qemu-ppc@nongnu.org, Daniel Henrique Barboza , "Michael S. Tsirkin" , Anton Johansson Subject: [RFC PATCH 0/7] accel: Add per-accelerator vCPUs queue Date: Mon, 6 Jan 2025 21:02:51 +0100 Message-ID: <20250106200258.37008-1-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Hi, Currently we register all vCPUs to the global 'cpus_queue' queue, however we can not discriminate per accelerator or per target architecture (which might happen in a soon future). This series tries to add an accelerator discriminator, so accelerator specific code can iterate on its own vCPUs. This is required to run a pair of HW + SW accelerators like the (HVF, TCG) or (KVM, TCG) combinations. Otherwise, i.e. the HVF core code could iterate on TCG vCPUs... To keep it simple and not refactor heavily the code base, we introduce the CPU_FOREACH_TCG/HVF/KVM() macros, only defined for each accelerator. This is just a RFC to get some thoughts whether this is heading in the correct direction or not ;) Regards, Phil. Philippe Mathieu-Daudé (7): cpus: Restrict CPU_FOREACH_SAFE() to user emulation cpus: Introduce AccelOpsClass::get_cpus_queue() accel/tcg: Implement tcg_get_cpus_queue() accel/tcg: Use CPU_FOREACH_TCG() accel/hw: Implement hw_accel_get_cpus_queue() accel/hvf: Use CPU_FOREACH_HVF() accel/kvm: Use CPU_FOREACH_KVM() accel/tcg/tcg-accel-ops.h | 10 ++++++++++ include/hw/core/cpu.h | 11 +++++++++++ include/system/accel-ops.h | 6 ++++++ include/system/hvf_int.h | 4 ++++ include/system/hw_accel.h | 9 +++++++++ include/system/kvm_int.h | 3 +++ accel/accel-system.c | 8 ++++++++ accel/hvf/hvf-accel-ops.c | 9 +++++---- accel/kvm/kvm-accel-ops.c | 1 + accel/kvm/kvm-all.c | 14 +++++++------- accel/tcg/cputlb.c | 7 ++++--- accel/tcg/monitor.c | 3 ++- accel/tcg/tb-maint.c | 7 ++++--- accel/tcg/tcg-accel-ops-rr.c | 10 +++++----- accel/tcg/tcg-accel-ops.c | 16 ++++++++++++---- accel/tcg/user-exec-stub.c | 5 +++++ accel/xen/xen-all.c | 1 + cpu-common.c | 10 ++++++++++ hw/i386/kvm/clock.c | 3 ++- hw/intc/spapr_xive_kvm.c | 5 +++-- hw/intc/xics_kvm.c | 5 +++-- system/cpus.c | 5 +++++ target/arm/hvf/hvf.c | 4 ++-- target/i386/kvm/kvm.c | 4 ++-- target/i386/kvm/xen-emu.c | 2 +- target/i386/nvmm/nvmm-accel-ops.c | 1 + target/i386/whpx/whpx-accel-ops.c | 1 + target/s390x/kvm/kvm.c | 2 +- target/s390x/kvm/stsi-topology.c | 3 ++- 29 files changed, 130 insertions(+), 39 deletions(-)