svn commit: r184759 - user/kmacy/HEAD_fast_multi_xmit/sys/net
Kip Macy
kmacy at FreeBSD.org
Fri Nov 7 18:02:13 PST 2008
Author: kmacy
Date: Sat Nov 8 02:02:13 2008
New Revision: 184759
URL: http://svn.freebsd.org/changeset/base/184759
Log:
add memory barrier before critical_exit to ensure that all buffered updates are
committed to main memory before a preemption is permitted
Modified:
user/kmacy/HEAD_fast_multi_xmit/sys/net/flowtable.c
Modified: user/kmacy/HEAD_fast_multi_xmit/sys/net/flowtable.c
==============================================================================
--- user/kmacy/HEAD_fast_multi_xmit/sys/net/flowtable.c Fri Nov 7 23:50:57 2008 (r184758)
+++ user/kmacy/HEAD_fast_multi_xmit/sys/net/flowtable.c Sat Nov 8 02:02:13 2008 (r184759)
@@ -35,6 +35,21 @@
#define calloc(count, size) malloc((count)*(size), M_DEVBUF, M_WAITOK|M_ZERO)
+
+#if defined (__GNUC__)
+ #if #cpu(i386) || defined __i386 || defined i386 || defined __i386__ || #cpu(x86_64) || defined __x86_64__
+ #define mb() __asm__ __volatile__ ("sfence;": : :"memory")
+ #elif #cpu(sparc64) || defined sparc64 || defined __sparcv9
+ #define mb() __asm__ __volatile__ ("membar #MemIssue": : :"memory")
+ #elif #cpu(sparc) || defined sparc || defined __sparc__
+ #define mb() __asm__ __volatile__ ("stbar;": : :"memory")
+ #else
+ #define mb() /* XXX just to make this compile */
+ #endif
+#else
+ #error "unknown compiler"
+#endif
+
/*
* Taken from http://burtleburtle.net/bob/c/lookup3.c
*/
@@ -317,6 +332,7 @@ static void
flowtable_pcpu_unlock(struct flowtable *table, uint32_t hash)
{
+ mb();
critical_exit();
}
More information about the svn-src-user
mailing list