From: "Sironi, Filippo" <sironi@amazon.de>
To: Wanpeng Li <kernellwp@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Radim Krcmar <rkrcmar@redhat.com>, kvm <kvm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] KVM: x86: Allow userspace to define what's the microcode version
Date: Sat, 9 Dec 2017 07:21:47 +0000 [thread overview]
Message-ID: <76FDB4DC-0D6B-4383-B8A2-9DDBC1BA5D96@amazon.de> (raw)
In-Reply-To: <CANRm+CzPHj41UJ5rizzSghaTL4DfxQ0q6HzFiDhp5Zo5u7pQuw@mail.gmail.com>
> On 26. Nov 2017, at 17:02, Wanpeng Li <kernellwp@gmail.com> wrote:
>
> 2017-11-27 0:41 GMT+08:00 Filippo Sironi <sironi@amazon.de>:
>> ... 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.
>> 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.
>
> Is there a scenario which needs to refresh the microcode in the guest
> instead of on the host?
>
> Regards,
> Wanpeng Li
Not that I can think of.
Today, we're picking up the host microcode version when launching an instance
and making sure that the same version is exposed for the life time of the
instance (i.e., across migrations that don't result in a reset).
Filippo
>>
>> Signed-off-by: Filippo Sironi <sironi@amazon.de>
>> ---
>> arch/x86/kvm/x86.c | 23 +++++++++++++++++++++++
>> include/uapi/linux/kvm.h | 3 +++
>> 2 files changed, 26 insertions(+)
>>
>> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
>> index 925c3e29cad3..741588f27ebc 100644
>> --- a/arch/x86/kvm/x86.c
>> +++ b/arch/x86/kvm/x86.c
>> @@ -4033,6 +4033,29 @@ long kvm_arch_vm_ioctl(struct file *filp,
>> } u;
>>
>> switch (ioctl) {
>> + case KVM_GET_MICROCODE_VERSION: {
>> + r = -EFAULT;
>> + if (copy_to_user(argp,
>> + &kvm->arch.microcode_version,
>> + sizeof(kvm->arch.microcode_version)))
>> + goto out;
>> + break;
>> + }
>> + case KVM_SET_MICROCODE_VERSION: {
>> + u32 microcode_version;
>> +
>> + r = -EFAULT;
>> + if (copy_from_user(µcode_version,
>> + argp,
>> + sizeof(microcode_version)))
>> + goto out;
>> + r = -EINVAL;
>> + if (!microcode_version)
>> + goto out;
>> + kvm->arch.microcode_version = microcode_version;
>> + r = 0;
>> + break;
>> + }
>> case KVM_SET_TSS_ADDR:
>> r = kvm_vm_ioctl_set_tss_addr(kvm, arg);
>> break;
>> diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
>> index 282d7613fce8..e11887758e29 100644
>> --- a/include/uapi/linux/kvm.h
>> +++ b/include/uapi/linux/kvm.h
>> @@ -1192,6 +1192,9 @@ struct kvm_s390_ucas_mapping {
>> #define KVM_S390_UCAS_UNMAP _IOW(KVMIO, 0x51, struct kvm_s390_ucas_mapping)
>> #define KVM_S390_VCPU_FAULT _IOW(KVMIO, 0x52, unsigned long)
>>
>> +#define KVM_GET_MICROCODE_VERSION _IOR(KVMIO, 0x5e, __u32)
>> +#define KVM_SET_MICROCODE_VERSION _IOW(KVMIO, 0x5f, __u32)
>> +
>> /* Device model IOC */
>> #define KVM_CREATE_IRQCHIP _IO(KVMIO, 0x60)
>> #define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level)
>> --
>> 2.7.4
>>
>
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
next prev parent reply other threads:[~2017-12-09 7:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-26 16:41 [PATCH 1/2] KVM: x86: Store the microcode version in struct kvm_arch Filippo Sironi
2017-11-26 16:41 ` [PATCH 2/2] KVM: x86: Allow userspace to define what's the microcode version Filippo Sironi
2017-11-27 1:02 ` Wanpeng Li
2017-12-09 7:21 ` Sironi, Filippo [this message]
2017-11-27 10:40 ` Paolo Bonzini
2017-12-09 7:33 ` Sironi, Filippo
2017-11-27 11:58 ` Paolo Bonzini
2017-11-27 22:09 ` Steve Rutherford
2017-12-09 7:51 ` Sironi, Filippo
2017-12-09 7:42 ` Sironi, Filippo
2017-12-11 16:03 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=76FDB4DC-0D6B-4383-B8A2-9DDBC1BA5D96@amazon.de \
--to=sironi@amazon.de \
--cc=kernellwp@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®