[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 3/3] Disable ARB_DIS conditionally



On 3/9/08 11:21, "Wei, Gang" <gang.wei@xxxxxxxxx> wrote:

> CPU0: -------------judge then clear
> ARB_DIS----------------------------------dec count
> CPU1: inc count-------------------------------------judge then set ARB_DIS

Yes, that's a more likely race.

> Sync via spinlock is good suggest, I need to do some testing to make sure
> spinlock will not bring larger-than-saved overheads.

Actually I think it'll be okay. Place the lock next to the c3_cpu_count (so
they share a cacheline). Something like:

struct {
    spinlock_t lock;
    unsigned int count;
} c3_cpu_status;

Then:
 * Currently: Exclusive access to one cache line + one LOCK prefix
 * With lock: Exactly the same (since c3_cpu_count no longer needs to be an
atomic_t, and spin_unlock() is also not a LOCKed instruction).

But yes, you should test just be to be really sure.

 -- Keir



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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.