All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vivek Goyal <vgoyal@redhat.com>
To: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: x86@kernel.org, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
	Andy Lutomirski <luto@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Sean Christopherson <sean.j.christopherson@intel.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>
Subject: Re: [PATCH RFC 3/6] KVM: x86: interrupt based APF page-ready event delivery
Date: Tue, 5 May 2020 11:22:58 -0400	[thread overview]
Message-ID: <20200505152258.GB7155@redhat.com> (raw)
In-Reply-To: <20200429093634.1514902-4-vkuznets@redhat.com>

On Wed, Apr 29, 2020 at 11:36:31AM +0200, Vitaly Kuznetsov wrote:
> Concerns were expressed around APF delivery via synthetic #PF exception as
> in some cases such delivery may collide with real page fault. For type 2
> (page ready) notifications we can easily switch to using an interrupt
> instead. Introduce new MSR_KVM_ASYNC_PF2 mechanism.
> 
> One notable difference between the two mechanisms is that interrupt may not
> get handled immediately so whenever we would like to deliver next event
> (regardless of its type) we must be sure the guest had read and cleared
> previous event in the slot.
> 
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> ---
>  Documentation/virt/kvm/msr.rst       | 38 +++++++++++---
>  arch/x86/include/asm/kvm_host.h      |  5 +-
>  arch/x86/include/uapi/asm/kvm_para.h |  6 +++
>  arch/x86/kvm/x86.c                   | 77 ++++++++++++++++++++++++++--
>  4 files changed, 113 insertions(+), 13 deletions(-)
> 
> diff --git a/Documentation/virt/kvm/msr.rst b/Documentation/virt/kvm/msr.rst
> index 33892036672d..7433e55f7184 100644
> --- a/Documentation/virt/kvm/msr.rst
> +++ b/Documentation/virt/kvm/msr.rst
> @@ -203,14 +203,21 @@ data:
>  	the hypervisor at the time of asynchronous page fault (APF)
>  	injection to indicate type of asynchronous page fault. Value
>  	of 1 means that the page referred to by the page fault is not
> -	present. Value 2 means that the page is now available. Disabling
> -	interrupt inhibits APFs. Guest must not enable interrupt
> -	before the reason is read, or it may be overwritten by another
> -	APF. Since APF uses the same exception vector as regular page
> -	fault guest must reset the reason to 0 before it does
> -	something that can generate normal page fault.  If during page
> -	fault APF reason is 0 it means that this is regular page
> -	fault.
> +	present. Value 2 means that the page is now available.
> +
> +	Type 1 page (page missing) events are currently always delivered as
> +	synthetic #PF exception. Type 2 (page ready) are either delivered
> +	by #PF exception (when bit 3 of MSR_KVM_ASYNC_PF_EN is clear) or
> +	via an APIC interrupt (when bit 3 set). APIC interrupt delivery is
> +	controlled by MSR_KVM_ASYNC_PF2.
> +
> +	For #PF delivery, disabling interrupt inhibits APFs. Guest must
> +	not enable interrupt before the reason is read, or it may be
> +	overwritten by another APF. Since APF uses the same exception
> +	vector as regular page fault guest must reset the reason to 0
> +	before it does something that can generate normal page fault.
> +	If during pagefault APF reason is 0 it means that this is regular
> +	page fault.

Hi Vitaly,

Again, thinking about how errors will be delivered. Will these be using
same interrupt path? 

As you mentioned that if interrupts are disabled, APFs are blocked. That
means host will fall back to synchronous fault? If yes, that means we
will need a mechanism to report errors in synchronous path too.

Thanks
Vivek


  parent reply	other threads:[~2020-05-05 15:23 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-29  9:36 [PATCH RFC 0/6] KVM: x86: Interrupt-based mechanism for async_pf 'page present' notifications Vitaly Kuznetsov
2020-04-29  9:36 ` [PATCH RFC 1/6] Revert "KVM: async_pf: Fix #DF due to inject "Page not Present" and "Page Ready" exceptions simultaneously" Vitaly Kuznetsov
2020-05-05  1:22   ` Gavin Shan
2020-05-05 14:16   ` Vivek Goyal
2020-05-06 15:17     ` Vitaly Kuznetsov
2020-05-11 19:17       ` Vivek Goyal
2020-04-29  9:36 ` [PATCH RFC 2/6] KVM: x86: extend struct kvm_vcpu_pv_apf_data with token info Vitaly Kuznetsov
2020-05-04 23:52   ` Gavin Shan
2020-05-05  8:08     ` Vitaly Kuznetsov
2020-04-29  9:36 ` [PATCH RFC 3/6] KVM: x86: interrupt based APF page-ready event delivery Vitaly Kuznetsov
2020-04-29 10:54   ` Paolo Bonzini
2020-04-29 12:40     ` Vitaly Kuznetsov
2020-04-29 13:21       ` Paolo Bonzini
2020-04-29 21:27   ` Peter Xu
2020-04-30  8:31     ` Vitaly Kuznetsov
2020-04-30 13:28       ` Peter Xu
2020-04-30 13:49         ` Vitaly Kuznetsov
2020-05-05 15:22   ` Vivek Goyal [this message]
2020-04-29  9:36 ` [PATCH RFC 4/6] KVM: x86: acknowledgment mechanism for async pf page ready notifications Vitaly Kuznetsov
2020-04-29 17:28   ` Andy Lutomirski
2020-04-29 17:40     ` Paolo Bonzini
2020-04-30  0:45       ` Andy Lutomirski
2020-04-30  6:46         ` Paolo Bonzini
2020-04-30  6:49   ` Paolo Bonzini
2020-04-30  8:40     ` Vitaly Kuznetsov
2020-04-30  9:27       ` Paolo Bonzini
2020-04-30 11:33         ` Vitaly Kuznetsov
2020-04-30 11:43           ` Paolo Bonzini
2020-05-05  0:36   ` Gavin Shan
2020-05-05  8:16     ` Vitaly Kuznetsov
2020-05-05  8:51       ` Gavin Shan
2020-05-05  9:54         ` Paolo Bonzini
2020-04-29  9:36 ` [PATCH RFC 5/6] KVM: x86: announce KVM_FEATURE_ASYNC_PF_INT Vitaly Kuznetsov
2020-04-29 10:40   ` Peter Zijlstra
2020-04-29  9:36 ` [PATCH RFC 6/6] KVM: x86: Switch KVM guest to using interrupts for page ready APF delivery Vitaly Kuznetsov
2020-04-29 10:53   ` Paolo Bonzini
2020-04-29 12:44     ` Vitaly Kuznetsov
2020-04-29 13:19       ` Paolo Bonzini
2020-04-29 14:34         ` Vitaly Kuznetsov
2020-05-05 18:59     ` Vivek Goyal
2020-05-05  0:42   ` Gavin Shan

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=20200505152258.GB7155@redhat.com \
    --to=vgoyal@redhat.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=sean.j.christopherson@intel.com \
    --cc=tglx@linutronix.de \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    --cc=x86@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.