[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH for-2.9? v2] kvm: Print MSR information if KVM_{
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH for-2.9? v2] kvm: Print MSR information if KVM_{GET, SET}_MSRS failed |
Date: |
Fri, 10 Mar 2017 09:29:02 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 |
On 09/03/2017 21:26, Eduardo Habkost wrote:
> On Thu, Mar 09, 2017 at 08:08:00PM +0000, Dr. David Alan Gilbert wrote:
>> * Eduardo Habkost (address@hidden) wrote:
>>> When a KVM_{GET,SET}_MSRS ioctl() fails, it is difficult to find
>>> out which MSR caused the problem. Print an error message for
>>> debugging, before we trigger the (ret == cpu->kvm_msr_buf->nmsrs)
>>> assert.
>>>
>>> Suggested-by: Dr. David Alan Gilbert <address@hidden>
>>> Signed-off-by: Eduardo Habkost <address@hidden>
>>
>> Thanks!
>>
>> Reviewed-by: Dr. David Alan Gilbert <address@hidden>
>>
>> I'd actually suggest it for 2.9; it's only added debug output.
>
> I think I agree. The patch is reasonably safe because we would be
> already hitting the assert() if (ret < cpu->kvm_msr_buf->nmsrs)
> anyway.
>
> Paolo, do you want to queue it for 2.9?
Yes, with pleasure.
Paolo
>>
>> Dave
>>
>>> ---
>>> Changes v1 -> v2:
>>> * Print error message on KVM_GET_MSRS too
>>> * Suggested-by: Dr. David Alan Gilbert <address@hidden>
>>> ---
>>> target/i386/kvm.c | 12 ++++++++++++
>>> 1 file changed, 12 insertions(+)
>>>
>>> diff --git a/target/i386/kvm.c b/target/i386/kvm.c
>>> index 887a81268f..705e971a63 100644
>>> --- a/target/i386/kvm.c
>>> +++ b/target/i386/kvm.c
>>> @@ -1807,6 +1807,12 @@ static int kvm_put_msrs(X86CPU *cpu, int level)
>>> return ret;
>>> }
>>>
>>> + if (ret < cpu->kvm_msr_buf->nmsrs) {
>>> + struct kvm_msr_entry *e = &cpu->kvm_msr_buf->entries[ret];
>>> + error_report("error: failed to set MSR 0x%" PRIx32 " to 0x%"
>>> PRIx64,
>>> + (uint32_t)e->index, (uint64_t)e->data);
>>> + }
>>> +
>>> assert(ret == cpu->kvm_msr_buf->nmsrs);
>>> return 0;
>>> }
>>> @@ -2172,6 +2178,12 @@ static int kvm_get_msrs(X86CPU *cpu)
>>> return ret;
>>> }
>>>
>>> + if (ret < cpu->kvm_msr_buf->nmsrs) {
>>> + struct kvm_msr_entry *e = &cpu->kvm_msr_buf->entries[ret];
>>> + error_report("error: failed to get MSR 0x%" PRIx32,
>>> + (uint32_t)e->index);
>>> + }
>>> +
>>> assert(ret == cpu->kvm_msr_buf->nmsrs);
>>> /*
>>> * MTRR masks: Each mask consists of 5 parts
>>> --
>>> 2.11.0.259.g40922b1
>>>
>> --
>> Dr. David Alan Gilbert / address@hidden / Manchester, UK
>