From: Marcelo Tosatti <mtosatti@redhat.com>
To: Nadav Amit <nadav.amit@gmail.com>
Cc: kvm@vger.kernel.org, ak@linux.intel.com, pbonzini@redhat.com,
xiaoguangrong@linux.vnet.ibm.com, gleb@kernel.org,
avi.kivity@gmail.com
Subject: Re: [patch 2/4] KVM: MMU: allow pinning spte translations (TDP-only)
Date: Thu, 17 Jul 2014 18:38:23 -0300 [thread overview]
Message-ID: <20140717213823.GA18770@amt.cnet> (raw)
In-Reply-To: <53C8054B.5080604@gmail.com>
On Thu, Jul 17, 2014 at 08:18:03PM +0300, Nadav Amit wrote:
> Small question if I may regarding kvm_mmu_pin_pages:
>
> On 7/9/14, 10:12 PM, mtosatti@redhat.com wrote:
> >+
> >+static int kvm_mmu_pin_pages(struct kvm_vcpu *vcpu)
> >+{
> >+ struct kvm_pinned_page_range *p;
> >+ int r = 1;
> >+
> >+ if (is_guest_mode(vcpu))
> >+ return r;
> >+
> >+ if (!vcpu->arch.mmu.direct_map)
> >+ return r;
> >+
> >+ ASSERT(VALID_PAGE(vcpu->arch.mmu.root_hpa));
> >+
> >+ list_for_each_entry(p, &vcpu->arch.pinned_mmu_pages, link) {
> >+ gfn_t gfn_offset;
> >+
> >+ for (gfn_offset = 0; gfn_offset < p->npages; gfn_offset++) {
> >+ gfn_t gfn = p->base_gfn + gfn_offset;
> >+ int r;
> >+ bool pinned = false;
> >+
> >+ r = vcpu->arch.mmu.page_fault(vcpu, gfn << PAGE_SHIFT,
> >+ PFERR_WRITE_MASK, false,
> >+ true, &pinned);
>
> I understand that the current use-case is for pinning only few
> pages. Yet, wouldn't it be better (for performance) to check whether
> the gfn uses a large page and if so to skip forward, increasing
> gfn_offset to point to the next large page?
Sure, that can be a lazy optimization and performed when necessary?
(feel free to do it in advance if you're interested in doing it
now).
next prev parent reply other threads:[~2014-07-17 21:38 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-09 19:12 [patch 0/4] KVM: support for pinning sptes (v2) mtosatti
2014-07-09 19:12 ` [patch 1/4] KVM: x86: add pinned parameter to page_fault methods mtosatti
2014-07-09 19:12 ` [patch 2/4] KVM: MMU: allow pinning spte translations (TDP-only) mtosatti
2014-07-17 17:18 ` Nadav Amit
2014-07-17 21:38 ` Marcelo Tosatti [this message]
2014-07-24 12:16 ` Nadav Amit
2014-07-21 21:46 ` Xiao Guangrong
2014-07-22 5:26 ` Xiao Guangrong
2014-07-09 19:12 ` [patch 3/4] KVM: MMU: reload request from GET_DIRTY_LOG path mtosatti
2014-07-21 13:14 ` Gleb Natapov
2014-09-09 15:28 ` Marcelo Tosatti
2014-09-22 17:19 ` Marcelo Tosatti
2014-09-30 18:59 ` Marcelo Tosatti
2014-10-04 7:23 ` Gleb Natapov
2014-10-06 17:19 ` Marcelo Tosatti
2014-10-08 6:56 ` Gleb Natapov
2014-10-08 17:15 ` Marcelo Tosatti
2014-10-08 17:59 ` Gleb Natapov
2014-10-08 19:22 ` Marcelo Tosatti
2014-10-10 13:09 ` Gleb Natapov
2014-10-13 8:52 ` Marcelo Tosatti
2014-10-15 8:03 ` Gleb Natapov
2014-07-21 21:55 ` Xiao Guangrong
2014-09-09 15:35 ` Marcelo Tosatti
2014-07-09 19:12 ` [patch 4/4] KVM: MMU: pinned sps are not candidates for deletion mtosatti
2014-07-21 21:59 ` Xiao Guangrong
2014-09-09 15:41 ` Marcelo Tosatti
2014-09-22 17:17 ` Marcelo Tosatti
2014-09-23 5:30 ` Xiao Guangrong
2014-07-09 19:20 ` [patch 0/4] KVM: support for pinning sptes (v2) Marcelo Tosatti
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=20140717213823.GA18770@amt.cnet \
--to=mtosatti@redhat.com \
--cc=ak@linux.intel.com \
--cc=avi.kivity@gmail.com \
--cc=gleb@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=nadav.amit@gmail.com \
--cc=pbonzini@redhat.com \
--cc=xiaoguangrong@linux.vnet.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox