All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
To: Alexander Graf <agraf-l3A5Bk7waGM@public.gmane.org>
Cc: Avi Kivity <avi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	mtosatti-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	kvm-ppc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [RFC please check] KVM: question about the commit "Use Little
Date: Thu, 22 Apr 2010 04:12:17 +0000	[thread overview]
Message-ID: <4BCFCCA1.3020000@oss.ntt.co.jp> (raw)
In-Reply-To: <F5C06DB2-AECA-4E05-8B58-74576B65D800-l3A5Bk7waGM@public.gmane.org>


>>> So please explain me about the commit:
>>>    1. is this really the thing you intended to do?
>>>
>>
>> I think so.
>>
>>>    2. including<asm-generic/bitops/le.h>   directly is OK?
>>>       -- I made a sample patch to avoid this, see below.
>>>
>>
>> I don't see a problem with it, it is also included from other places.
>>
>> It might be possible to change it to<asm/bitops/le.h>, not sure how the include paths are set out.
>
> That's the great thing about being in-kernel :-).
>
>>
>>>    3. or, I misunderstand something about Alex's comment?
>>>
>>
>> I missed the comment.  What was it?
>
> What comment? The reason was that longs and big endian don't match and I wanted to make it LE. This seemed like the right function to use, as other code in Linux uses it too.
>

This one!

= > +static int __mark_page_dirty(unsigned long nr,
 > > +			     unsigned long *dirty_bitmap)
 > > +{
 > > +#ifdef __BIG_ENDIAN
 > > +	nr = nr ^ BITOP_LE_SWIZZLE;
Why an XOR here?

Also is this LE set_bit new? I didn't see it when I did the patch back then :).
=
I confused that "LE set_bit" is about the current generic___set_le_bit().

So I felt that "then, who introduced this set le bit actually?"

Now, it's OK about it, thanks :).


But I still feel that __set_le_bit_user() will be too KVM specific helper.

Then, I have one idea:

  while looking around the bitops headers, I noticed that ppc bitops.h has exact
  copy of the *_le_bit definitions which are in the asm-generic le.h -- just for its
  internal use.

  So I'll check whether we can include le.h in ppc bitops.h for cleanup and during
  that work, define the "(nr) ^ BITOP_LE_SWIZZLE" part as separate macro like
  le_bit_offset.

  I don't know this will be accepted but this sounds little bit more generic: and
  we can reduce chances that we have to ask other maintainers to merge helpers.



> Alex
>


WARNING: multiple messages have this Message-ID (diff)
From: Takuya Yoshikawa <yoshikawa.takuya-gVGce1chcLdL9jVzuh4AOg@public.gmane.org>
To: Alexander Graf <agraf-l3A5Bk7waGM@public.gmane.org>
Cc: Avi Kivity <avi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	mtosatti-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	kvm-ppc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [RFC please check] KVM: question about the commit "Use Little Endian for Dirty Bitmap"
Date: Thu, 22 Apr 2010 13:12:17 +0900	[thread overview]
Message-ID: <4BCFCCA1.3020000@oss.ntt.co.jp> (raw)
In-Reply-To: <F5C06DB2-AECA-4E05-8B58-74576B65D800-l3A5Bk7waGM@public.gmane.org>


>>> So please explain me about the commit:
>>>    1. is this really the thing you intended to do?
>>>
>>
>> I think so.
>>
>>>    2. including<asm-generic/bitops/le.h>   directly is OK?
>>>       -- I made a sample patch to avoid this, see below.
>>>
>>
>> I don't see a problem with it, it is also included from other places.
>>
>> It might be possible to change it to<asm/bitops/le.h>, not sure how the include paths are set out.
>
> That's the great thing about being in-kernel :-).
>
>>
>>>    3. or, I misunderstand something about Alex's comment?
>>>
>>
>> I missed the comment.  What was it?
>
> What comment? The reason was that longs and big endian don't match and I wanted to make it LE. This seemed like the right function to use, as other code in Linux uses it too.
>

This one!

===
 > +static int __mark_page_dirty(unsigned long nr,
 > > +			     unsigned long *dirty_bitmap)
 > > +{
 > > +#ifdef __BIG_ENDIAN
 > > +	nr = nr ^ BITOP_LE_SWIZZLE;
Why an XOR here?

Also is this LE set_bit new? I didn't see it when I did the patch back then :).
===

I confused that "LE set_bit" is about the current generic___set_le_bit().

So I felt that "then, who introduced this set le bit actually?"

Now, it's OK about it, thanks :).


But I still feel that __set_le_bit_user() will be too KVM specific helper.

Then, I have one idea:

  while looking around the bitops headers, I noticed that ppc bitops.h has exact
  copy of the *_le_bit definitions which are in the asm-generic le.h -- just for its
  internal use.

  So I'll check whether we can include le.h in ppc bitops.h for cleanup and during
  that work, define the "(nr) ^ BITOP_LE_SWIZZLE" part as separate macro like
  le_bit_offset.

  I don't know this will be accepted but this sounds little bit more generic: and
  we can reduce chances that we have to ask other maintainers to merge helpers.



> Alex
>

  parent reply	other threads:[~2010-04-22  4:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-21  6:07 [RFC please check] KVM: question about the commit Takuya Yoshikawa
2010-04-21  6:07 ` [RFC please check] KVM: question about the commit "Use Little Endian for Dirty Bitmap" Takuya Yoshikawa
     [not found] ` <20100421150720.16516cb7.yoshikawa.takuya-gVGce1chcLdL9jVzuh4AOg@public.gmane.org>
2010-04-21  8:45   ` [RFC please check] KVM: question about the commit "Use Little Takuya Yoshikawa
2010-04-21  8:45     ` [RFC please check] KVM: question about the commit "Use Little Endian for Dirty Bitmap" Takuya Yoshikawa
2010-04-21  9:26 ` [RFC please check] KVM: question about the commit "Use Little Avi Kivity
2010-04-21  9:26   ` [RFC please check] KVM: question about the commit "Use Little Endian for Dirty Bitmap" Avi Kivity
     [not found]   ` <4BCEC4AD.6060305-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-04-21  9:32     ` Alexander Graf
2010-04-21  9:32       ` Alexander Graf
     [not found]       ` <F5C06DB2-AECA-4E05-8B58-74576B65D800-l3A5Bk7waGM@public.gmane.org>
2010-04-22  4:12         ` Takuya Yoshikawa [this message]
2010-04-22  4:12           ` Takuya Yoshikawa

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=4BCFCCA1.3020000@oss.ntt.co.jp \
    --to=yoshikawa.takuya@oss.ntt.co.jp \
    --cc=agraf-l3A5Bk7waGM@public.gmane.org \
    --cc=avi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=kvm-ppc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mtosatti-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.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.