From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Graf Subject: Re: [PATCH] Use Little Endian for Dirty Bitmap Date: Sat, 26 Sep 2009 16:35:33 +0200 Message-ID: References: <1248691134-54120-1-git-send-email-agraf@suse.de> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm-ppc , "kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org list" , Benjamin Herrenschmidt , Avi Kivity To: Alexander Graf Return-path: In-Reply-To: <1248691134-54120-1-git-send-email-agraf-l3A5Bk7waGM@public.gmane.org> Sender: kvm-ppc-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: kvm.vger.kernel.org bump On 27.07.2009, at 12:38, Alexander Graf wrote: > We currently use host endian long types to store information > in the dirty bitmap. > > This works reasonably well on Little Endian targets, because the > u32 after the first contains the next 32 bits. On Big Endian this > breaks completely though, forcing us to be inventive here. > > So Ben suggested to always use Little Endian, which looks reasonable. > > We only have dirty bitmap implemented in Little Endian targets so far > and since PowerPC would be the first Big Endian platform, we can just > as well switch to Little Endian always with little effort without > breaking existing targets. > > Signed-off-by: Alexander Graf > --- > virt/kvm/kvm_main.c | 5 +++-- > 1 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c > index 17d8688..3482ad1 100644 > --- a/virt/kvm/kvm_main.c > +++ b/virt/kvm/kvm_main.c > @@ -48,6 +48,7 @@ > #include > #include > #include > +#include > > #ifdef KVM_COALESCED_MMIO_PAGE_OFFSET > #include "coalesced_mmio.h" > @@ -1656,8 +1657,8 @@ void mark_page_dirty(struct kvm *kvm, gfn_t gfn) > unsigned long rel_gfn = gfn - memslot->base_gfn; > > /* avoid RMW */ > - if (!test_bit(rel_gfn, memslot->dirty_bitmap)) > - set_bit(rel_gfn, memslot->dirty_bitmap); > + if (!generic_test_le_bit(rel_gfn, memslot->dirty_bitmap)) > + generic___set_le_bit(rel_gfn, memslot->dirty_bitmap); > } > } > > -- > 1.6.0.2 > > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Graf Date: Sat, 26 Sep 2009 14:35:33 +0000 Subject: Re: [PATCH] Use Little Endian for Dirty Bitmap Message-Id: List-Id: References: <1248691134-54120-1-git-send-email-agraf@suse.de> In-Reply-To: <1248691134-54120-1-git-send-email-agraf-l3A5Bk7waGM@public.gmane.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Alexander Graf Cc: kvm-ppc , "kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org list" , Benjamin Herrenschmidt , Avi Kivity bump On 27.07.2009, at 12:38, Alexander Graf wrote: > We currently use host endian long types to store information > in the dirty bitmap. > > This works reasonably well on Little Endian targets, because the > u32 after the first contains the next 32 bits. On Big Endian this > breaks completely though, forcing us to be inventive here. > > So Ben suggested to always use Little Endian, which looks reasonable. > > We only have dirty bitmap implemented in Little Endian targets so far > and since PowerPC would be the first Big Endian platform, we can just > as well switch to Little Endian always with little effort without > breaking existing targets. > > Signed-off-by: Alexander Graf > --- > virt/kvm/kvm_main.c | 5 +++-- > 1 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c > index 17d8688..3482ad1 100644 > --- a/virt/kvm/kvm_main.c > +++ b/virt/kvm/kvm_main.c > @@ -48,6 +48,7 @@ > #include > #include > #include > +#include > > #ifdef KVM_COALESCED_MMIO_PAGE_OFFSET > #include "coalesced_mmio.h" > @@ -1656,8 +1657,8 @@ void mark_page_dirty(struct kvm *kvm, gfn_t gfn) > unsigned long rel_gfn = gfn - memslot->base_gfn; > > /* avoid RMW */ > - if (!test_bit(rel_gfn, memslot->dirty_bitmap)) > - set_bit(rel_gfn, memslot->dirty_bitmap); > + if (!generic_test_le_bit(rel_gfn, memslot->dirty_bitmap)) > + generic___set_le_bit(rel_gfn, memslot->dirty_bitmap); > } > } > > -- > 1.6.0.2 > > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html