diff mbox

[Qemu-devel,RFC] virtio: put last seen used index into ring itself

Message ID 20100523155605.GB14733@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Michael S. Tsirkin May 23, 2010, 3:56 p.m. UTC
None
diff mbox

Patch

diff --git a/cachebounce.c b/cachebounce.c
index 0387027..ebe5a37 100644
--- a/cachebounce.c
+++ b/cachebounce.c
@@ -77,6 +77,7 @@  int main(int argc, char *argv[])
 				count++;
 				counter->cacheline1 = count;
 				count++;
+				__sync_synchronize();
 			}
 			break;
 		case UNSHARE:
@@ -86,6 +87,7 @@  int main(int argc, char *argv[])
 				count++;
 				counter->cacheline2 = count;
 				count++;
+				__sync_synchronize();
 			}
 			break;
 		case LOCKSHARE:
@@ -98,6 +100,7 @@  int main(int argc, char *argv[])
 			break;
 		case LOCKUNSHARE:
 			while (count < MAX_BOUNCES) {
+				__sync_synchronize();
 				/* Spin waiting for other side to change it. */
 				while (counter->cacheline1 != count);
 				__sync_val_compare_and_swap(&counter->cacheline2, count, count+1);
@@ -115,6 +118,7 @@  int main(int argc, char *argv[])
 				count++;
 				counter->cacheline1 = count;
 				count++;
+				__sync_synchronize();
 			}
 			break;
 		case UNSHARE:
@@ -124,6 +128,7 @@  int main(int argc, char *argv[])
 				count++;
 				counter->cacheline1 = count;
 				count++;
+				__sync_synchronize();
 			}
 			break;
 		case LOCKSHARE: