[PATCH v11 0/2] target/riscv: Fix riscv64 KVM migration

Xie Bo <[email protected]>
Newsgroups gmane.comp.emulators.qemu
Message-ID <[email protected]>
This series revives v9, which was applied to riscv-to-apply.next but did
not reach QEMU master.

RISC-V KVM migration currently loses two pieces of vCPU state: the
privilege mode core register and KVM MP state. The latter leaves secondary
vCPUs in their reset STOPPED state on the destination.

Synchronize the privilege mode through the existing generic CPU VMState,
and carry MP state in a capability-gated KVM-only subsection. The subsection
keeps KVM state out of TCG migration streams. Bump the generic RISC-V CPU
VMState version and minimum version to 12 as required by the new pre_load
hook and subsection.

Changes from v10:
- Bump the RISC-V CPU VMState version_id and minimum_version_id to 12.
- Add Daniel's Reviewed-by tags.

Testing on a native riscv64 host with Linux 6.6.20 and GCC 13.3.0:
- KVM build: riscv64-softmmu, --enable-kvm.
- Non-KVM build: riscv64-softmmu, --disable-kvm.
- Four-vCPU KVM migration on unmodified master: all vCPUs failed to run
  after migration and the guest reported RCU stalls.
- The same migration with this series: CPU0 through CPU3 all ran after
  migration.
- Four user-mode busy workers, one pinned to each vCPU, all made forward
  progress across migration to exercise privilege-mode restoration.

Xie Bo (2):
  target/riscv/kvm: Synchronize privilege mode
  target/riscv/kvm: Preserve MP state across migration

 target/riscv/cpu.h           |  4 +++
 target/riscv/kvm/kvm-cpu.c   | 62 ++++++++++++++++++++++++++----------
 target/riscv/kvm/kvm_riscv.h |  2 +-
 target/riscv/machine.c       | 49 ++++++++++++++++++++++++++--
 4 files changed, 98 insertions(+), 19 deletions(-)

-- 
2.17.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.