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-devel

Re: [Xen-devel] RFC: 32 bits as smallest atomic size.


On 25 Mar 2005, at 23:49, Jimi Xenidis wrote:

"KF" == Keir Fraser <Keir.Fraser@xxxxxxxxxxxx> writes:

KF> I expect we can fix that up in the ppc macros: if the atomic access is KF> sub-32-bit aligned then round the address down to 32-bit boundary and
 KF> do a 32-bit cmpxchg.

A few issues:
  1) this assumes that the quantity is wholy contained in our atomic
     unit, by using packed there is no way to guarantee that.

We always naturally align fields, even in packed structs. The compiler doesn't do it for us, but we check it manually.

  2) it would have to be a runtime decision on all PPC atomic
     operations that could fail with no real failure path available.

It may have to be a run-time decision unless we can come up with some clever trick. I don't understand what you mean about there being no failure path.

We could also program it out, consider this alternative:
    typedef struct {
        struct {
            u16     flags;      /* 0 */
            domid_t domid;      /* 2 */
        } atomic;
        u32     frame;      /* 4 */
    } grant_entry_t; /* 8 bytes */

This may make sense since we do update those two fields as a pair. We have a big update to the grant table code about to be checked in. We shoudl hold off doing this kind of fix until after the update has been committed.


Few things to note:
  1) packed is necessary since the ABI will do the right thing
  2) would simplify the code at grant_table.c:162
  3) will have better performance since all access are guranteed to be
     aligned.

We always naturally align fields. We may do *subword* accesses sometimes, but they are always naturally aligned and will never straddle a cacheline. I think that subword accesses should get fixed up in your ppc macros. In teh specific case of the grant table structures let's look closer once teh big update is in the tree.

 -- Keir



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-devel