Message ID | 1442487269-5984-1-git-send-email-zoltan.kiss@linaro.org |
---|---|
State | Not Applicable |
Headers | show |
On 17 September 2015 at 03:54, Zoltan Kiss <zoltan.kiss@linaro.org> wrote: > e4e74c3a "dpif-netdev: Purge all ukeys when reconfigure pmd." introduced a new > dp_purge_cb function, which calls udpif_pause_revalidators() and that tries to > block on pause_barrier. > But if OVS was started with flow-restore-wait="true" (e.g. through ovs-ctl), > type_run() will have backer->recv_set_enable == false, and udpif_set_threads > won't initialize the barrier, which leads to a segfault like this: > > #0 seq_read (seq=0x0) at lib/seq.c:121 > #1 0x00000000004f33a2 in ovs_barrier_block (barrier=barrier@entry=0x9304a0) at lib/ovs-thread.c:291 > #2 0x0000000000445a01 in udpif_pause_revalidators (udpif=0x930410) at ofproto/ofproto-dpif-upcall.c:526 > #3 dp_purge_cb (aux=0x930410, pmd_id=4294967295) at ofproto/ofproto-dpif-upcall.c:2271 > #4 0x0000000000471552 in dp_netdev_del_pmd (pmd=pmd@entry=0x961f10, dp=<optimised out>, dp=<optimised out>) at lib/dpif-netdev.c:2891 > #5 0x00000000004716d9 in dp_netdev_destroy_all_pmds (dp=0x948550) at lib/dpif-netdev.c:2904 > #6 dpif_netdev_pmd_set (dpif=<optimised out>, n_rxqs=1, cmask=0x946250 "2") at lib/dpif-netdev.c:2385 > #7 0x000000000047873a in dpif_poll_threads_set (dpif=0x95ed10, n_rxqs=<optimised out>, cmask=<optimised out>) at lib/dpif.c:1411 > #8 0x000000000043897f in type_run (type=<optimised out>) at ofproto/ofproto-dpif.c:558 > #9 0x000000000042b195 in ofproto_type_run (datapath_type=<optimised out>, datapath_type@entry=0xcf23e0 "netdev") at ofproto/ofproto.c:1655 > #10 0x000000000040f395 in bridge_run__ () at vswitchd/bridge.c:2875 > #11 0x00000000004155b3 in bridge_reconfigure (ovs_cfg=ovs_cfg@entry=0x961db0) at vswitchd/bridge.c:700 > #12 0x0000000000418439 in bridge_run () at vswitchd/bridge.c:2984 > #13 0x000000000040d025 in main (argc=11, argv=0x7fffffffe9a8) at vswitchd/ovs-vswitchd.c:120 > > This patch introduces ofproto_dpif_backer_enabled(), which checks > recv_set_enable before touching the latch and blocking on pause_barrier. > > It removes a stale control character in ofproto/ofproto.c as well. > > Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org> Do you mind rebasing this patch? I'm getting errors when I try to apply it (error below). Also, I believe that the control characters are used by some developers to separate sections of the files, so please leave them in place. https://patchwork.ozlabs.org/patch/518802/ $ pwclient git-am 518802 Applying patch #518802 using 'git am' Description: [ovs-dev,v2] ofproto-dpif: do not block on uninitialized pause barriers Applying: ofproto-dpif: do not block on uninitialized pause barriers error: patch failed: ofproto/ofproto-dpif.h:172 error: ofproto/ofproto-dpif.h: patch does not apply error: patch failed: ofproto/ofproto.c:880 error: ofproto/ofproto.c: patch does not apply Patch failed at 0001 ofproto-dpif: do not block on uninitialized pause barriers (Same issue if I manually download the mbox-formatted patch and attempt to apply) Thanks, Joe
On 18/09/15 13:46, Joe Stringer wrote: > Do you mind rebasing this patch? I'm getting errors when I try to > apply it (error below). Ok, I've resent it based on latest master > > Also, I believe that the control characters are used by some > developers to separate sections of the files, so please leave them in > place. Ok, I removed the part which touched it
diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c index 8a43bbf..3b897e0 100644 --- a/ofproto/ofproto-dpif-upcall.c +++ b/ofproto/ofproto-dpif-upcall.c @@ -522,8 +522,10 @@ udpif_start_threads(struct udpif *udpif, size_t n_handlers, static void udpif_pause_revalidators(struct udpif *udpif) { - latch_set(&udpif->pause_latch); - ovs_barrier_block(&udpif->pause_barrier); + if (ofproto_dpif_backer_enabled(udpif->backer)) { + latch_set(&udpif->pause_latch); + ovs_barrier_block(&udpif->pause_barrier); + } } /* Resumes the pausing of revalidators. Should only be called by the @@ -531,8 +533,10 @@ udpif_pause_revalidators(struct udpif *udpif) static void udpif_resume_revalidators(struct udpif *udpif) { - latch_poll(&udpif->pause_latch); - ovs_barrier_block(&udpif->pause_barrier); + if (ofproto_dpif_backer_enabled(udpif->backer)) { + latch_poll(&udpif->pause_latch); + ovs_barrier_block(&udpif->pause_barrier); + } } /* Tells 'udpif' how many threads it should use to handle upcalls. diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 1279907..e2ed149 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -515,6 +515,12 @@ lookup_ofproto_dpif_by_port_name(const char *name) return NULL; } +bool +ofproto_dpif_backer_enabled(struct dpif_backer* backer) +{ + return backer->recv_set_enable; +} + static int type_run(const char *type) { diff --git a/ofproto/ofproto-dpif.h b/ofproto/ofproto-dpif.h index 69ca54c..81449cc 100644 --- a/ofproto/ofproto-dpif.h +++ b/ofproto/ofproto-dpif.h @@ -172,7 +172,8 @@ int ofproto_dpif_add_internal_flow(struct ofproto_dpif *, struct rule **rulep); int ofproto_dpif_delete_internal_flow(struct ofproto_dpif *, struct match *, int priority); -^L +bool ofproto_dpif_backer_enabled(struct dpif_backer* backer); + /* struct rule_dpif has struct rule as it's first member. */ #define RULE_CAST(RULE) ((struct rule *)RULE) #define GROUP_CAST(GROUP) ((struct ofgroup *)GROUP) diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index c7dd8a2..642ae06 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -880,7 +880,6 @@ ofproto_get_flow_restore_wait(void) return flow_restore_wait; } -^L /* Spanning Tree Protocol (STP) configuration. */ /* Configures STP on 'ofproto' using the settings defined in 's'. If
e4e74c3a "dpif-netdev: Purge all ukeys when reconfigure pmd." introduced a new dp_purge_cb function, which calls udpif_pause_revalidators() and that tries to block on pause_barrier. But if OVS was started with flow-restore-wait="true" (e.g. through ovs-ctl), type_run() will have backer->recv_set_enable == false, and udpif_set_threads won't initialize the barrier, which leads to a segfault like this: #0 seq_read (seq=0x0) at lib/seq.c:121 #1 0x00000000004f33a2 in ovs_barrier_block (barrier=barrier@entry=0x9304a0) at lib/ovs-thread.c:291 #2 0x0000000000445a01 in udpif_pause_revalidators (udpif=0x930410) at ofproto/ofproto-dpif-upcall.c:526 #3 dp_purge_cb (aux=0x930410, pmd_id=4294967295) at ofproto/ofproto-dpif-upcall.c:2271 #4 0x0000000000471552 in dp_netdev_del_pmd (pmd=pmd@entry=0x961f10, dp=<optimised out>, dp=<optimised out>) at lib/dpif-netdev.c:2891 #5 0x00000000004716d9 in dp_netdev_destroy_all_pmds (dp=0x948550) at lib/dpif-netdev.c:2904 #6 dpif_netdev_pmd_set (dpif=<optimised out>, n_rxqs=1, cmask=0x946250 "2") at lib/dpif-netdev.c:2385 #7 0x000000000047873a in dpif_poll_threads_set (dpif=0x95ed10, n_rxqs=<optimised out>, cmask=<optimised out>) at lib/dpif.c:1411 #8 0x000000000043897f in type_run (type=<optimised out>) at ofproto/ofproto-dpif.c:558 #9 0x000000000042b195 in ofproto_type_run (datapath_type=<optimised out>, datapath_type@entry=0xcf23e0 "netdev") at ofproto/ofproto.c:1655 #10 0x000000000040f395 in bridge_run__ () at vswitchd/bridge.c:2875 #11 0x00000000004155b3 in bridge_reconfigure (ovs_cfg=ovs_cfg@entry=0x961db0) at vswitchd/bridge.c:700 #12 0x0000000000418439 in bridge_run () at vswitchd/bridge.c:2984 #13 0x000000000040d025 in main (argc=11, argv=0x7fffffffe9a8) at vswitchd/ovs-vswitchd.c:120 This patch introduces ofproto_dpif_backer_enabled(), which checks recv_set_enable before touching the latch and blocking on pause_barrier. It removes a stale control character in ofproto/ofproto.c as well. Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org> --- v2: - ofproto_dpif_backer_enabled() to check recv_set_enable - do not touch the latch -