linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Cornelia Huck <cohuck@redhat.com>
To: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>,
	"kvmarm@lists.linux.dev" <kvmarm@lists.linux.dev>,
	"maz@kernel.org" <maz@kernel.org>,
	"oliver.upton@linux.dev" <oliver.upton@linux.dev>
Cc: "catalin.marinas@arm.com" <catalin.marinas@arm.com>,
	"will@kernel.org" <will@kernel.org>,
	"mark.rutland@arm.com" <mark.rutland@arm.com>,
	"eric.auger@redhat.com" <eric.auger@redhat.com>,
	yuzenghui <yuzenghui@huawei.com>,
	"Wangzhou (B)" <wangzhou1@hisilicon.com>,
	jiangkunkun <jiangkunkun@huawei.com>,
	Jonathan Cameron <jonathan.cameron@huawei.com>,
	Anthony Jebson <anthony.jebson@huawei.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	Linuxarm <linuxarm@huawei.com>
Subject: RE: [RFC PATCH 0/6] KVM: arm64: Errata management for VM Live migration
Date: Fri, 11 Oct 2024 16:14:33 +0200	[thread overview]
Message-ID: <87h69irak6.fsf@redhat.com> (raw)
In-Reply-To: <54afcc8182d341d8ab294d8a54c1fbf3@huawei.com>

On Fri, Oct 11 2024, Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com> wrote:

>> -----Original Message-----
>> From: Cornelia Huck <cohuck@redhat.com>
>> Sent: Friday, October 11, 2024 2:18 PM
>> To: Shameerali Kolothum Thodi
>> <shameerali.kolothum.thodi@huawei.com>; kvmarm@lists.linux.dev;
>> maz@kernel.org; oliver.upton@linux.dev
>> Cc: catalin.marinas@arm.com; will@kernel.org; mark.rutland@arm.com;
>> eric.auger@redhat.com; yuzenghui <yuzenghui@huawei.com>; Wangzhou
>> (B) <wangzhou1@hisilicon.com>; jiangkunkun
>> <jiangkunkun@huawei.com>; Jonathan Cameron
>> <jonathan.cameron@huawei.com>; Anthony Jebson
>> <anthony.jebson@huawei.com>; linux-arm-kernel@lists.infradead.org;
>> Linuxarm <linuxarm@huawei.com>
>> Subject: Re: [RFC PATCH 0/6] KVM: arm64: Errata management for VM Live
>> migration
>> 
>> On Fri, Oct 11 2024, Shameer Kolothum
>> <shameerali.kolothum.thodi@huawei.com> wrote:
>> 
>> > Hi,
>> >
>> > On ARM64 platforms most of the errata workarounds are based on CPU
>> > MIDR/REVIDR values and a number of these workarounds need to be
>> > implemented by the Guest kernel as well. This creates a problem when
>> > Guest needs to be migrated to a platform that differs in these
>> > MIDR/REVIDR values even if the VMM can come up with a common
>> minimum
>> > feature list for the Guest using the recently introduced "Writable
>> > ID registers" support.
>> >
>> > (This is roughly based on a discussion I had with Marc and Oliver
>> > at KVM forum. Marc outlined his idea for a solution and this is an
>> > attempt to implement it. Thanks to both and I take all the blame
>> > if this is nowhere near what is intended/required)
>> >
>> > This RFC proposes a solution to handle the above issue by introducing
>> > the following,
>> >
>> > 1. A new VM IOCTL,
>> >    KVM_ARM_SET_MIGRN_TARGET_CPUS  _IOW(KVMIO,  0xb7, struct
>> kvm_arm_migrn_cpus)
>> >    This can be used by the userspace(VMM) to set the target CPUs the
>> >    Guest will run in its lifetime. See patch #2
>> > 2. Add hypercall support for Guest kernel to retrieve any migration
>> >    errata bitmap(ARM_SMCCC_VENDOR_HYP_KVM_MIGRN_ERRATA)
>> >    The above will return the bitmaps in R0-R3 registers. See patch #4
>> > 3. The "capability" field in struct arm64_cpu_capabilities is a generated
>> >    one at present and may get renumbered or reordered. Hence, we can't
>> use
>> >    this directly for migration errata bitmaps. Instead, introduced
>> >    "migartion_safe_cap", which has to be set statically for any
>> >    erratum that needs to be enabled and is safe for migration
>> >    purposes. See patches 3 & 6.
>> > 4. Rest of the patches includes the plumbing required to populate the
>> >    errata bitmap based on the target CPUs set by the VMM and update the
>> >    system_cap based on it.
>> >
>> > ToDos:-
>> >   -We still need a way to  handle the error in setting the invariant
>> >    registers(MIDR/REVIDR/AIDR) during Guest migration. Perhaps we can
>> >    handle it in userspace?
>> > -  Possibly we could do better to avoid the additional
>> "migartion_safe_cap" use.
>> >    Suggestions welcome.
>> >   -There are errata that require more than MIDR/REVIDR, eg: CTR_EL0.
>> >    How to handle those?
>> >   -Check for locking requirements if any.
>> >
>> > This is lightly tested on a HiSilicon ARM64 platform.
>> >
>> > Please take a look and let me know your thoughts.
>> 
>> So, I've only taken a very quick look at it, but IIUC, the idea is for
>> the VMM to do the following:
>> - figure out where we want to possibly run
>
>
> Yes.
>
>> - figure out the least common denominator for writable features
>
> Yes
>
>> - tell KVM about the possible target cpu resp. the errata it wants
>
> This might change as per Marc's comments. VMM has to handle hypercall
> directly and provide the target CPU list to Guest.
>
>> - build a frankencpu via the writable id reg infrastructure, fiddling
>>   with invariant handling as needed?
>
> That is my idea of handling the invariant registers. If the VMM has provided a list of 
> target CPUs for the Guest,  make sure the incoming CPU is part of the list 
> during migration and ignore invariant(MIDR/REVIDR) reg SET errors.

Thanks!

I hope I'll be able to spend some time on this next week.



  reply	other threads:[~2024-10-11 14:29 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-11  7:50 [RFC PATCH 0/6] KVM: arm64: Errata management for VM Live migration Shameer Kolothum
2024-10-11  7:50 ` [RFC PATCH 1/6] arm64: Modify callback matches() fn to take a target info Shameer Kolothum
2024-10-11  7:50 ` [RFC PATCH 2/6] KVM: arm64: Add support for VMM to set migration target Shameer Kolothum
2024-10-11  7:50 ` [RFC PATCH 3/6] KVM: arm64: Introduce a helper to retrieve errata Shameer Kolothum
2024-10-11  7:50 ` [RFC PATCH 4/6] KVM: arm64: Add hypercall support for retrieving migration errata bitmap Shameer Kolothum
2024-10-11  7:50 ` [RFC PATCH 5/6] arm64: Use hypercall to check for any migration related errata Shameer Kolothum
2024-10-11  7:50 ` [RFC PATCH 6/6] arm64: errata: Set migration_safe_cap for MIDR based errata Shameer Kolothum
2024-10-11 10:37 ` [RFC PATCH 0/6] KVM: arm64: Errata management for VM Live migration Marc Zyngier
2024-10-11 10:57   ` Shameerali Kolothum Thodi
2024-10-11 11:43     ` Marc Zyngier
2024-10-11 15:11       ` Oliver Upton
2024-10-11 15:51         ` Shameerali Kolothum Thodi
2024-10-17 15:49           ` Cornelia Huck
2024-10-17 17:16             ` Eric Auger
2024-10-18  8:33               ` Shameerali Kolothum Thodi
2024-10-18 12:28                 ` Cornelia Huck
2024-10-18 13:17               ` Marc Zyngier
2024-10-18 18:52                 ` Oliver Upton
2024-10-22 10:58                   ` Cornelia Huck
2024-10-22 12:52                     ` Marc Zyngier
2024-10-11 13:17 ` Cornelia Huck
2024-10-11 13:24   ` Shameerali Kolothum Thodi
2024-10-11 14:14     ` Cornelia Huck [this message]
2024-10-11 17:07 ` Oliver Upton

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=87h69irak6.fsf@redhat.com \
    --to=cohuck@redhat.com \
    --cc=anthony.jebson@huawei.com \
    --cc=catalin.marinas@arm.com \
    --cc=eric.auger@redhat.com \
    --cc=jiangkunkun@huawei.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linuxarm@huawei.com \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=oliver.upton@linux.dev \
    --cc=shameerali.kolothum.thodi@huawei.com \
    --cc=wangzhou1@hisilicon.com \
    --cc=will@kernel.org \
    --cc=yuzenghui@huawei.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;
as well as URLs for NNTP newsgroup(s).