From: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
To: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Cc: avi@redhat.com, mtosatti@redhat.com, agraf@suse.de,
paulus@samba.org, aarcange@redhat.com, kvm@vger.kernel.org,
kvm-ppc@vger.kernel.org, linux-kernel@vger.kernel.org,
takuya.yoshikawa@gmail.com
Subject: Re: [PATCH 5/6] KVM: Separate rmap_pde from kvm_lpage_info->write_count
Date: Thu, 28 Jun 2012 03:12:51 +0000 [thread overview]
Message-ID: <4FEBCBB3.3060707@linux.vnet.ibm.com> (raw)
In-Reply-To: <20120628110141.7b908c91.yoshikawa.takuya@oss.ntt.co.jp>
On 06/28/2012 10:01 AM, Takuya Yoshikawa wrote:
> This makes it possible to loop over rmap_pde arrays in the same way as
> we do over rmap so that we can optimize kvm_handle_hva_range() easily in
> the following patch.
>
> Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
> ---
> arch/x86/include/asm/kvm_host.h | 2 +-
> arch/x86/kvm/mmu.c | 6 +++---
> arch/x86/kvm/x86.c | 11 +++++++++++
> 3 files changed, 15 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> index 5aab8d4..aea1673 100644
> --- a/arch/x86/include/asm/kvm_host.h
> +++ b/arch/x86/include/asm/kvm_host.h
> @@ -499,11 +499,11 @@ struct kvm_vcpu_arch {
> };
>
> struct kvm_lpage_info {
> - unsigned long rmap_pde;
> int write_count;
> };
>
> struct kvm_arch_memory_slot {
> + unsigned long *rmap_pde[KVM_NR_PAGE_SIZES - 1];
> struct kvm_lpage_info *lpage_info[KVM_NR_PAGE_SIZES - 1];
> };
>
It looks little complex than before - need manage more alloc-ed/freed buffers.
Why not just introduce a function to get the next rmap? Something like this:
static unsigned long *get_next_rmap(unsigned long *rmap, int level)
{
struct kvm_lpage_info *linfo
if (level = 1)
return rmap++
linfo = container_of(rmap, struct kvm_lpage_info, rmap_pde);
return &(++linfo)->rmap_pde
}
[ Completely untested ]
WARNING: multiple messages have this Message-ID (diff)
From: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
To: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Cc: avi@redhat.com, mtosatti@redhat.com, agraf@suse.de,
paulus@samba.org, aarcange@redhat.com, kvm@vger.kernel.org,
kvm-ppc@vger.kernel.org, linux-kernel@vger.kernel.org,
takuya.yoshikawa@gmail.com
Subject: Re: [PATCH 5/6] KVM: Separate rmap_pde from kvm_lpage_info->write_count
Date: Thu, 28 Jun 2012 11:12:51 +0800 [thread overview]
Message-ID: <4FEBCBB3.3060707@linux.vnet.ibm.com> (raw)
In-Reply-To: <20120628110141.7b908c91.yoshikawa.takuya@oss.ntt.co.jp>
On 06/28/2012 10:01 AM, Takuya Yoshikawa wrote:
> This makes it possible to loop over rmap_pde arrays in the same way as
> we do over rmap so that we can optimize kvm_handle_hva_range() easily in
> the following patch.
>
> Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
> ---
> arch/x86/include/asm/kvm_host.h | 2 +-
> arch/x86/kvm/mmu.c | 6 +++---
> arch/x86/kvm/x86.c | 11 +++++++++++
> 3 files changed, 15 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> index 5aab8d4..aea1673 100644
> --- a/arch/x86/include/asm/kvm_host.h
> +++ b/arch/x86/include/asm/kvm_host.h
> @@ -499,11 +499,11 @@ struct kvm_vcpu_arch {
> };
>
> struct kvm_lpage_info {
> - unsigned long rmap_pde;
> int write_count;
> };
>
> struct kvm_arch_memory_slot {
> + unsigned long *rmap_pde[KVM_NR_PAGE_SIZES - 1];
> struct kvm_lpage_info *lpage_info[KVM_NR_PAGE_SIZES - 1];
> };
>
It looks little complex than before - need manage more alloc-ed/freed buffers.
Why not just introduce a function to get the next rmap? Something like this:
static unsigned long *get_next_rmap(unsigned long *rmap, int level)
{
struct kvm_lpage_info *linfo
if (level == 1)
return rmap++
linfo = container_of(rmap, struct kvm_lpage_info, rmap_pde);
return &(++linfo)->rmap_pde
}
[ Completely untested ]
next prev parent reply other threads:[~2012-06-28 3:12 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-21 8:48 [PATCH 0/6] KVM: Optimize MMU notifier's THP page invalidation -v2 Takuya Yoshikawa
2012-06-21 8:48 ` Takuya Yoshikawa
2012-06-21 8:49 ` [PATCH 1/6] KVM: MMU: Use __gfn_to_rmap() to clean up kvm_handle_hva() Takuya Yoshikawa
2012-06-21 8:49 ` Takuya Yoshikawa
2012-06-21 8:49 ` [PATCH 2/6] KVM: Introduce hva_to_gfn_memslot() for kvm_handle_hva() Takuya Yoshikawa
2012-06-21 8:49 ` Takuya Yoshikawa
2012-06-21 8:50 ` [PATCH 3/6] KVM: MMU: Make kvm_handle_hva() handle range of addresses Takuya Yoshikawa
2012-06-21 8:50 ` Takuya Yoshikawa
2012-06-21 8:51 ` [PATCH 4/6] KVM: Introduce kvm_unmap_hva_range() for kvm_mmu_notifier_invalidate_range_start() Takuya Yoshikawa
2012-06-21 8:51 ` Takuya Yoshikawa
2012-06-21 8:51 ` [PATCH 5/6] KVM: Separate rmap_pde from kvm_lpage_info->write_count Takuya Yoshikawa
2012-06-21 8:51 ` Takuya Yoshikawa
2012-06-21 8:52 ` [PATCH 6/6] KVM: MMU: Avoid handling same rmap_pde in kvm_handle_hva_range() Takuya Yoshikawa
2012-06-21 8:52 ` Takuya Yoshikawa
2012-06-22 14:33 ` Takuya Yoshikawa
2012-06-22 14:33 ` Takuya Yoshikawa
2012-06-21 12:51 ` [PATCH 0/6] KVM: Optimize MMU notifier's THP page invalidation -v2 Alexander Graf
2012-06-21 12:51 ` Alexander Graf
2012-06-28 1:57 ` [PATCH 0/6] KVM: Optimize MMU notifier's THP page invalidation -v3 Takuya Yoshikawa
2012-06-28 1:57 ` Takuya Yoshikawa
2012-06-28 1:58 ` [PATCH 1/6] KVM: MMU: Use __gfn_to_rmap() to clean up kvm_handle_hva() Takuya Yoshikawa
2012-06-28 1:58 ` Takuya Yoshikawa
2012-06-28 1:59 ` [PATCH 2/6] KVM: Introduce hva_to_gfn_memslot() for kvm_handle_hva() Takuya Yoshikawa
2012-06-28 1:59 ` Takuya Yoshikawa
2012-06-28 2:00 ` [PATCH 3/6] KVM: MMU: Make kvm_handle_hva() handle range of addresses Takuya Yoshikawa
2012-06-28 2:00 ` Takuya Yoshikawa
2012-06-28 2:00 ` [PATCH 4/6] KVM: Introduce kvm_unmap_hva_range() for kvm_mmu_notifier_invalidate_range_start() Takuya Yoshikawa
2012-06-28 2:00 ` Takuya Yoshikawa
2012-06-28 2:01 ` [PATCH 5/6] KVM: Separate rmap_pde from kvm_lpage_info->write_count Takuya Yoshikawa
2012-06-28 2:01 ` Takuya Yoshikawa
2012-06-28 3:12 ` Xiao Guangrong [this message]
2012-06-28 3:12 ` Xiao Guangrong
2012-06-28 3:45 ` Takuya Yoshikawa
2012-06-28 3:45 ` Takuya Yoshikawa
2012-06-28 17:39 ` Avi Kivity
2012-06-28 17:39 ` Avi Kivity
2012-06-29 1:44 ` Takuya Yoshikawa
2012-06-29 1:44 ` Takuya Yoshikawa
2012-07-02 2:22 ` Xiao Guangrong
2012-07-02 2:22 ` Xiao Guangrong
2012-06-28 2:02 ` [PATCH 6/6] KVM: MMU: Avoid handling same rmap_pde in kvm_handle_hva_range() Takuya Yoshikawa
2012-06-28 2:02 ` Takuya Yoshikawa
2012-06-28 17:53 ` Avi Kivity
2012-06-28 17:53 ` Avi Kivity
2012-06-29 1:46 ` Takuya Yoshikawa
2012-06-29 1:46 ` Takuya Yoshikawa
2012-07-01 7:41 ` Avi Kivity
2012-07-01 7:41 ` Avi Kivity
2012-07-01 13:18 ` Takuya Yoshikawa
2012-07-01 13:18 ` Takuya Yoshikawa
2012-07-01 13:31 ` Avi Kivity
2012-07-01 13:31 ` Avi Kivity
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=4FEBCBB3.3060707@linux.vnet.ibm.com \
--to=xiaoguangrong@linux.vnet.ibm.com \
--cc=aarcange@redhat.com \
--cc=agraf@suse.de \
--cc=avi@redhat.com \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=paulus@samba.org \
--cc=takuya.yoshikawa@gmail.com \
--cc=yoshikawa.takuya@oss.ntt.co.jp \
/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.