From: Paolo Bonzini <pbonzini@redhat.com>
To: Wanpeng Li <kernellwp@gmail.com>,
qemu-devel@nongnu.org, kvm@vger.kernel.org
Cc: "Radim Krčmář" <rkrcmar@redhat.com>,
"Wanpeng Li" <wanpeng.li@hotmail.com>
Subject: Re: [Qemu-devel] [PATCH v3] KVM: Add async pf flag to KVM_GET/SET_VCPU_EVENTS interface
Date: Wed, 28 Jun 2017 14:57:05 +0200 [thread overview]
Message-ID: <2a7b199e-311c-2939-eb8c-2504dd483451@redhat.com> (raw)
In-Reply-To: <1498652927-10554-1-git-send-email-wanpeng.li@hotmail.com>
On 28/06/2017 14:28, Wanpeng Li wrote:
> From: Wanpeng Li <wanpeng.li@hotmail.com>
>
> This patch adds async page fault flag to KVM_GET/SET_VCPU_EVENTS interface.
>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Radim Krčmář <rkrcmar@redhat.com>
> Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
> ---
> v2 -> v3:
> * nested_apf for vcpu events
> v1 -> v2:
> * reuse the pad for async_page_fault
> * cleanup coding style
>
> linux-headers/asm-x86/kvm.h | 3 ++-
> target/i386/cpu.h | 1 +
> target/i386/kvm.c | 8 ++++++--
> 3 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/linux-headers/asm-x86/kvm.h b/linux-headers/asm-x86/kvm.h
> index c2824d0..27b368b 100644
> --- a/linux-headers/asm-x86/kvm.h
> +++ b/linux-headers/asm-x86/kvm.h
> @@ -287,6 +287,7 @@ struct kvm_reinject_control {
> #define KVM_VCPUEVENT_VALID_SIPI_VECTOR 0x00000002
> #define KVM_VCPUEVENT_VALID_SHADOW 0x00000004
> #define KVM_VCPUEVENT_VALID_SMM 0x00000008
> +#define KVM_VCPUEVENT_VALID_ASYNC_PF 0x00000010
>
> /* Interrupt shadow states */
> #define KVM_X86_SHADOW_INT_MOV_SS 0x01
> @@ -298,7 +299,7 @@ struct kvm_vcpu_events {
> __u8 injected;
> __u8 nr;
> __u8 has_error_code;
> - __u8 pad;
> + __u8 nested_apf;
> __u32 error_code;
> } exception;
> struct {
> diff --git a/target/i386/cpu.h b/target/i386/cpu.h
> index cfe825f..90cb692 100644
> --- a/target/i386/cpu.h
> +++ b/target/i386/cpu.h
> @@ -1105,6 +1105,7 @@ typedef struct CPUX86State {
>
> /* exception/interrupt handling */
> int error_code;
> + uint8_t async_page_fault;
> int exception_is_int;
> target_ulong exception_next_eip;
> target_ulong dr[8]; /* debug registers; note dr4 and dr5 are unused */
> diff --git a/target/i386/kvm.c b/target/i386/kvm.c
> index 49b6115..b2405ec 100644
> --- a/target/i386/kvm.c
> +++ b/target/i386/kvm.c
> @@ -2491,8 +2491,8 @@ static int kvm_put_vcpu_events(X86CPU *cpu, int level)
> events.exception.injected = (env->exception_injected >= 0);
> events.exception.nr = env->exception_injected;
> events.exception.has_error_code = env->has_error_code;
> + events.exception.nested_apf = env->async_page_fault;
> events.exception.error_code = env->error_code;
> - events.exception.pad = 0;
>
> events.interrupt.injected = (env->interrupt_injected >= 0);
> events.interrupt.nr = env->interrupt_injected;
> @@ -2531,7 +2531,8 @@ static int kvm_put_vcpu_events(X86CPU *cpu, int level)
>
> if (level >= KVM_PUT_RESET_STATE) {
> events.flags |=
> - KVM_VCPUEVENT_VALID_NMI_PENDING | KVM_VCPUEVENT_VALID_SIPI_VECTOR;
> + KVM_VCPUEVENT_VALID_NMI_PENDING | KVM_VCPUEVENT_VALID_SIPI_VECTOR |
> + KVM_VCPUEVENT_VALID_ASYNC_PF;
> }
>
> return kvm_vcpu_ioctl(CPU(cpu), KVM_SET_VCPU_EVENTS, &events);
> @@ -2555,6 +2556,9 @@ static int kvm_get_vcpu_events(X86CPU *cpu)
> env->exception_injected =
> events.exception.injected ? events.exception.nr : -1;
> env->has_error_code = events.exception.has_error_code;
> + if (events.flags & KVM_VCPUEVENT_VALID_ASYNC_PF) {
> + env->async_page_fault = events.exception.nested_apf;
> + }
> env->error_code = events.exception.error_code;
>
> env->interrupt_injected =
>
You are missing the code in machine.c to transmit this (in a new
subsection). But let's iron out the KVM parts first of all.
Paolo
prev parent reply other threads:[~2017-06-28 12:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-28 12:28 [Qemu-devel] [PATCH v3] KVM: Add async pf flag to KVM_GET/SET_VCPU_EVENTS interface Wanpeng Li
2017-06-28 12:57 ` Paolo Bonzini [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2a7b199e-311c-2939-eb8c-2504dd483451@redhat.com \
--to=pbonzini@redhat.com \
--cc=kernellwp@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=qemu-devel@nongnu.org \
--cc=rkrcmar@redhat.com \
--cc=wanpeng.li@hotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).