All of lore.kernel.org
 help / color / mirror / Atom feed
From: linmiaohe <linmiaohe@huawei.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: [PATCH] KVM: async_pf: drop kvm_arch_async_page_present wrappers
Date: Wed, 22 Jan 2020 02:19:30 +0000	[thread overview]
Message-ID: <5cbb5d89f6254dda8d9d156fa07dfd97@huawei.com> (raw)

Hi:
Paolo Bonzini <pbonzini@redhat.com> wrote:
>The wrappers make it less clear that the position of the call to kvm_arch_async_page_present depends on the architecture, and that only one of the two call sites will actually be active.
>Remove them.
>
>Cc: Andy Lutomirski <luto@kernel.org>
>Cc: Christian Borntraeger <borntraeger@de.ibm.com>
>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>---
> virt/kvm/async_pf.c | 21 ++++-----------------
> 1 file changed, 4 insertions(+), 17 deletions(-)
>
>-static inline void kvm_async_page_present_sync(struct kvm_vcpu *vcpu,
>-					       struct kvm_async_pf *work)
>-{
>-#ifdef CONFIG_KVM_ASYNC_PF_SYNC
>-	kvm_arch_async_page_present(vcpu, work);
>-#endif
>-}
>-static inline void kvm_async_page_present_async(struct kvm_vcpu *vcpu,
>-						struct kvm_async_pf *work)
>-{
>-#ifndef CONFIG_KVM_ASYNC_PF_SYNC
>-	kvm_arch_async_page_present(vcpu, work);
>-#endif
>-}
>-

Actually, these two functions took me some minutes to note the difference between them.
I thought they do the same thing and really confused me ... :)

> static struct kmem_cache *async_pf_cache;
> 
> int kvm_async_pf_init(void)
>@@ -80,7 +65,8 @@ static void async_pf_execute(struct work_struct *work)
> 	if (locked)
> 		up_read(&mm->mmap_sem);
> 
>-	kvm_async_page_present_sync(vcpu, apf);
>+	if (IS_ENABLED(CONFIG_KVM_ASYNC_PF_SYNC))
>+		kvm_arch_async_page_present(vcpu, apf);
> 
> 	spin_lock(&vcpu->async_pf.lock);
> 	list_add_tail(&apf->link, &vcpu->async_pf.done); @@ -157,7 +143,8 @@ void kvm_check_async_pf_completion(struct kvm_vcpu *vcpu)
> 		spin_unlock(&vcpu->async_pf.lock);
> 
> 		kvm_arch_async_page_ready(vcpu, work);
>-		kvm_async_page_present_async(vcpu, work);
>+		if (!IS_ENABLED(CONFIG_KVM_ASYNC_PF_SYNC))
>+			kvm_arch_async_page_present(vcpu, work);
> 
> 		list_del(&work->queue);
> 		vcpu->async_pf.queued--;
>--
>1.8.3.1

This patch really helps. Thanks!

Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>


             reply	other threads:[~2020-01-22  2:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-22  2:19 linmiaohe [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-01-21 13:48 [PATCH] KVM: async_pf: drop kvm_arch_async_page_present wrappers Paolo Bonzini
2020-01-21 18:42 ` Christian Borntraeger

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=5cbb5d89f6254dda8d9d156fa07dfd97@huawei.com \
    --to=linmiaohe@huawei.com \
    --cc=borntraeger@de.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=pbonzini@redhat.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.