lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200610194738.GE18790@linux.intel.com>
Date:   Wed, 10 Jun 2020 12:47:38 -0700
From:   Sean Christopherson <sean.j.christopherson@...el.com>
To:     Vivek Goyal <vgoyal@...hat.com>
Cc:     Vitaly Kuznetsov <vkuznets@...hat.com>, kvm@...r.kernel.org,
        Paolo Bonzini <pbonzini@...hat.com>,
        Wanpeng Li <wanpengli@...cent.com>,
        Jim Mattson <jmattson@...gle.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] KVM: async_pf: Inject 'page ready' event only if
 'page not present' was previously injected

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@...hat.com>
> > Signed-off-by: Vitaly Kuznetsov <vkuznets@...hat.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".

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ