ofproto-dpif-upcall: Make handler always call poll_block.
authorAlex Wang <alexw@nicira.com>
Mon, 29 Dec 2014 23:56:23 +0000 (15:56 -0800)
committerAlex Wang <alexw@nicira.com>
Tue, 6 Jan 2015 18:49:18 +0000 (10:49 -0800)
This commit makes handler threads always call poll_block() at
the end of each handling cycle.  If there are upcalls received
in the current cycle, the handler will register to wake up
immediately.  Otherwise, it will wait on both the netlink
socket and the exit latch.

Calling poll_block() at every handling cycle makes sure that
coverage counter stats are always timely attributed, and that
the execution of ovsrcu-postponed events is not held by any
busy handler thread.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
ofproto/ofproto-dpif-upcall.c

index 8577b0e..193e6b7 100644 (file)
@@ -526,8 +526,9 @@ udpif_upcall_handler(void *arg)
         if (!n_upcalls) {
             dpif_recv_wait(udpif->dpif, handler->handler_id);
             latch_wait(&udpif->exit_latch);
-            poll_block();
         } else {
+            poll_immediate_wake();
+
             handle_upcalls(handler, &misses, upcalls, n_upcalls);
 
             HMAP_FOR_EACH (miss, hmap_node, &misses) {
@@ -539,7 +540,7 @@ udpif_upcall_handler(void *arg)
                 ofpbuf_uninit(&upcalls[i].upcall_buf);
             }
         }
-        coverage_clear();
+        poll_block();
     }
     hmap_destroy(&misses);