2017-06-20 20:14-0700, Wanpeng Li: > From: Wanpeng Li <wanpeng.li@xxxxxxxxxxx> > > This patch adds async pf flag to KVM_GET/SET_VCPU_EVENTS interface. > > Signed-off-by: Wanpeng Li <wanpeng.li@xxxxxxxxxxx> > --- > 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.) > } 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;