Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751150AbdLIHdp (ORCPT ); Sat, 9 Dec 2017 02:33:45 -0500 Received: from smtp-fw-9102.amazon.com ([207.171.184.29]:5597 "EHLO smtp-fw-9102.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750952AbdLIHdm (ORCPT ); Sat, 9 Dec 2017 02:33:42 -0500 X-IronPort-AV: E=Sophos;i="5.45,381,1508803200"; d="scan'208";a="579145559" From: "Sironi, Filippo" To: Paolo Bonzini CC: Radim Krcmar , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 2/2] KVM: x86: Allow userspace to define what's the microcode version Thread-Topic: [PATCH 2/2] KVM: x86: Allow userspace to define what's the microcode version Thread-Index: AQHTZtVpIVnd2IPHOEWS92aoXsxI36MoCn+AgBKn4gA= Date: Sat, 9 Dec 2017 07:33:37 +0000 Message-ID: References: <1511714482-3273-1-git-send-email-sironi@amazon.de> <1511714482-3273-2-git-send-email-sironi@amazon.de> <42809091-3330-c99b-0d11-218db66a3de9@redhat.com> In-Reply-To: <42809091-3330-c99b-0d11-218db66a3de9@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.43.166.251] Content-Type: text/plain; charset="us-ascii" Content-ID: <0AA0625A064F1348B50011D8C5BA7168@amazon.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id vB97XpJ3003736 Content-Length: 2096 Lines: 54 > On 27. Nov 2017, at 02:40, Paolo Bonzini wrote: > > On 26/11/2017 17:41, Filippo Sironi wrote: >> ... that the guest should see. >> Guest operating systems may check the microcode version to decide whether >> to disable certain features that are known to be buggy up to certain >> microcode versions. Address the issue by making the microcode version >> that the guest should see settable. > > What's the advantage of specifying the microcode version, rather than > relying on userspace to drop the CPUID bit for the buggy feature? > > old guest(*) new guest > > hide in CPUID good good > > use ucode rev BAD good > > > (*) old guest = doesn't know that the feature is buggy until a given > ucode revision > > Thanks, > > Paolo On C5 and M5 instances, we're basically exposing the host CPUID with few exceptions. Linux (among the others) has checks to make sure that certain features aren't enabled on a certain family/model/stepping if the microcode version isn't greater than or equal to a known good version. apic_check_deadline_errata() in arch/x86/kernel/apic/apic.c is the most recent example in Linux that I know of (by now you've updated it ;) but when we got the original bug report that triggered this patch, this wasn't the case). By exposing the real microcode version, we're preventing buggy guests that don't check that they are running virtualized (i.e., they should trust the hypervisor) from disabling features that are effectively not buggy. Filippo >> The rationale for having userspace specifying the microcode version, rather >> than having the kernel picking it, is to ensure consistency for live-migrated >> instances; we don't want them to see a microcode version increase without a >> reset. Amazon Development Center Germany GmbH Berlin - Dresden - Aachen main office: Krausenstr. 38, 10117 Berlin Geschaeftsfuehrer: Dr. Ralf Herbrich, Christian Schlaeger Ust-ID: DE289237879 Eingetragen am Amtsgericht Charlottenburg HRB 149173 B