Otherwise ovsrcu_synchronize() busy-waits in its loop because its
poll_block() un-quiesces, causing the global_seqno to increase, which is
what it waits for.
Reported-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
ovsrcu_quiesced();
}
+bool
+ovsrcu_is_quiescent(void)
+{
+ ovsrcu_init();
+ return pthread_getspecific(perthread_key) == NULL;
+}
+
static void
ovsrcu_synchronize(void)
{
void ovsrcu_quiesce_start(void);
void ovsrcu_quiesce_end(void);
void ovsrcu_quiesce(void);
+bool ovsrcu_is_quiescent(void);
#endif /* ovs-rcu.h */
{
long long int *last_wakeup = last_wakeup_get();
long long int start;
+ bool quiescent;
int retval = 0;
time_init();
start = time_msec();
timeout_when = MIN(timeout_when, deadline);
+ quiescent = ovsrcu_is_quiescent();
for (;;) {
long long int now = time_msec();
time_left = timeout_when - now;
}
- if (!time_left) {
- ovsrcu_quiesce();
- } else {
- ovsrcu_quiesce_start();
+ if (!quiescent) {
+ if (!time_left) {
+ ovsrcu_quiesce();
+ } else {
+ ovsrcu_quiesce_start();
+ }
}
#ifndef _WIN32
}
#endif
- if (time_left) {
+ if (!quiescent && time_left) {
ovsrcu_quiesce_end();
}