[ovs-dev] [PATCH] datapath-windows: Add Windows thread atomic APIs for x64 binaries.

Sorin Vinturis svinturis at cloudbasesolutions.com
Mon Mar 28 21:11:24 UTC 2016


Hi Guru,

I have verified the ovs-atomic-msvc.h header and all the defined macros and functions have 32-bit and 64-bit correspondent. All 64-bit macros use InterlockedXXX functions that are atomic: InterlockedExchangeNoFence64, InterlockedExchange64, InterlockedCompareExchange64, _InterlockedExchangeAdd64, InterlockedAnd64, InterlockedOr64, InterlockedXor64. I have ran test-atomic.c unit tests, on both 32-bit and 64-bit platforms, and all the tests are verified.

I also tested the 64-bit build on Hyper-V and it is stable.

Is there a reason why we should not use ovs-atomic-msvc APIs for 64-bit builds?

Thanks,
Sorin

From: Guru Shetty [mailto:guru at ovn.org]
Sent: Friday, 25 March, 2016 19:58
To: Sorin Vinturis
Cc: dev at openvswitch.org
Subject: Re: [ovs-dev] [PATCH] datapath-windows: Add Windows thread atomic APIs for x64 binaries.



On 25 March 2016 at 10:41, Sorin Vinturis <svinturis at cloudbasesolutions.com<mailto:svinturis at cloudbasesolutions.com>> wrote:
This patch modifies atomic operations library export header to
include Windows thread atomic APIs, ovs-atomic-msvc.h instead of
ovs-atomic-pthreads.h, for both x86 and x64 binaries.

Signed-off-by: Sorin Vinturis <svinturis at cloudbasesolutions.com<mailto:svinturis at cloudbasesolutions.com>>

Have you gone through the ovs-atomic-msvc.h intrinsics carefully to make sure that it will actually be atomic on 64 bit?

---
 lib/ovs-atomic.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/ovs-atomic.h b/lib/ovs-atomic.h
index b38c9ef..b385b9c 100644
--- a/lib/ovs-atomic.h
+++ b/lib/ovs-atomic.h
@@ -333,7 +333,7 @@
         #include "ovs-atomic-i586.h"
     #elif HAVE_GCC4_ATOMICS
         #include "ovs-atomic-gcc4+.h"
-    #elif _MSC_VER && _M_IX86 >= 500
+    #elif _WIN32
         #include "ovs-atomic-msvc.h"
     #else
         /* ovs-atomic-pthreads implementation is provided for portability.
--
1.9.0.msysgit.0
_______________________________________________
dev mailing list
dev at openvswitch.org<mailto:dev at openvswitch.org>
http://openvswitch.org/mailman/listinfo/dev



More information about the dev mailing list