Received: by 10.223.185.116 with SMTP id b49csp3610324wrg; Mon, 26 Feb 2018 03:04:46 -0800 (PST) X-Google-Smtp-Source: AH8x227nn8g0wGhPyenSH3yzsblt3yum1BonVatf2EGq8a30NvLztZd3zdl/nAegY4xU/OlwL7zF X-Received: by 2002:a17:902:8341:: with SMTP id z1-v6mr10447887pln.386.1519643086242; Mon, 26 Feb 2018 03:04:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519643086; cv=none; d=google.com; s=arc-20160816; b=b9lbU152Wn1zuv1bP3TApCURzBQLaLDnQLEFuwkxvHF1SDxqik+NiHBmpI5eQc0jbG ogr3hjny7K/3xSp04kYpmAIrY+cxn+JLvrbyX0Yo8PK2gNxbEH1xE0ptwcI12sRTTeRz Ge8FFjlSFES8cElKuQ3hehpm9abHlGeaJ1ZwQQtpWgpgWP3O8hNQ4gr2cF3oKWRS103x 4Tx3UCnbCkieoRqTojlujdsBTNvvZFTCcjUjBJBTL7GEGxYnGOtwfyFZrznAJMQ+BTOC AG3/fIIjs6E0h/RbF9NoInnw3tut8lmT/8rtWKOgIm9jYSDc84P9cX9V+zv6vt1iXpTw aieQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=hCtwuaPwslPuM34Qh4V6fqSMh9gR0zv7qUHtqp4c1ek=; b=boFeEbQ+d3V20bTqUlVNnSkjQ/BE3MslxteQpc92Ba0Fgj01M8xYBLDZtIp2VNGg40 /iyZiXhIG8n0dn7GfMcxP3jAzfzl4IIYe/JFh9s69LbAmzGlEjyMXofRr+PiUpgQWHBp 1nNogYPk2lWJ+1YxMj3j7953p3DslCRgCbSoqxwnVuLORWfKkNHhzvP81kqIpChOs7Gt 6R51pK98A/axzKi7GrFP9nDyyzIrfT1NIndKq+uD5n1Dv82JyJkaZD1uppaHOvrtJAQc aOtoPKXjTDcuPTgS6zC7iFbMVaqbnjJzRpg1IcsJSXbmGDo+5mK6fOi0eMHSN6q3B8s+ lLKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=W0WOuWWA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m11-v6si6604424pla.639.2018.02.26.03.04.31; Mon, 26 Feb 2018 03:04:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=W0WOuWWA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752715AbeBZLCd (ORCPT + 99 others); Mon, 26 Feb 2018 06:02:33 -0500 Received: from mail-ot0-f180.google.com ([74.125.82.180]:42748 "EHLO mail-ot0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752264AbeBZLCa (ORCPT ); Mon, 26 Feb 2018 06:02:30 -0500 Received: by mail-ot0-f180.google.com with SMTP id l5so5712135otf.9; Mon, 26 Feb 2018 03:02:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=hCtwuaPwslPuM34Qh4V6fqSMh9gR0zv7qUHtqp4c1ek=; b=W0WOuWWAkmp2H98JKEi2grUcs1FmZs47nrkvgqMs2003dcfDu3f63C/R/17+A1MYAh cZiHRUH5k7OwhDLft9euKOGNezVHgc/KSA13UV1Otri5odckBvs3qPmsi2xTn9kQZHwJ H3l7h9l++bQFJ92RCoEDQtgHG9Rg9Mgw3ps59ucWqoOCuaoDgof/aSMb2Q66KW/jCaGS xG4P1JW8Kx8kAC/9NMDKZ5Ov4KSM2fAOjiWBdU+HzeXA/yhDwnjtxiibu/Tb1+gqBDBN Fz1ZLNgcvLyEDDEdKPDVNJWd4VZiT0OpX59l5rLx5/PFiqkAg2I7Yx03WpZ+Z+2WIjxF 66Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=hCtwuaPwslPuM34Qh4V6fqSMh9gR0zv7qUHtqp4c1ek=; b=Y7AmQrheOjieI1oaW5OqUA0VSu0I955PxTiJN0Lq6ZPwbl5jSF2Mn2ysgAV+9oTXFw u2op8+aetyfkhpCxaZhhGmTWEhL4kT0TsFajk4T9RtJmezIO/cv/AXBYn21KWiqhXITx SAnBf8xfXQb+HLyajxUuSAy5pgEKOPmPoxAjRWak/BinDqBaJ4wBfPds7qpEoGfx1QTB NkbCjNWhwerXrh4IN9N1JgCopNtWOYRIhvIp5xx8XMN0EimzODtTGuOzn8f3fFif5yBZ 58sn/PwmqcTeAV/yRFhLAqiJT56WrDsRlGEXEX/zYHGdKEAyzD3Km3/hqnYiO5HI/3/7 XSww== X-Gm-Message-State: APf1xPCQ0BXK+HdCOwfWeYpkMkQrohXhz8rO8kfqg3s44UuE1y3Mziup xqut+P5Sxwb2e2Y5ikXryC5Bvkj7/TmNoF/6WXEHGg== X-Received: by 10.157.18.228 with SMTP id g91mr7657101otg.2.1519642950156; Mon, 26 Feb 2018 03:02:30 -0800 (PST) MIME-Version: 1.0 Received: by 10.74.208.10 with HTTP; Mon, 26 Feb 2018 03:02:29 -0800 (PST) In-Reply-To: <20180226104921.GA4377@pd.tnic> References: <1519629838-4898-1-git-send-email-wanpengli@tencent.com> <20180226094148.GA15539@pd.tnic> <20180226104921.GA4377@pd.tnic> From: Wanpeng Li Date: Mon, 26 Feb 2018 19:02:29 +0800 Message-ID: Subject: Re: [PATCH] KVM: X86: Allow userspace to define the microcode version To: Borislav Petkov Cc: LKML , kvm , Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2018-02-26 18:49 GMT+08:00 Borislav Petkov : > On Mon, Feb 26, 2018 at 06:06:42PM +0800, Wanpeng Li wrote: >> I think it is the host admin(e.g. cloud provider)'s responsibility to >> set an expected microcode revision. > > + vcpu->arch.microcode_version = 0x1; > > That already looks pretty arbitrary and non-sensical to me. This is the original kvm implementation before the patch. > >>In addition, the non-sensical value which is written by the guest will >>not reflect to guest-visible microcode revision and just be ignored in >>this implementation. > > Huh? How so? > > So a guest will have *two* microcode revisions - both of which are most > likely wrong?! Just one revision. > > This whole thing sounds like the wrong approach to me. > >> 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. > > It sounds to me like the proper fix is to make the kernel *not* look at > microcode revisions when running virtualized. The same way we're not > loading microcode in a guest: > > if (native_cpuid_ecx(1) & BIT(31)) > > Letting userspace control the microcode revision number is revision > number management SNAFU waiting to happen IMO. https://lkml.org/lkml/2017/12/9/29 The original discussion explain in more details. Regards, Wanpeng Li