Kernel KVM-PPC virtualization development
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@ozlabs.org>
To: kvm-ppc@vger.kernel.org
Subject: Re: [RFC PATCH 18/32] KVM: PPC: Book3S HV: Use kvmppc_unmap_pte() in kvm_unmap_radix()
Date: Wed, 26 Sep 2018 11:18:56 +0000	[thread overview]
Message-ID: <20180926111856.GC29799@fergus> (raw)
In-Reply-To: <1537524123-9578-19-git-send-email-paulus@ozlabs.org>

On Wed, Sep 26, 2018 at 02:30:02PM +1000, David Gibson wrote:
> On Wed, Sep 26, 2018 at 02:08:37PM +1000, David Gibson wrote:
> > >  static void kvmppc_unmap_pte(struct kvm *kvm, pte_t *pte,
> > > -			     unsigned long gpa, unsigned int shift)
> > > +			     unsigned long gpa, unsigned int shift,
> > > +			     struct kvm_memory_slot *memslot)
> > >  
> > >  {
> > > -	unsigned long page_size = 1ul << shift;
> > >  	unsigned long old;
> > >  
> > >  	old = kvmppc_radix_update_pte(kvm, pte, ~0UL, 0, gpa, shift);
> > >  	kvmppc_radix_tlbie_page(kvm, gpa, shift);
> > >  	if (old & _PAGE_DIRTY) {
> > >  		unsigned long gfn = gpa >> PAGE_SHIFT;
> > > -		struct kvm_memory_slot *memslot;
> > > +		unsigned long page_size = PAGE_SIZE;
> > >  
> > > -		memslot = gfn_to_memslot(kvm, gfn);
> > > -		if (memslot && memslot->dirty_bitmap)
> > > +		if (shift)
> > > +			page_size = 1ul << shift;
> > > +		if (!memslot)
> > > +			memslot = gfn_to_memslot(kvm, gfn);
> 
> ..it might be nicer to avoid the explicit test on memslot by maping a
> __kvmppc_unmap_pte() which must have memslot passed in, and a wrapper
> which computes it from the gfn.

Then we would be looking up the memslot even when we aren't going to
use it.  In a subsequent patch this function gets used on shadow page
tables and in that case we never need the memslot.

Paul.

  parent reply	other threads:[~2018-09-26 11:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-21 10:01 [RFC PATCH 18/32] KVM: PPC: Book3S HV: Use kvmppc_unmap_pte() in kvm_unmap_radix() Paul Mackerras
2018-09-26  4:08 ` David Gibson
2018-09-26  4:30 ` David Gibson
2018-09-26 11:18 ` Paul Mackerras [this message]
2018-09-27  4:13 ` David Gibson

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=20180926111856.GC29799@fergus \
    --to=paulus@ozlabs.org \
    --cc=kvm-ppc@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox