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 C4A1ACD37AC for ; Mon, 11 May 2026 15:15:13 +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-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=bHbDw2kQDVt9bJG46JUREywkjRHfZCqW19vv3OS9bjw=; b=hHY1uHElte4u1lTX40ZucRRDml Miz6GVzhvmTtlHYwdF1/TVSc7/G7Na7FkjFqp6OowfPR1hjuGcqZtYRxlaPqJM4ERBEhMyjxcCYpk daQSdupsw8zCapYQWvTd+4nG94SrbUnjSXpDKQKGOGxapRH3R/9DsFFqFNDfi0YglG9qqqM9fr2qS orR/Bl8+/FZ01Alfu2k1WJ641XPGtJBe/PUn3xjr0TxYpXD2wC6kSVE1FuVRvYP53MbIjC1wQBFGf Db1PjopKhpysyH+7MYZBXztSHJJhkymc0fJkKBAKcu9o2Zyyew8Yul/Z2mYAxVZAm5KTuAni4kfaG NNz18naA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wMSLZ-0000000E1eT-2xrE; Mon, 11 May 2026 15:15:05 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wMSLW-0000000E1dn-2LLT for linux-arm-kernel@lists.infradead.org; Mon, 11 May 2026 15:15:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778512500; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=bHbDw2kQDVt9bJG46JUREywkjRHfZCqW19vv3OS9bjw=; b=ZATvnm8htfK+K1UULPPgHf/rU8ukFXIF+oyPaHY9noE1VRCR8sNs2g29mCD5x0KelF1dmG Gxt+Up8d13aAu2Mh3xZ/lQubq4vOpKcAfhDLbyh2Olg2ktwOPn6RJ4mckRfOstfZ3aLyYz bwDNFGs8SM6KQE1wJ6TfibxUU4hhLqg= Received: from mx-prod-mc-05.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-689-AdPGODgCPFCfv-AnQdUCAw-1; Mon, 11 May 2026 11:14:56 -0400 X-MC-Unique: AdPGODgCPFCfv-AnQdUCAw-1 X-Mimecast-MFC-AGG-ID: AdPGODgCPFCfv-AnQdUCAw_1778512493 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CE1291955EB1; Mon, 11 May 2026 15:14:51 +0000 (UTC) Received: from [10.44.34.38] (unknown [10.44.34.38]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 50A331800286; Mon, 11 May 2026 15:14:43 +0000 (UTC) Message-ID: <6afc4b95-3c15-4d71-877d-19b84e91ce05@redhat.com> Date: Mon, 11 May 2026 17:14:42 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] Documentation: KVM: Document guest-visible compatibility expectations To: David Woodhouse , Jonathan Corbet , Shuah Khan , kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Sean Christopherson , Jim Mattson Cc: Oliver Upton , Joey Gouly , Suzuki K Poulose , Zenghui Yu , Catalin Marinas , Will Deacon , Raghavendra Rao Ananta , Eric Auger , Kees Cook , Arnd Bergmann , Nathan Chancellor , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kselftest@vger.kernel.org References: <6856b269d2af706eae397e0cf9c1231f89d9a932.camel@infradead.org> From: Paolo Bonzini Autocrypt: addr=pbonzini@redhat.com; keydata= xsEhBFRCcBIBDqDGsz4K0zZun3jh+U6Z9wNGLKQ0kSFyjN38gMqU1SfP+TUNQepFHb/Gc0E2 CxXPkIBTvYY+ZPkoTh5xF9oS1jqI8iRLzouzF8yXs3QjQIZ2SfuCxSVwlV65jotcjD2FTN04 hVopm9llFijNZpVIOGUTqzM4U55sdsCcZUluWM6x4HSOdw5F5Utxfp1wOjD/v92Lrax0hjiX DResHSt48q+8FrZzY+AUbkUS+Jm34qjswdrgsC5uxeVcLkBgWLmov2kMaMROT0YmFY6A3m1S P/kXmHDXxhe23gKb3dgwxUTpENDBGcfEzrzilWueOeUWiOcWuFOed/C3SyijBx3Av/lbCsHU Vx6pMycNTdzU1BuAroB+Y3mNEuW56Yd44jlInzG2UOwt9XjjdKkJZ1g0P9dwptwLEgTEd3Fo UdhAQyRXGYO8oROiuh+RZ1lXp6AQ4ZjoyH8WLfTLf5g1EKCTc4C1sy1vQSdzIRu3rBIjAvnC tGZADei1IExLqB3uzXKzZ1BZ+Z8hn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VQ//UAthSSEklA50QtD2sBkmQ14ZryEyTHQ+E42K3j2IUmOLriF dNr9NvE1QGmGyIcbw2NIVEBOK/GWxkS5+dmxM2iD4Jdaf2nSn3jlHjEXoPwpMs0KZsgdU0pP JQzMUMwmB1wM8JxovFlPYrhNT9MAEQEAAcLBMwQYAQIACQUCVEJx7gIbDAAKCRB+FRAMzTZp sadRDqCctLmYICZu4GSnie4lKXl+HqlLanpVMOoFNnWs9oRP47MbE2wv8OaYh5pNR9VVgyhD OG0AU7oidG36OeUlrFDTfnPYYSF/mPCxHttosyt8O5kabxnIPv2URuAxDByz+iVbL+RjKaGM GDph56ZTswlx75nZVtIukqzLAQ5fa8OALSGum0cFi4ptZUOhDNz1onz61klD6z3MODi0sBZN Aj6guB2L/+2ZwElZEeRBERRd/uommlYuToAXfNRdUwrwl9gRMiA0WSyTb190zneRRDfpSK5d usXnM/O+kr3Dm+Ui+UioPf6wgbn3T0o6I5BhVhs4h4hWmIW7iNhPjX1iybXfmb1gAFfjtHfL xRUr64svXpyfJMScIQtBAm0ihWPltXkyITA92ngCmPdHa6M1hMh4RDX+Jf1fiWubzp1voAg0 JBrdmNZSQDz0iKmSrx8xkoXYfA3bgtFN8WJH2xgFL28XnqY4M6dLhJwV3z08tPSRqYFm4NMP dRsn0/7oymhneL8RthIvjDDQ5ktUjMe8LtHr70OZE/TT88qvEdhiIVUogHdo4qBrk41+gGQh b906Dudw5YhTJFU3nC6bbF2nrLlB4C/XSiH76ZvqzV0Z/cAMBo5NF/w= In-Reply-To: <6856b269d2af706eae397e0cf9c1231f89d9a932.camel@infradead.org> X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-MFC-PROC-ID: XN3a20x0qV-gyabx1KmPuAC38mgt5i1AYtaABU0L-sk_1778512493 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260511_081502_686680_25E697F9 X-CRM114-Status: GOOD ( 34.50 ) 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 5/11/26 10:57, David Woodhouse wrote: > From: David Woodhouse > > Document the expectation that KVM maintains guest-visible compatibility > across host kernel upgrades and rollbacks. Specifically: > > - State saved/restored via KVM ioctls must be sufficient for live > migration (and live update) between kernel versions. > > - Where a new kernel introduces a guest-visible change, it provides a > mechanism for userspace to select the previous behaviour. > > - This allows both forward migration (upgrade) and backward migration > (rollback) of guests. > > These expectations have been implicitly required on x86 but were not > explicitly documented. Harmonise the expectations across all of KVM. One big part of achieving this on x86 is the handling of CPUID. Despite all the mess that KVM_SET_CPUID2 is (and sometimes the underlying architecture too, as Jim Mattson would certainly agree), KVM is generally able to provide a consistent view of its configuration to the guest. This doesn't quite extend to compatibility across vendors, but it does work across processor generations from either Intel or AMD. I understand that Arm traditionally had much more trouble than x86 with vendor-specified behavior that goes beyond the set of architectural features, so we may need to tune the expectations. However, I agree with David that this is needed at least as long as the host CPU does not change. Thanks, Paolo > Signed-off-by: David Woodhouse > --- > Documentation/virt/kvm/api.rst | 14 ++++++++++++++ > Documentation/virt/kvm/review-checklist.rst | 20 ++++++++++++++------ > 2 files changed, 28 insertions(+), 6 deletions(-) > > diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst > index 269970221797..864f3daa7acb 100644 > --- a/Documentation/virt/kvm/api.rst > +++ b/Documentation/virt/kvm/api.rst > @@ -97,6 +97,20 @@ Instead, kvm defines extension identifiers and a facility to query > whether a particular extension identifier is available. If it is, a > set of ioctls is available for application use. > > +KVM will ensure that the state that can be saved and restored via the > +KVM ioctls is sufficient to allow migration of a running guest between > +host kernels while maintaining full compatibility of the guest-visible > +device model. This includes migration to newer kernels (upgrade) and > +to older kernels (rollback), provided that the older kernel supports > +the set of features exposed to the guest. Where a new kernel version > +introduces a guest-visible change, it will provide a mechanism (such > +as a capability or a device attribute) that allows userspace to select > +the previous behaviour. This serves two purposes: guests migrated > +from an older kernel can continue to run with their original > +observable environment, and new guests launched on the newer kernel > +can be configured to match the feature set of the older kernel, so > +that they remain migratable to the older kernel in case of rollback. > + > > 4. API description > ================== > diff --git a/Documentation/virt/kvm/review-checklist.rst b/Documentation/virt/kvm/review-checklist.rst > index 053f00c50d66..f0fbe1577a90 100644 > --- a/Documentation/virt/kvm/review-checklist.rst > +++ b/Documentation/virt/kvm/review-checklist.rst > @@ -18,22 +18,30 @@ Review checklist for kvm patches > 5. New features must default to off (userspace should explicitly request them). > Performance improvements can and should default to on. > > -6. New cpu features should be exposed via KVM_GET_SUPPORTED_CPUID2, > +6. Guest-visible changes must not break migration compatibility. A guest > + migrated from an older kernel must be able to run with its original > + observable environment, and a guest launched on a newer kernel must be > + configurable to match the older kernel's feature set for rollback. > + Where a change alters guest-visible behaviour, provide a mechanism > + (capability, device attribute, etc.) for userspace to select the > + previous behaviour. > + > +7. New cpu features should be exposed via KVM_GET_SUPPORTED_CPUID2, > or its equivalent for non-x86 architectures > > -7. The feature should be testable (see below). > +8. The feature should be testable (see below). > > -8. Changes should be vendor neutral when possible. Changes to common code > +9. Changes should be vendor neutral when possible. Changes to common code > are better than duplicating changes to vendor code. > > -9. Similarly, prefer changes to arch independent code than to arch dependent > +10. Similarly, prefer changes to arch independent code than to arch dependent > code. > > -10. User/kernel interfaces and guest/host interfaces must be 64-bit clean > +11. User/kernel interfaces and guest/host interfaces must be 64-bit clean > (all variables and sizes naturally aligned on 64-bit; use specific types > only - u64 rather than ulong). > > -11. New guest visible features must either be documented in a hardware manual > +12. New guest visible features must either be documented in a hardware manual > or be accompanied by documentation. > > Testing of KVM code