From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roman Kagan Subject: Re: [PATCH 1/5] kvm/x86: fix inversed check for async_pf MSR Date: Fri, 2 Dec 2016 17:31:33 +0300 Message-ID: <20161202143132.GA27461@rkaganb.sw.ru> References: Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Cc: To: Mika =?iso-8859-1?Q?Penttil=E4?= Return-path: Received: from mail-ve1eur03hn0226.outbound.protection.outlook.com ([104.47.9.226]:64151 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1759021AbcLBPBv (ORCPT ); Fri, 2 Dec 2016 10:01:51 -0500 Content-Disposition: inline In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On Fri, Dec 02, 2016 at 04:14:48PM +0200, Mika Penttilä wrote: > > On Fri, Dec 02, 2016 at 12:45:28PM +0200, Mika Penttilä wrote: > > > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > > > > index bf11fe4..14a46e9 100644 > > > > --- a/arch/x86/kvm/x86.c > > > > +++ b/arch/x86/kvm/x86.c > > > > @@ -8402,7 +8402,7 @@ void kvm_arch_async_page_present(struct kvm_vcpu *vcpu, > > > > bool kvm_arch_can_inject_async_page_present(struct kvm_vcpu *vcpu) > > > > { > > > > if (!(vcpu->arch.apf.msr_val & KVM_ASYNC_PF_ENABLED)) > > > > - return true; > > > > + return false; > > > > > > > > > > > Why do you make this change? > > > Because the code does the opposite of what it's meant to do. > > It could have a better name but returning "true" is right. See below. > > > > I think kvm_arch_async_page_present() is not > > > ever called now and neither kvm_del_async_pf_gfn(vcpu, work->arch.gfn); > > > I wonder how you came to such a conclusion? I certainly see them called > > on my test machine (you need to have the guest memory swapped out for > > that, that can be forced e.g. using a memory cgroup). > > if !KVM_ASYNC_PF_ENABLED then kvm_check_async_pf_completion(), it's only call site, never calls it. How's that? I don't see any check for it in kvm_check_async_pf_completion(). Moreover, that's exactly where it does that check. > Maybe you had KVM_ASYNC_PF_ENABLED? Of course I did. Not sure I get what you mean... Roman.