qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] KVM: Add async pf flag to KVM_GET/SET_VCPU_EVEN


From: Wanpeng Li
Subject: Re: [Qemu-devel] [PATCH] KVM: Add async pf flag to KVM_GET/SET_VCPU_EVENTS interface
Date: Thu, 22 Jun 2017 10:09:09 +0800

2017-06-22 0:28 GMT+08:00 Radim Krčmář <address@hidden>:
> 2017-06-20 20:14-0700, Wanpeng Li:
>> From: Wanpeng Li <address@hidden>
>>
>> This patch adds async pf flag to KVM_GET/SET_VCPU_EVENTS interface.
>>
>> Signed-off-by: Wanpeng Li <address@hidden>
>> ---
>> diff --git a/linux-headers/asm-x86/kvm.h b/linux-headers/asm-x86/kvm.h
>> @@ -300,6 +301,7 @@ struct kvm_vcpu_events {
>>               __u8 has_error_code;
>>               __u8 pad;
>>               __u32 error_code;
>> +             bool async_page_fault;
>
> Touching userspace interfaces is always a major fun ...
>
> You must not change the layout of an existing structure.  You can try to
> reuse the pad and hope that some userspace didn't check it for 0.
> (I think it's a decent compromise between safety and sanity.)

Thanks for pointing out. Just fixes it in v2.

Regards,
Wanpeng Li

>
>>       } exception;
>>       struct {
>>               __u8 injected;
>> diff --git a/target/i386/kvm.c b/target/i386/kvm.c
>> @@ -2493,6 +2493,7 @@ static int kvm_put_vcpu_events(X86CPU *cpu, int level)
>>      events.exception.has_error_code = env->has_error_code;
>>      events.exception.error_code = env->error_code;
>>      events.exception.pad = 0;
>> +    events.exception.async_page_fault = env->async_page_fault;
>>
>>      events.interrupt.injected = (env->interrupt_injected >= 0);
>
> Old QEMUs would break below this point, because interrupt.injected used
> to be where exception.async_page_fault is.
>
>>      events.interrupt.nr = env->interrupt_injected;



reply via email to

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