WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ppc-devel

Re: [XenPPC] [RFC] fix stupid grant table flags

To: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
Subject: Re: [XenPPC] [RFC] fix stupid grant table flags
From: Hollis Blanchard <hollisb@xxxxxxxxxx>
Date: Thu, 22 Jun 2006 13:04:13 -0500
Cc: xen-ppc-devel <xen-ppc-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 22 Jun 2006 11:03:49 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <254C9D42-B242-4BAD-8AA6-43C140547BD6@xxxxxxxxxxxxxx>
List-help: <mailto:xen-ppc-devel-request@lists.xensource.com?subject=help>
List-id: Xen PPC development <xen-ppc-devel.lists.xensource.com>
List-post: <mailto:xen-ppc-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: IBM Linux Technology Center
References: <1150915751.26633.19.camel@xxxxxxxxxxxxxxxxxxxxx> <254C9D42-B242-4BAD-8AA6-43C140547BD6@xxxxxxxxxxxxxx>
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Wed, 2006-06-21 at 18:49 -0400, Jimi Xenidis wrote:
> I don't think you definition of clear_entry_flag will work, see below
> 
> On Jun 21, 2006, at 2:49 PM, Hollis Blanchard wrote:
> > diff -r ab08d443113d xen/include/asm-ppc/grant_table.h
> > --- a/xen/include/asm-ppc/grant_table.h     Wed Jun 21 13:36:49 2006 -0500
> > +++ b/xen/include/asm-ppc/grant_table.h     Wed Jun 21 13:42:23 2006 -0500
> > @@ -6,4 +6,6 @@
> >  #define mark_dirty(d, f) ((void )0)
> >  #include "../asm-x86/grant_table.h"
> >
> > +#define clear_entry_flag(nr, flags) clear_bit((nr), (int *)(flags));
> 
> 1) clear_bit takes an 'unsigned long *' so this should have cause a  
> warning

Oops, yeah, that was a last-minute change.

> 2) bitops are designed to find the ulong array element (nr /  
> BITS_PER_LONG) then set the bit like (1 << (nr % BITS_PER_LONG)) so  
> that the word feels like 'C' order.
> 
> So I think the definition should be:
>    static inline void  clear_entry_flag(unsigned long nr, volatile  
> uint16_t *addr) {
>        volatile unsigned long *laddr;
>        unsigned long lnr;
>    #ifdef SAFETY_DANCE
>        BUG_ON((ulong)addr % sizeof (ulong));
>    #endif
>        lnr = (BITS_PER_LONG - (sizeof (*addr) * 8)) + nr;
>        laddr = (volatile unsigned long *)addr;
>        clear_bit(lnr, laddr);
>    }
> 
> You could macro-tize this, but why.

Does the bit order matter if all users go through this macro? If they
don't go through this macro, we will catch them as link errors like we
do now. I guess that only covers cmpxchg callers though; anybody
directly dereferencing the field directly would break.

-- 
Hollis Blanchard
IBM Linux Technology Center


_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel