From: "Radim Krčmář" <rkrcmar@ventanamicro.com>
To: kvm-riscv@lists.infradead.org
Cc: kvm@vger.kernel.org, linux-riscv@lists.infradead.org,
linux-kernel@vger.kernel.org, Anup Patel <anup@brainfault.org>,
Atish Patra <atishp@atishpatra.org>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexandre Ghiti <alex@ghiti.fr>,
Andrew Jones <ajones@ventanamicro.com>
Subject: [PATCH v2 0/2] VCPU reset fixes
Date: Thu, 8 May 2025 16:28:41 +0200 [thread overview]
Message-ID: <20250508142842.1496099-2-rkrcmar@ventanamicro.com> (raw)
Hello,
v2 abandons the idea of fixing current userspaces and adds a new
capability that uses MP_STATE to immediately trigger a KVM VCPU reset --
a single-purpose interface free of any unintended side effects is
desirable and MP_STATE is somewhat bendable, which avoids the need for a
new IOCTL. It's very dirty, though, so I'm not happy with it.
I have prepared a preview QEMU implementation [1] and only did light
testing with kvm-unit-tests as I still expect a high-level discussion.
Because it didn't take much effort on top, v2 expands the goals --
userspace can now choose the same post-reset state for all VCPUs.
(This is achieved by returning from userspace on sbi_hart_stop; let me
know if I should rather do that with another KVM capability.)
This series does not fully address the VCPU hot-unplug.
We still need a better KVM interface there, because the VCPU stopped by
sbi_hart_stop is still assumed to be present by sbi_hart_start.
I see roughly two options, with different drawbacks:
* add a new MP_STATE for the SBI HSM acceleration in KVM
* return to userspace even on sbi_hart_start and sbi_hart_get_status
(We might want to have a better interface for handing SBI in userspace
anyway, so that could be handled later.)
v2 is based on kvm-riscv/riscv_kvm_queue, 376e3c0f8aa5 ("KVM: RISC-V:
remove unnecessary SBI reset state").
Most of the patches from v1 got merged, thanks Anup, so v2 only contains
the completely redesigned approach [2/2] and a minor code style
improvement that fell through the cracks when the patches got merged out
of order [1/2].
---
1: https://github.com/qemu/qemu/commit/dec042841f383c6a825b1642b86d9f585778a2e7
Radim Krčmář (2):
KVM: RISC-V: reset smstateen in a better place
RISC-V: KVM: add KVM_CAP_RISCV_MP_STATE_RESET
Documentation/virt/kvm/api.rst | 15 +++++++++++
arch/riscv/include/asm/kvm_host.h | 3 +++
arch/riscv/include/asm/kvm_vcpu_sbi.h | 1 +
arch/riscv/kvm/vcpu.c | 39 ++++++++++++++++-----------
arch/riscv/kvm/vcpu_sbi.c | 17 ++++++++++++
arch/riscv/kvm/vcpu_sbi_hsm.c | 7 ++++-
arch/riscv/kvm/vcpu_sbi_system.c | 3 ++-
arch/riscv/kvm/vm.c | 13 +++++++++
include/uapi/linux/kvm.h | 1 +
9 files changed, 82 insertions(+), 17 deletions(-)
--
2.49.0
next reply other threads:[~2025-05-08 14:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-08 14:28 Radim Krčmář [this message]
2025-05-08 14:28 ` [PATCH v2 1/2] KVM: RISC-V: reset smstateen in a better place Radim Krčmář
2025-05-09 5:13 ` Anup Patel
2025-05-08 14:28 ` [PATCH v2 2/2] RISC-V: KVM: add KVM_CAP_RISCV_MP_STATE_RESET Radim Krčmář
2025-05-09 6:55 ` Anup Patel
2025-05-09 8:46 ` Radim Krčmář
2025-05-09 12:03 ` Anup Patel
2025-05-09 12:19 ` Andrew Jones
2025-05-09 12:29 ` Anup Patel
2025-05-09 13:57 ` Radim Krčmář
2025-05-11 13:43 ` Anup Patel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250508142842.1496099-2-rkrcmar@ventanamicro.com \
--to=rkrcmar@ventanamicro.com \
--cc=ajones@ventanamicro.com \
--cc=alex@ghiti.fr \
--cc=anup@brainfault.org \
--cc=aou@eecs.berkeley.edu \
--cc=atishp@atishpatra.org \
--cc=kvm-riscv@lists.infradead.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox