From: Marcelo Tosatti <mtosatti@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: KVM list <kvm@vger.kernel.org>
Subject: Re: mm_pages_next() question
Date: Tue, 31 Mar 2009 13:18:31 -0300 [thread overview]
Message-ID: <20090331161831.GA4131@amt.cnet> (raw)
In-Reply-To: <49CF6868.7040205@redhat.com>
On Sun, Mar 29, 2009 at 03:24:08PM +0300, Avi Kivity wrote:
>> static int mmu_pages_next(struct kvm_mmu_pages *pvec,
>> struct mmu_page_path *parents,
>> int i)
>> {
>> int n;
>>
>> for (n = i+1; n < pvec->nr; n++) {
>> struct kvm_mmu_page *sp = pvec->page[n].sp;
>>
>> if (sp->role.level == PT_PAGE_TABLE_LEVEL) {
>> parents->idx[0] = pvec->page[n].idx;
>> return n;
>> }
>>
>> parents->parent[sp->role.level-2] = sp;
>> parents->idx[sp->role.level-1] = pvec->page[n].idx;
>> }
>>
>> return n;
>> }
>
> Do we need to break out of the loop if we switch parents during the loop
> (since that will give us a different mmu_page_path)? Or are callers
> careful to only pass pvecs which belong to the same shadow page?
This function builds mmu_page_path for a number of pagetable (leaf)
pages. Whenever the path changes, mmu_page_path will be rebuilt.
The pages in the pvec must be organized as follows:
level4, level3, level2, level1, level1, level1, ...., level3, level2,
level1, level1, ...
So you don't have to repeat higher levels for a number of leaf pages.
next prev parent reply other threads:[~2009-03-31 16:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-29 12:24 mm_pages_next() question Avi Kivity
2009-03-31 16:18 ` Marcelo Tosatti [this message]
2009-04-01 8:40 ` Avi Kivity
2009-04-01 17:15 ` 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=20090331161831.GA4131@amt.cnet \
--to=mtosatti@redhat.com \
--cc=avi@redhat.com \
--cc=kvm@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 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.