[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240410-2a41e43624596a442d6a95cd@orel>
Date: Wed, 10 Apr 2024 09:10:14 +0200
From: Andrew Jones <ajones@...tanamicro.com>
To: Atish Patra <atishp@...osinc.com>
Cc: linux-kernel@...r.kernel.org, Anup Patel <anup@...infault.org>,
Ajay Kaher <akaher@...are.com>, Alexandre Ghiti <alexghiti@...osinc.com>,
Alexey Makhalov <amakhalov@...are.com>, Conor Dooley <conor.dooley@...rochip.com>,
Juergen Gross <jgross@...e.com>, kvm-riscv@...ts.infradead.org, kvm@...r.kernel.org,
linux-kselftest@...r.kernel.org, linux-riscv@...ts.infradead.org,
Mark Rutland <mark.rutland@....com>, Palmer Dabbelt <palmer@...belt.com>,
Paolo Bonzini <pbonzini@...hat.com>, Paul Walmsley <paul.walmsley@...ive.com>,
Shuah Khan <shuah@...nel.org>, virtualization@...ts.linux.dev,
VMware PV-Drivers Reviewers <pv-drivers@...are.com>, Will Deacon <will@...nel.org>, x86@...nel.org
Subject: Re: [PATCH v5 21/22] KVM: riscv: selftests: Add a test for PMU
snapshot functionality
On Tue, Apr 09, 2024 at 03:52:40PM -0700, Atish Patra wrote:
> On 4/5/24 06:11, Andrew Jones wrote:
> > On Wed, Apr 03, 2024 at 01:04:50AM -0700, Atish Patra wrote:
..
> > > + probe = guest_sbi_probe_extension(SBI_EXT_PMU, &out_val);
> > > + GUEST_ASSERT(probe && out_val == 1);
> > > +
> > > + if (get_host_sbi_spec_version() < sbi_mk_version(2, 0))
> > > + __GUEST_ASSERT(0, "SBI implementation version doesn't support PMU Snapshot");
> > > +}
> >
> > It's a pity we can't check the SBI spec version that KVM is advertising
> > from KVM userspace. Normally we'd want to check something like this at
> > the start of the test with TEST_REQUIRE() before running a VCPU in order
> > to generate a skip exit.
> >
>
> Agreed. I will send a separate series for that as it is an ABI change.
>
> > (We probably should allow reading and even writing the SBI spec version
> > from the VMM in order to better support migration.)
> >
>
> How that would work for SBI spec version write use case ? For migraiton, you
> can't go back to older SBI versions in the host. Isn't it ?
>
> Considering this case your VM is running with PMU snapshot as the host has
> SBI v2.0. It can't be migrated to v1.0 and expecting it work. Correct ?
>
We can start a VM on a host with SBI v2.0, but tell KVM to tell the VM
that it has v1.0. Then, the guest shouldn't use any features from SBI
that appear after v1.0 and it should be safe to migrate to a host with
v1.0.
A more likely scenario might be this though:
1. KVM userspace checks and captures the SBI version of the host where
the VM is first being launched, e.g. v2.0
2. The VM gets migrated to another host which supports something later,
e.g. v3.0, but to
- avoid possibly confusing the guest we tell the destination host
that it should expose v2.0 as the SBI version
- allow rollback to the source host without concern that the guest
has already seen v3.0 and started to use something that the
source can't provide
Thanks,
drew
Powered by blists - more mailing lists