From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Vivek Goyal <vgoyal@redhat.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>,
kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] KVM: async_pf: Inject 'page ready' event only if 'page not present' was previously injected
Date: Wed, 10 Jun 2020 12:47:38 -0700 [thread overview]
Message-ID: <20200610194738.GE18790@linux.intel.com> (raw)
In-Reply-To: <20200610193211.GB243520@redhat.com>
On Wed, Jun 10, 2020 at 03:32:11PM -0400, Vivek Goyal wrote:
> On Wed, Jun 10, 2020 at 07:55:32PM +0200, Vitaly Kuznetsov wrote:
> > 'Page not present' event may or may not get injected depending on
> > guest's state. If the event wasn't injected, there is no need to
> > inject the corresponding 'page ready' event as the guest may get
> > confused. E.g. Linux thinks that the corresponding 'page not present'
> > event wasn't delivered *yet* and allocates a 'dummy entry' for it.
> > This entry is never freed.
> >
> > Note, 'wakeup all' events have no corresponding 'page not present'
> > event and always get injected.
> >
> > s390 seems to always be able to inject 'page not present', the
> > change is effectively a nop.
> >
> > Suggested-by: Vivek Goyal <vgoyal@redhat.com>
> > Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> > ---
> > arch/s390/include/asm/kvm_host.h | 2 +-
> > arch/s390/kvm/kvm-s390.c | 4 +++-
> > arch/x86/include/asm/kvm_host.h | 2 +-
> > arch/x86/kvm/x86.c | 7 +++++--
> > include/linux/kvm_host.h | 1 +
> > virt/kvm/async_pf.c | 2 +-
> > 6 files changed, 12 insertions(+), 6 deletions(-)
> >
> > diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
> > index 3d554887794e..cee3cb6455a2 100644
> > --- a/arch/s390/include/asm/kvm_host.h
> > +++ b/arch/s390/include/asm/kvm_host.h
> > @@ -978,7 +978,7 @@ bool kvm_arch_can_dequeue_async_page_present(struct kvm_vcpu *vcpu);
> > void kvm_arch_async_page_ready(struct kvm_vcpu *vcpu,
> > struct kvm_async_pf *work);
> >
> > -void kvm_arch_async_page_not_present(struct kvm_vcpu *vcpu,
> > +bool kvm_arch_async_page_not_present(struct kvm_vcpu *vcpu,
> > struct kvm_async_pf *work);
>
> Hi Vitaly,
>
> A minor nit. Using return code to figure out if exception was injected
> or not is little odd. How about we pass a pointer instead as parameter
> and kvm_arch_async_page_not_present() sets it to true if page not
> present exception was injected. This probably will be easier to
> read.
>
> If for some reason you don't like above, atleats it warrants a comment
> explaining what do 0 and 1 mean.
>
> Otherwise both the patches look good to me. I tested and I can confirm
> that now page ready events are not being delivered to guest if page
> not present was not injected.
Why does kvm_arch_async_page_not_present() need to "return" anything? It
has access to @work, e.g. simply replace "return true" with
"work->notpresent_injected = true".
next prev parent reply other threads:[~2020-06-10 19:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-10 17:55 [PATCH 1/2] KVM: async_pf: Cleanup kvm_setup_async_pf() Vitaly Kuznetsov
2020-06-10 17:55 ` [PATCH 2/2] KVM: async_pf: Inject 'page ready' event only if 'page not present' was previously injected Vitaly Kuznetsov
2020-06-10 19:32 ` Vivek Goyal
2020-06-10 19:47 ` Sean Christopherson [this message]
2020-06-10 19:57 ` Vivek Goyal
2020-06-10 23:53 ` Paolo Bonzini
2020-06-11 8:14 ` Vitaly Kuznetsov
2020-06-10 18:14 ` [PATCH 1/2] KVM: async_pf: Cleanup kvm_setup_async_pf() Sean Christopherson
2020-06-11 0:07 ` Paolo Bonzini
2020-06-11 8:31 ` Vitaly Kuznetsov
2020-06-11 15:35 ` Sean Christopherson
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=20200610194738.GE18790@linux.intel.com \
--to=sean.j.christopherson@intel.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=vgoyal@redhat.com \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.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 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.