Received: by 10.192.165.156 with SMTP id m28csp998116imm; Wed, 18 Apr 2018 02:05:36 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/xp1/bT1bN0Uy31aku6Ya6P+ET2l6sF+Jfbz+8+wtYytggZ54t5COa6l9Dfhtt6pCcxmBX X-Received: by 2002:a17:902:322:: with SMTP id 31-v6mr1316055pld.122.1524042336328; Wed, 18 Apr 2018 02:05:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524042336; cv=none; d=google.com; s=arc-20160816; b=nOX2sVmK/W6DWw+MPgQuNCUWcby6HbaWybHbtYj9tr52qn3LicqCozMOBExuWv7bOl BcT9BR0tkWhvq3OC4IxQo9GT0XTFix9DBSr9ZskTHaiSLrkhsMKhkeGSBdb5YzfLdasw 0lWi+cBDsmrc6w0a8OYdu7ezBfG0tOoNIrkmR+fDfkkYi4l7VElm4VomqZqvV91PQYij Fpta7miEOj+KKQfwC4k+MLxpt382Db6AnZFawOad/t2b2F4QRLuOykKtzsc1zShWx5GG 6S4OSrFLFIC6ku/8seKPPZW6nBCCz+om9mB7zZqdx7IvAIGnO9+M4xAE3+NqZ3mnpkYl IqWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=/85C2qvvjYnHAtManogJ865MTb2pywAr7zhe3YQ+Qyc=; b=K8FQE+tTVZz5KchXNqcOCIdWyovx1qkz3FyBCIvamBmBwSCFdwKk5fqHzjmOB2C6ZD nsLJofxfKbvn6uUOz+aF13O6lnkix99PQO5wK0NCs4+5uF/hw4nm2ZWH6T9P4NhwkivS 0vvJBZ+h0dobzR8jMdw6QIPLfTxZ2RYETQpngsDTPSP5++2YXdVL7WkuHNpxZfzt8FwA P9ZnDFb7DU4jD1LVy89IcxH/3LLPPPiPblHgtmYYtjoRdtcqDKtKpY1T3L3mQ/6MSjAo DHj7UtlPPMLX/QafyzsG0WKfoBq8PcupY2tX7sUwzLxPufhihwXcSaPFca3dlPEOVo63 a0YQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u127si769518pgc.42.2018.04.18.02.05.22; Wed, 18 Apr 2018 02:05:36 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753368AbeDRJDd (ORCPT + 99 others); Wed, 18 Apr 2018 05:03:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42166 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753215AbeDRJDb (ORCPT ); Wed, 18 Apr 2018 05:03:31 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B1B97368E7; Wed, 18 Apr 2018 09:03:31 +0000 (UTC) Received: from localhost (ovpn-116-12.gru2.redhat.com [10.97.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2E85A7A244; Wed, 18 Apr 2018 09:03:31 +0000 (UTC) Date: Wed, 18 Apr 2018 06:03:29 -0300 From: Eduardo Habkost To: Wanpeng Li Cc: Paolo Bonzini , Borislav Petkov , LKML , kvm , Radim =?utf-8?B?S3LEjW3DocWZ?= Subject: Re: [PATCH] KVM: X86: Allow userspace to define the microcode version Message-ID: <20180418090329.GJ29865@localhost.localdomain> References: <20180226114409.GD4377@pd.tnic> <46cecef2-b0fb-b0c2-bbf3-983328d52763@redhat.com> <20180226121509.GE4377@pd.tnic> <24cd527d-5287-f0be-ffe8-eab341bf1d94@redhat.com> <3866d359-0ef8-6a99-6254-84890be62b93@redhat.com> <20180226122205.GG4377@pd.tnic> <20180417202417.GA29865@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Fnord: you can see the fnord User-Agent: Mutt/1.9.2 (2017-12-15) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 18 Apr 2018 09:03:31 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 18, 2018 at 11:24:22AM +0800, Wanpeng Li wrote: > 2018-04-18 4:24 GMT+08:00 Eduardo Habkost : > > On Tue, Apr 17, 2018 at 06:40:58PM +0800, Wanpeng Li wrote: > >> Cc Eduardo, > >> 2018-02-26 20:41 GMT+08:00 Paolo Bonzini : > >> > On 26/02/2018 13:22, Borislav Petkov wrote: > >> >> On Mon, Feb 26, 2018 at 01:18:07PM +0100, Paolo Bonzini wrote: > >> >>>> In this context, "host-initiated" write means written by KVM userspace > >> >>>> with ioctl(KVM_SET_MSR). It generally happens only on VM startup, reset > >> >>>> or live migration. > >> >>> > >> >>> To be clear, the target of the write is still the vCPU's emulated MSR. > >> >> > >> >> So how am I to imagine this as a user: > >> >> > >> >> qemu-system-x86_64 --microcode-revision=0xdeadbeef... > >> > > >> > More like "-cpu foo,ucode_rev=0xdeadbeef". But in practice what would > >> > happen is one of the following: > >> > > >> > 1) "-cpu host" sets ucode_rev to the same value of the host, everyone > >> > else leaves it to zero as is now. > >> > >> Hi Paolo, > >> > >> Do you mean the host admin to get the ucode_rev from the host and set > >> to -cpu host, ucode_rev=xxxxxx or qemu get the ucode_rev directly by > >> rdmsr? > > > > QEMU setting ucode_rev automatically using the host value when > > using "-cpu host" (with no need for explicit ucode_rev option) > > makes sense to me. > > QEMU can't get the host value by rdmsr MSR_IA32_UCODE_REV directly > since rdmsr will #GP when ring !=0, any idea? By looking at kvm_get_msr_feature(), it looks like ioctl(system_fd, KVM_GET_MSRS) would return the host MSR value for us. -- Eduardo