From patchwork Wed Sep 16 20:32:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zoltan Kiss X-Patchwork-Id: 518550 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (li376-54.members.linode.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id DC784140D9C for ; Thu, 17 Sep 2015 06:32:42 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 8232410B64; Wed, 16 Sep 2015 13:32:41 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx1e3.cudamail.com (mx1.cudamail.com [69.90.118.67]) by archives.nicira.com (Postfix) with ESMTPS id 597BE10B61 for ; Wed, 16 Sep 2015 13:32:39 -0700 (PDT) Received: from bar2.cudamail.com (localhost [127.0.0.1]) by mx1e3.cudamail.com (Postfix) with ESMTPS id D92E742048F for ; Wed, 16 Sep 2015 14:32:37 -0600 (MDT) X-ASG-Debug-ID: 1442435556-03dc537fe013a220001-byXFYA Received: from mx1-pf2.cudamail.com ([192.168.24.2]) by bar2.cudamail.com with ESMTP id za8K2ciKZMDN9pJD (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 16 Sep 2015 14:32:36 -0600 (MDT) X-Barracuda-Envelope-From: zoltan.kiss@linaro.org X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.2 Received: from unknown (HELO mail-wi0-f175.google.com) (209.85.212.175) by mx1-pf2.cudamail.com with ESMTPS (RC4-SHA encrypted); 16 Sep 2015 20:32:36 -0000 Received-SPF: pass (mx1-pf2.cudamail.com: SPF record at _netblocks.google.com designates 209.85.212.175 as permitted sender) X-Barracuda-Apparent-Source-IP: 209.85.212.175 X-Barracuda-RBL-IP: 209.85.212.175 Received: by wicgb1 with SMTP id gb1so90613064wic.1 for ; Wed, 16 Sep 2015 13:32:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=cQAMrIiS+fTAeQJN7J85I5IKvAakOuUYvQ5aW50TG60=; b=lw0IFEVxculD1nOP+TppxIAdY1bXwRW2sVaCgjUYrDKRTCMzYY0KrNDdNe4k/OD7vP i7v7b8UmmOXE1GNUp1JtPtOZ1oKpL04n2jadKOiIwouRxzCxauS5UziS1fjDk8H/dfzV C7bGaXar/DIxeHmG44eRziLD260rLGacX5OUUk95gtQdU4deJC2LL51Y6TUYF3a6kCOA JZCdL6E28+ZvxIxU7RykguVnRqaFDISi0lhQeSsqoI5f8cQBLyiI9s3YV5PgmrtNWHHG STOGeOPo6cdl1CbFhPbiKUsiBMRSnaHTPc5lCw6CZcKZH+xCWZc0Xs4nViIAo318v3df 424Q== X-Gm-Message-State: ALoCoQmTqaYCPVZaWndnpZROcW8QF+O90D+q+DC1gJw5GncZmZcN7jph6qyzB3mjtaAQyBgmWlWU X-Received: by 10.194.19.169 with SMTP id g9mr53788483wje.64.1442435554478; Wed, 16 Sep 2015 13:32:34 -0700 (PDT) Received: from localhost.localdomain ([90.152.119.35]) by smtp.googlemail.com with ESMTPSA id lu5sm28351737wjb.9.2015.09.16.13.32.33 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 16 Sep 2015 13:32:33 -0700 (PDT) X-CudaMail-Envelope-Sender: zoltan.kiss@linaro.org From: Zoltan Kiss To: dev@openvswitch.org X-CudaMail-MID: CM-E2-915087865 X-CudaMail-DTE: 091615 X-CudaMail-Originating-IP: 209.85.212.175 Date: Wed, 16 Sep 2015 21:32:17 +0100 X-ASG-Orig-Subj: [##CM-E2-915087865##][PATCH RFC] ofproto-dpif-upcall: do not pause on uninitialized pause barriers Message-Id: <1442435537-18772-1-git-send-email-zoltan.kiss@linaro.org> X-Mailer: git-send-email 1.9.1 X-GBUdb-Analysis: 0, 209.85.212.175, Ugly c=0.483445 p=-0.504587 Source Normal X-MessageSniffer-Rules: 0-0-0-7569-c X-Barracuda-Connect: UNKNOWN[192.168.24.2] X-Barracuda-Start-Time: 1442435556 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.60 X-Barracuda-Spam-Status: No, SCORE=0.60 using per-user scores of TAG_LEVEL=3.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=3.0 tests=BSF_SC5_MJ1963, RDNS_NONE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.22609 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS 0.50 BSF_SC5_MJ1963 Custom Rule MJ1963 Cc: Ilya Maximets Subject: [ovs-dev] [PATCH RFC] ofproto-dpif-upcall: do not pause on uninitialized pause barriers X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" 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=, dp=) 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=, n_rxqs=1, cmask=0x946250 "2") at lib/dpif-netdev.c:2385 #7 0x000000000047873a in dpif_poll_threads_set (dpif=0x95ed10, n_rxqs=, cmask=) at lib/dpif.c:1411 #8 0x000000000043897f in type_run (type=) at ofproto/ofproto-dpif.c:558 #9 0x000000000042b195 in ofproto_type_run (datapath_type=, 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 I'm not sure that checking for this initialization is the right thing here, but at least OVS starts up. Signed-off-by: Zoltan Kiss diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c index 8a43bbf..4b6fac4 100644 --- a/ofproto/ofproto-dpif-upcall.c +++ b/ofproto/ofproto-dpif-upcall.c @@ -523,7 +523,8 @@ static void udpif_pause_revalidators(struct udpif *udpif) { latch_set(&udpif->pause_latch); - ovs_barrier_block(&udpif->pause_barrier); + if (udpif->pause_barrier.seq) + ovs_barrier_block(&udpif->pause_barrier); } /* Resumes the pausing of revalidators. Should only be called by the @@ -532,7 +533,8 @@ static void udpif_resume_revalidators(struct udpif *udpif) { latch_poll(&udpif->pause_latch); - ovs_barrier_block(&udpif->pause_barrier); + if (udpif->pause_barrier.seq) + ovs_barrier_block(&udpif->pause_barrier); } /* Tells 'udpif' how many threads it should use to handle upcalls.