qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] 3.1.0-rc{0,1} doesn't start


From: Bandan Das
Subject: Re: [Qemu-devel] 3.1.0-rc{0,1} doesn't start
Date: Tue, 20 Nov 2018 23:05:21 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Paolo Bonzini <address@hidden> writes:
...
>>>>> diff --git a/target/i386/kvm.c b/target/i386/kvm.c
>>>>> index f524e7d929..4878ffb90b 100644
>>>>> --- a/target/i386/kvm.c
>>>>> +++ b/target/i386/kvm.c
>>>>> @@ -2002,14 +2002,9 @@ static int kvm_put_msrs(X86CPU *cpu, int level)
>>>>>  #endif
>>>>>  
>>>>>      /* If host supports feature MSR, write down. */
>>>>> -    if (kvm_feature_msrs) {
>>>>> -        int i;
>>>>> -        for (i = 0; i < kvm_feature_msrs->nmsrs; i++)
>>>>> -            if (kvm_feature_msrs->indices[i] == 
>>>>> MSR_IA32_ARCH_CAPABILITIES) {
>>>>> -                kvm_msr_entry_add(cpu, MSR_IA32_ARCH_CAPABILITIES,
>>>>> +    if (kvm_arch_get_supported_msr_feature(kvm_state, 
>>>>> MSR_IA32_ARCH_CAPABILITIES)) {
>>>>> +        kvm_msr_entry_add(cpu, MSR_IA32_ARCH_CAPABILITIES,
>>>>>                                env->features[FEAT_ARCH_CAPABILITIES]);
>>>>
>>>> kvm_arch_get_supported_msr_feature() will return the value of the
>>>> MSR on the host side (kvm/x86.c:kvm_get_msr_feature()).  Having
>>>> it return non-zero doesn't mean KVM's
>>>> svm_set_msr(MSR_IA32_ARCH_CAPABILITIES) will work.
>>>>
>>>> If the MSR doesn't work on KVM_SET_MSRS, it is not supposed to
>>>> appear on KVM_GET_MSR_INDEX_LIST (even if it appears on
>>>> KVM_GET_MSR_FEATURE_INDEX_LIST).  QEMU must check
>>>> KVM_GET_MSR_INDEX_LIST too before including the MSR on the
>>>> KVM_SET_MSRS call.
>>>
>>> Yes, this is a KVM bug.  For 3.1, making it "writable if nonzero" is a
>>> valid workaround, because AMD processors always return 0. It's not the
>>> prettiest thing, but it works.
>> 
>> So it looks like we have 2 bugs?  Is KVM incorrectly returning
>> the MSR on KVM_GET_MSR_INDEX_LIST?
>> 
>> I thought the bug was only in QEMU, which is supposed to be
>> checking KVM_GET_MSR_INDEX_LIST before setting the MSR (it is
>> only checking KVM_GET_MSR_FEATURE_INDEX_LIST).
>
> Oh, wait.  I didn't understand that.  Then yeah, fixing QEMU is enough.
>  KVM is not reporting the MSR in the list on AMD, but it should (and it
> should implement the MSR, of course!).
>

Until AMD implements somethinig, on the KVM side, shouldn't we let
kvm_x86_ops->get_msr_feature(msr)) handle MSR_IA32_ARCH_CAPABILITIES ?

> Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]