All of lore.kernel.org
 help / color / mirror / Atom feed
* My turn to rant about types... bitops
@ 2005-10-05 16:52 Jimi Xenidis
  2005-10-05 18:17 ` Keir Fraser
  0 siblings, 1 reply; 8+ messages in thread
From: Jimi Xenidis @ 2005-10-05 16:52 UTC (permalink / raw)
  To: xen-devel; +Cc: rusty

I think around linux-2.4.19 (and thanks to rusty?) bitops.h went s/ 
void */unsigned long */, any chance is Xen following suit?
The next request would be to change all arrays destined for bitops to  
be defined using unsigned long.
specifically:
     struct shared_info {
         [....]
         u32 evtchn_pending[32];
         u32 evtchn_mask[32];
     };

-JX

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: My turn to rant about types... bitops
  2005-10-05 16:52 My turn to rant about types... bitops Jimi Xenidis
@ 2005-10-05 18:17 ` Keir Fraser
  2005-10-06 11:32   ` Jimi Xenidis
                     ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Keir Fraser @ 2005-10-05 18:17 UTC (permalink / raw)
  To: Jimi Xenidis; +Cc: rusty, xen-devel


On 5 Oct 2005, at 17:52, Jimi Xenidis wrote:

> I think around linux-2.4.19 (and thanks to rusty?) bitops.h went 
> s/void */unsigned long */, any chance is Xen following suit?
> The next request would be to change all arrays destined for bitops to 
> be defined using unsigned long.
> specifically:

Just cast to 'unsigned long *' when you use those ops. Why work around 
details of the way that Linux happens to do atomic ops in our 
interfaces?

  -- Keir

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: My turn to rant about types... bitops
  2005-10-05 18:17 ` Keir Fraser
@ 2005-10-06 11:32   ` Jimi Xenidis
  2005-10-06 13:39     ` Andi Kleen
       [not found]   ` <7D88E873-B404-4E28-BE87-D474F67CAA82@watson.ibm.com>
  2005-10-10 11:44   ` Rusty Russell
  2 siblings, 1 reply; 8+ messages in thread
From: Jimi Xenidis @ 2005-10-06 11:32 UTC (permalink / raw)
  To: Keir Fraser; +Cc: rusty, xen-devel

Always the job of the maintainer to ask why :)
Well, since linux bitops use unsigned long, being the largest machine  
word and therefore the most efficient, we get alignment issues.

The next request is really the jist of what we are after, doing 64bit  
operations 32bit aligned data kills us performance wise and WRT  
bitops cannot be used for atomic ops. If htis was just Xen I'd  
consider adding 32bit bitops but I doubt I'd be able to do that in  
Linux which does not provide "u32" bitops.

IIRC assuring this alignement would even help x86, no?
-JX

On Oct 5, 2005, at 2:17 PM, Keir Fraser wrote:


>
> On 5 Oct 2005, at 17:52, Jimi Xenidis wrote:
>
>
>
>> I think around linux-2.4.19 (and thanks to rusty?) bitops.h went s/ 
>> void */unsigned long */, any chance is Xen following suit?
>> The next request would be to change all arrays destined for bitops  
>> to be defined using unsigned long.
>> specifically:
>>
>>
>
> Just cast to 'unsigned long *' when you use those ops. Why work  
> around details of the way that Linux happens to do atomic ops in  
> our interfaces?
>
>  -- Keir
>
>
>
>

-JX
--
"I got an idea, an idea so smart my head would explode if I even
   began to know what I was talking about." -- Peter Griffin (Family  
Guy)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: My turn to rant about types... bitops
       [not found]   ` <7D88E873-B404-4E28-BE87-D474F67CAA82@watson.ibm.com>
@ 2005-10-06 12:49     ` Keir Fraser
  0 siblings, 0 replies; 8+ messages in thread
From: Keir Fraser @ 2005-10-06 12:49 UTC (permalink / raw)
  To: Jimi Xenidis; +Cc: xen-devel List


On 6 Oct 2005, at 12:28, Jimi Xenidis wrote:

> Always the job of the maintainer to ask why :)
> Well, since linux bitops use unsigned long, being the largest machine 
> word and therefore the most efficient, we get alignment issues.
>
> The next request is really the jist of what we are after, doing 64bit 
> operations 32bit aligned data kills us performance wise and WRT bitops 
> cannot be used for atomic ops. If htis was just Xen I'd consider 
> adding 32bit bitops but I doubt I'd be able to do that in Linux which 
> does not provide "u32" bitops.

The alignment issue is a fair point. I'll see if changing the type 
would affect much code.

  -- Keir

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: My turn to rant about types... bitops
  2005-10-06 11:32   ` Jimi Xenidis
@ 2005-10-06 13:39     ` Andi Kleen
  2005-10-06 15:10       ` Jimi Xenidis
  0 siblings, 1 reply; 8+ messages in thread
From: Andi Kleen @ 2005-10-06 13:39 UTC (permalink / raw)
  To: Jimi Xenidis; +Cc: rusty, xen-devel

Jimi Xenidis <jimix@watson.ibm.com> writes:
> 
> The next request is really the jist of what we are after, doing 64bit
> operations 32bit aligned data kills us performance wise and WRT
> bitops cannot be used for atomic ops. If htis was just Xen I'd
> consider adding 32bit bitops but I doubt I'd be able to do that in
> Linux which does not provide "u32" bitops.

Actually it does - when the arch has ARCH_HAS_ATOMIC_UNSIGNED set
it's allowed with the normal bitops.
 
> IIRC assuring this alignement would even help x86, no?

I doubt it (unless you're straddling a cache line) 

-Andi

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: My turn to rant about types... bitops
  2005-10-06 13:39     ` Andi Kleen
@ 2005-10-06 15:10       ` Jimi Xenidis
  2005-10-06 15:19         ` Andi Kleen
  0 siblings, 1 reply; 8+ messages in thread
From: Jimi Xenidis @ 2005-10-06 15:10 UTC (permalink / raw)
  To: Andi Kleen; +Cc: rusty, xen-devel


On Oct 6, 2005, at 9:39 AM, Andi Kleen wrote:

> Jimi Xenidis <jimix@watson.ibm.com> writes:
>
>> adding 32bit bitops but I doubt I'd be able to do that in
>> Linux which does not provide "u32" bitops.
>>
>
> Actually it does - when the arch has ARCH_HAS_ATOMIC_UNSIGNED set
> it's allowed with the normal bitops.
Its not set for linuxppc64, bitops use longs so the code is optimized  
for them.


-JX
--
"I got an idea, an idea so smart my head would explode if I even
   began to know what I was talking about." -- Peter Griffin (Family  
Guy)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: My turn to rant about types... bitops
  2005-10-06 15:10       ` Jimi Xenidis
@ 2005-10-06 15:19         ` Andi Kleen
  0 siblings, 0 replies; 8+ messages in thread
From: Andi Kleen @ 2005-10-06 15:19 UTC (permalink / raw)
  To: Jimi Xenidis; +Cc: rusty, xen-devel

On Thursday 06 October 2005 17:10, Jimi Xenidis wrote:
> On Oct 6, 2005, at 9:39 AM, Andi Kleen wrote:
> > Jimi Xenidis <jimix@watson.ibm.com> writes:
> >> adding 32bit bitops but I doubt I'd be able to do that in
> >> Linux which does not provide "u32" bitops.
> >
> > Actually it does - when the arch has ARCH_HAS_ATOMIC_UNSIGNED set
> > it's allowed with the normal bitops.
>
> Its not set for linuxppc64, bitops use longs so the code is optimized
> for them.

Well, that's a specific linuxppc64 limitation.

-Andi

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: My turn to rant about types... bitops
  2005-10-05 18:17 ` Keir Fraser
  2005-10-06 11:32   ` Jimi Xenidis
       [not found]   ` <7D88E873-B404-4E28-BE87-D474F67CAA82@watson.ibm.com>
@ 2005-10-10 11:44   ` Rusty Russell
  2 siblings, 0 replies; 8+ messages in thread
From: Rusty Russell @ 2005-10-10 11:44 UTC (permalink / raw)
  To: Keir Fraser; +Cc: Jimi Xenidis, xen-devel

On Wed, 2005-10-05 at 19:17 +0100, Keir Fraser wrote:
> On 5 Oct 2005, at 17:52, Jimi Xenidis wrote:
> 
> > I think around linux-2.4.19 (and thanks to rusty?) bitops.h went 
> > s/void */unsigned long */, any chance is Xen following suit?
> > The next request would be to change all arrays destined for bitops to 
> > be defined using unsigned long.
> > specifically:
> 
> Just cast to 'unsigned long *' when you use those ops. Why work around 
> details of the way that Linux happens to do atomic ops in our 
> interfaces?

A bitmask type might be nice.  Linux has some ugly macros to do just
that, but at least it's explicit ("need this many bits").

Rusty.
-- 
A bad analogy is like a leaky screwdriver -- Richard Braakman

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-10-10 11:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-05 16:52 My turn to rant about types... bitops Jimi Xenidis
2005-10-05 18:17 ` Keir Fraser
2005-10-06 11:32   ` Jimi Xenidis
2005-10-06 13:39     ` Andi Kleen
2005-10-06 15:10       ` Jimi Xenidis
2005-10-06 15:19         ` Andi Kleen
     [not found]   ` <7D88E873-B404-4E28-BE87-D474F67CAA82@watson.ibm.com>
2005-10-06 12:49     ` Keir Fraser
2005-10-10 11:44   ` Rusty Russell

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.