From mboxrd@z Thu Jan 1 00:00:00 1970 From: Radim =?utf-8?B?S3LEjW3DocWZ?= Subject: Re: [PATCH] KVM: Add async pf flag to KVM_GET/SET_VCPU_EVENTS interface Date: Wed, 21 Jun 2017 18:28:37 +0200 Message-ID: <20170621162833.GA22745@potion> References: <1498014889-52658-1-git-send-email-wanpeng.li@hotmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, Paolo Bonzini , Wanpeng Li To: Wanpeng Li Return-path: Received: from mx1.redhat.com ([209.132.183.28]:48084 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752910AbdFUQ2k (ORCPT ); Wed, 21 Jun 2017 12:28:40 -0400 Content-Disposition: inline In-Reply-To: <1498014889-52658-1-git-send-email-wanpeng.li@hotmail.com> Sender: kvm-owner@vger.kernel.org List-ID: 2017-06-20 20:14-0700, Wanpeng Li: > From: Wanpeng Li > > This patch adds async pf flag to KVM_GET/SET_VCPU_EVENTS interface. > > Signed-off-by: Wanpeng Li > --- > 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;