From 78d9bbb45efc7227b2efd4a94394ee574742c1ca Mon Sep 17 00:00:00 2001 From: Alex Wang Date: Mon, 29 Dec 2014 15:56:23 -0800 Subject: [PATCH] ofproto-dpif-upcall: Make handler always call poll_block. 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 Acked-by: Ben Pfaff --- ofproto/ofproto-dpif-upcall.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c index 8577b0e79..193e6b711 100644 --- a/ofproto/ofproto-dpif-upcall.c +++ b/ofproto/ofproto-dpif-upcall.c @@ -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); -- 2.20.1