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] xenbus stress testing

James Harper writes ("RE: [Xen-devel] xenbus stress testing"):
> I think I have found the error and it was probably a 1 in a million race
> so stress testing might not have helped anyway. My code went:
> 
> len = min(ring->rsp_prod - ring->rsp_cons, msg_size)
> 
> and the ASSERT was hit because len was > msg_size, and the only possible
> way I can ever see that happening is if ring->rsp_prod changed between
> the if in the min() and the assignment. I'm now snapshotting rsp_prod to
> a local variable at the start. Kind of embarrassing really as plenty of
> example code exists.

You need to think about memory barriers and/or volatile.  Simply
"snapshotting" with an ordinary assignment doesn't work.

I don't know how this is done in Windows but the Linux kernel has a
clear explanation of the problem and how it's solved in Linux.  Look
in the kernel source tree in Documentation/memory-barriers.txt.

Ian.

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