From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B6C0ED0D795 for ; Fri, 11 Oct 2024 14:29:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: Message-ID:Date:References:In-Reply-To:Subject:Cc:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=+6TCPgkIuI75pPPy7xgIkD4f7dDd4S1TDJrEU/GmgCI=; b=tLjvbubwHUhPI6uZfle8YStbVW EDNXJ/Kp6taU9HeTPbxqC6KbkPCy9iGIrLEyDgMGbkHRyzzebwHLWVN4rKRiw9ksF69HE365Fk9qt qX4UJfUAJPy1qkQxwUABVxxSEno4LIP6aiBUyFtZTa4xFBdOtnlxtXFoN+syoxpmg2mYyqSKZuW+0 ROuTkdPSaWEpfiqhyrcMyRlJPWrkVL9hTgiqNyIVAqv1LQPxrL0ihB1V5BCcXF2nQ/xWcVWFKQx1W lYSJN0/zsjfwzcJQ5fWPTaWLATdJM/Utfwgc831RoEkFyezpAz1/+llubYFvha6yNezRpm8WILZeT yfrVYDFA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1szGe1-0000000Gblw-3Va6; Fri, 11 Oct 2024 14:29:29 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1szGPn-0000000GZ7L-48gb for linux-arm-kernel@lists.infradead.org; Fri, 11 Oct 2024 14:14:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728656086; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+6TCPgkIuI75pPPy7xgIkD4f7dDd4S1TDJrEU/GmgCI=; b=ikzvpdDFHITTd8cbG7YJZcMDO+unZSbvBiHwlE4oPo9ANOGL32byrrCHk1EEG4c0T2UYeD kcp9u+ZAT2FvvUIttyXRd7kaQDuA/COyfAq0rTofv8HVL89H0FsSvJNHF52+EjgHagcygR Ewglp1DD13It4g2dx/pchPjR3sbcd2k= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-231-G52hpAYRO-6yNatmDDkiIQ-1; Fri, 11 Oct 2024 10:14:41 -0400 X-MC-Unique: G52hpAYRO-6yNatmDDkiIQ-1 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CC4B11955F77; Fri, 11 Oct 2024 14:14:38 +0000 (UTC) Received: from localhost (dhcp-192-244.str.redhat.com [10.33.192.244]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1511619560AA; Fri, 11 Oct 2024 14:14:35 +0000 (UTC) From: Cornelia Huck To: Shameerali Kolothum Thodi , "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 , "Wangzhou (B)" , jiangkunkun , Jonathan Cameron , Anthony Jebson , "linux-arm-kernel@lists.infradead.org" , Linuxarm Subject: RE: [RFC PATCH 0/6] KVM: arm64: Errata management for VM Live migration In-Reply-To: <54afcc8182d341d8ab294d8a54c1fbf3@huawei.com> Organization: "Red Hat GmbH, Sitz: Werner-von-Siemens-Ring 12, D-85630 Grasbrunn, Handelsregister: Amtsgericht =?utf-8?Q?M=C3=BCnchen=2C?= HRB 153243, =?utf-8?Q?Gesch=C3=A4ftsf=C3=BChrer=3A?= Ryan Barnhart, Charles Cachera, Michael O'Neill, Amy Ross" References: <20241011075053.80540-1-shameerali.kolothum.thodi@huawei.com> <87jzeerd6z.fsf@redhat.com> <54afcc8182d341d8ab294d8a54c1fbf3@huawei.com> User-Agent: Notmuch/0.38.3 (https://notmuchmail.org) Date: Fri, 11 Oct 2024 16:14:33 +0200 Message-ID: <87h69irak6.fsf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241011_071448_124551_868D4F76 X-CRM114-Status: GOOD ( 33.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Oct 11 2024, Shameerali Kolothum Thodi wrote: >> -----Original Message----- >> From: Cornelia Huck >> Sent: Friday, October 11, 2024 2:18 PM >> To: Shameerali Kolothum Thodi >> ; 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 ; Wangzhou >> (B) ; jiangkunkun >> ; Jonathan Cameron >> ; Anthony Jebson >> ; linux-arm-kernel@lists.infradead.org; >> Linuxarm >> Subject: Re: [RFC PATCH 0/6] KVM: arm64: Errata management for VM Live >> migration >> >> On Fri, Oct 11 2024, Shameer Kolothum >> 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.