@@ -120,7 +120,12 @@ static __thread struct clh_node thread_clh_node;
120120/* additional parameter to enable WFE(default) or disable WFE */
121121static void clh_parse_args (test_args unused , int argc , char * * argv ) {
122122 int i = 0 ;
123+ #if defined(__aarch64__ )
123124 without_wfe = false;
125+ #else
126+ /* only aarch64 supports WFE */
127+ without_wfe = true;
128+ #endif
124129
125130 /* extended options retrieved after '--' operator */
126131 while ((i = getopt (argc , argv , "w" )) != -1 )
@@ -134,7 +139,7 @@ static void clh_parse_args(test_args unused, int argc, char** argv) {
134139 fprintf (stderr ,
135140 "clh_spinlock additional options after --:\n"
136141 "\t[-h print this msg]\n"
137- "\t[-w without_wfe, default is false]\n" );
142+ "\t[-w without_wfe, aarch64 default is false, non-aarch64 default is true ]\n" );
138143 exit (2 );
139144 }
140145 }
@@ -147,7 +152,8 @@ static inline void clh_lock_init(uint64_t *u64_lock, unsigned long num_cores)
147152 global_clh_lock .node .wait = 0 ;
148153 global_clh_lock .tail = & global_clh_lock .node ;
149154 /* save clh_lock pointer to global u64int_t */
150- * u64_lock = (uint64_t )& global_clh_lock ;
155+ * u64_lock = (uint64_t )& global_clh_lock ; // unused
156+
151157#ifdef DDEBUG
152158 printf ("global_clh_lock: %llx\n" , (long long unsigned int ) & global_clh_lock );
153159#endif
@@ -198,7 +204,6 @@ static inline void clh_lock(struct clh_lock *lock, struct clh_node *node, bool u
198204/* return the previous node as reused node for the next clh_lock() */
199205static inline struct clh_node * clh_unlock (struct clh_node * node )
200206{
201- struct clh_node * prev = node -> prev ;
202207 /* CLH spinlock: release current node by resetting wait status */
203208#ifdef USE_DMB
204209 __atomic_thread_fence (__ATOMIC_RELEASE );
@@ -209,7 +214,7 @@ static inline struct clh_node* clh_unlock(struct clh_node *node)
209214#ifdef DDEBUG
210215 printf ("unlock/node/wait: %llx:%lu\n" , (long long unsigned int )node , node -> wait );
211216#endif
212- return prev ;
217+ return node -> prev ;
213218}
214219
215220/* standard lockhammer lock_acquire and lock_release interfaces */
0 commit comments