[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20120619224648.bbb360c6eeae9887de7b1f93@gmail.com>
Date: Tue, 19 Jun 2012 22:46:48 +0900
From: Takuya Yoshikawa <takuya.yoshikawa@...il.com>
To: Avi Kivity <avi@...hat.com>
Cc: Takuya Yoshikawa <yoshikawa.takuya@....ntt.co.jp>,
mtosatti@...hat.com, agraf@...e.de, paulus@...ba.org,
aarcange@...hat.com, kvm@...r.kernel.org, kvm-ppc@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/4] KVM: MMU: Make kvm_handle_hva() handle range of
addresses
On Mon, 18 Jun 2012 15:11:42 +0300
Avi Kivity <avi@...hat.com> wrote:
> Potential for improvement: don't do 512 iterations on same large page.
>
> Something like
>
> if ((gfn ^ prev_gfn) & mask(level))
> ret |= handler(...)
>
> with clever selection of the first prev_gfn so it always matches (~gfn
> maybe).
I thought up a better solution:
1. Separate rmap_pde from lpage_info->write_count and
make this a simple array. (I once tried this.)
2. Use gfn_to_index() and loop over rmap array:
...
/* intersection check */
start = max(start, memslot->userspace_addr);
end = min(end, memslot->userspace_addr +
(memslot->npages << PAGE_SHIFT));
if (start > end)
continue;
/* hva to gfn conversion */
gfn_start = hva_to_gfn_memslot(start);
gfn_end = hva_to_gfn_memslot(end);
/* main part */
for each level {
rmapp = __gfn_to_rmap(gfn_start, level, memslot);
for (idx = gfn_to_index(gfn_start, memslot->base_gfn, level);
idx < gfn_to_index(gfn_end, memslot->base_gfn, level); idx++) {
...
/* loop over rmap array */
ret |= handler(kvm, rmapp + idx, data);
}
}
Thanks,
Takuya
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists