From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 446D15F1A for ; Tue, 5 Feb 2019 13:57:26 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E2E2DC01DDE2; Tue, 5 Feb 2019 12:57:24 +0000 (UTC) Received: from ktraynor.remote.csb (unknown [10.33.36.135]) by smtp.corp.redhat.com (Postfix) with ESMTP id 66CFF379E; Tue, 5 Feb 2019 12:57:18 +0000 (UTC) To: hfli@netitest.com, 'Stephen Hemminger' , anatoly.burakov@intel.com, olivier.matz@6wind.com, artem.andreev@oktetlabs.ru Cc: 'dpdk stable' , qhyuan@netitest.com References: <003901d4ba18$ee13bf40$ca3b3dc0$@netitest.com> From: Kevin Traynor Organization: Red Hat Message-ID: <9b1fb323-db1b-0b88-483f-f7879a0df80f@redhat.com> Date: Tue, 5 Feb 2019 12:57:18 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <003901d4ba18$ee13bf40$ca3b3dc0$@netitest.com> Content-Type: text/plain; charset=gbk Content-Language: en-US Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 05 Feb 2019 12:57:25 +0000 (UTC) Subject: Re: [dpdk-stable] =?utf-8?b?562U5aSNOiBwYXRjaCAnbmV0L3RhcDogbGV0IGtl?= =?utf-8?q?rnel_choose_tun_device_name=27_has_been_queued_to_LTS_release_1?= =?utf-8?b?OC4xMS4x?= X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2019 12:57:26 -0000 On 02/01/2019 10:28 AM, hfli@netitest.com wrote: > Hi Guys, > > > > We have gotten a weird problem after we upgrade DPDK version from 18.05.1 to > 18.11, we need call a expect script in C code by system() which execute some > commands on our network devices. > Hi - I'm not sure if the reports are related to this patch which is currently not in 18.11. Is there an issue with backporting this patch to 18.11 stable branch? thanks, Kevin. > > > But it will be crashed after call function rte_eal_memory_init(), I have > enclosed the expect script and crash output in attachment. Can anyone dig > into this? > > > > spawn telnet 192.168.16.230 > > *** buffer overflow detected ***: /usr/bin/expect terminated > > ======= Backtrace: ========= > > /lib64/libc.so.6(__fortify_fail+0x37)[0x7f033f6759e7] > > /lib64/libc.so.6(+0x115b62)[0x7f033f673b62] > > /lib64/libc.so.6(+0x117947)[0x7f033f675947] > > /lib64/libtcl8.5.so(+0xe37d8)[0x7f033ff147d8] > > /lib64/libpthread.so.0(+0x7dd5)[0x7f033f146dd5] > > /lib64/libc.so.6(clone+0x6d)[0x7f033f65bead] > > > > > > > > > > Thanks and Regards, > > Haifeng > > > > -----邮件原件----- > > 发件人: Kevin Traynor > > 发送时间: 2019年1月31日 23:49 > > 收件人: Stephen Hemminger > > 抄送: Haifeng Li ; dpdk stable > > 主题: patch 'net/tap: let kernel choose tun device name' has been queued to > LTS release 18.11.1 > > > > Hi, > > > > FYI, your patch has been queued to LTS release 18.11.1 > > > > Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. > > It will be pushed if I get no objections before 02/07/19. So please shout if > anyone has objections. > > > > Also note that after the patch there's a diff of the upstream commit vs the > patch applied to the branch. This will indicate if there was any rebasing > needed to apply to the stable branch. If there were code changes for > rebasing > > (ie: not only metadata diffs), please double check that the rebase was > correctly done. > > > > Thanks. > > > > Kevin Traynor > > > > --- > > From d3034e04e58ca7bed78182fa9a1439afe4a73d4b Mon Sep 17 00:00:00 2001 > > From: Stephen Hemminger > > Date: Fri, 11 Jan 2019 12:35:18 -0800 > > Subject: [PATCH] net/tap: let kernel choose tun device name > > > > [ upstream commit b5235d61f3b7d2b1c2b9ee2601f3aca2b151b508 ] > > > > Assigning tun and tap index in DPDK tap device driver is racy and fails if > used with primary/secondary. Instead use the kernel feature of device > wildcarding where if a name with %d is used the kernel will fill in the next > available device. > > > > Fixes: 02f96a0a82d1 ("net/tap: add TUN/TAP device PMD") > > > > Reported-by: Haifeng Li > > Signed-off-by: Stephen Hemminger Acked-by Keith > Wiles > > --- > > drivers/net/tap/rte_eth_tap.c | 33 +++++++++++++++++---------------- > > 1 file changed, 17 insertions(+), 16 deletions(-) > > > > diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c > index aef8b0b9f..a93429973 100644 > > --- a/drivers/net/tap/rte_eth_tap.c > > +++ b/drivers/net/tap/rte_eth_tap.c > > @@ -79,7 +79,4 @@ static const char *valid_arguments[] = { }; > > -static unsigned int tap_unit; > > -static unsigned int tun_unit; > > - > > static char tuntap_name[8]; > > @@ -151,6 +148,4 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive) > > snprintf(ifr.ifr_name, IFNAMSIZ, "%s", pmd->name); > > - TAP_LOG(DEBUG, "ifr_name '%s'", ifr.ifr_name); > > - > > fd = open(TUN_TAP_DEV_PATH, O_RDWR); > > if (fd < 0) { > > @@ -186,4 +181,11 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive) > > } > > + /* > > + * Name passed to kernel might be wildcard like dtun%d > > + * and need to find the resulting device. > > + */ > > + TAP_LOG(DEBUG, "Device name is '%s'", ifr.ifr_name); > > + strlcpy(pmd->name, ifr.ifr_name, RTE_ETH_NAME_MAX_LEN); > > + > > if (is_keepalive) { > > /* > > @@ -1756,4 +1758,5 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, char > *tap_name, > > goto error_exit; > > } > > + TAP_LOG(DEBUG, "allocated %s", pmd->name); > > ifr.ifr_mtu = dev->data->mtu; > > @@ -1895,6 +1898,6 @@ set_interface_name(const char *key __rte_unused, > > strlcpy(name, value, RTE_ETH_NAME_MAX_LEN); > > else > > - snprintf(name, RTE_ETH_NAME_MAX_LEN, "%s%d", > > - DEFAULT_TAP_NAME, tap_unit - 1); > > + /* use tap%d which causes kernel to choose next available > */ > > + strlcpy(name, DEFAULT_TAP_NAME "%d", RTE_ETH_NAME_MAX_LEN); > > return 0; > > @@ -2003,6 +2006,6 @@ rte_pmd_tun_probe(struct rte_vdev_device *dev) > > } > > - snprintf(tun_name, sizeof(tun_name), "%s%u", > > - DEFAULT_TUN_NAME, tun_unit++); > > + /* use tun%d which causes kernel to choose next available */ > > + strlcpy(tun_name, DEFAULT_TUN_NAME "%d", RTE_ETH_NAME_MAX_LEN); > > if (params && (params[0] != '\0')) { > > @@ -2024,9 +2027,8 @@ rte_pmd_tun_probe(struct rte_vdev_device *dev) > > pmd_link.link_speed = ETH_SPEED_NUM_10G; > > - TAP_LOG(NOTICE, "Initializing pmd_tun for %s as %s", > > - name, tun_name); > > + TAP_LOG(NOTICE, "Initializing pmd_tun for %s", name); > > ret = eth_dev_tap_create(dev, tun_name, remote_iface, 0, > > - ETH_TUNTAP_TYPE_TUN); > > + ETH_TUNTAP_TYPE_TUN); > > leave: > > @@ -2034,5 +2036,4 @@ leave: > > TAP_LOG(ERR, "Failed to create pmd for %s as %s", > > name, tun_name); > > - tun_unit--; /* Restore the unit number */ > > } > > rte_kvargs_free(kvlist); > > @@ -2190,6 +2191,7 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev) > > speed = ETH_SPEED_NUM_10G; > > - snprintf(tap_name, sizeof(tap_name), "%s%u", > > - DEFAULT_TAP_NAME, tap_unit++); > > + > > + /* use tap%d which causes kernel to choose next available */ > > + strlcpy(tap_name, DEFAULT_TAP_NAME "%d", RTE_ETH_NAME_MAX_LEN); > > memset(remote_iface, 0, RTE_ETH_NAME_MAX_LEN); > > @@ -2255,5 +2257,4 @@ leave: > > tap_devices_count--; > > } > > - tap_unit--; /* Restore the unit number */ > > } > > rte_kvargs_free(kvlist); > > -- > > 2.19.0 > > > > --- > > Diff of the applied patch vs upstream commit (please double-check if > non-empty: > > --- > > --- - 2019-01-31 15:44:06.948575581 +0000 > > +++ 0052-net-tap-let-kernel-choose-tun-device-name.patch 2019-01-31 > 15:44:05.000000000 +0000 > > @@ -1,15 +1,16 @@ > > -From b5235d61f3b7d2b1c2b9ee2601f3aca2b151b508 Mon Sep 17 00:00:00 2001 > > +From d3034e04e58ca7bed78182fa9a1439afe4a73d4b Mon Sep 17 00:00:00 2001 > > From: Stephen Hemminger > > Date: Fri, 11 Jan 2019 12:35:18 -0800 > > Subject: [PATCH] net/tap: let kernel choose tun device name > > +[ upstream commit b5235d61f3b7d2b1c2b9ee2601f3aca2b151b508 ] > > + > > Assigning tun and tap index in DPDK tap device driver is racy and fails if > used with primary/secondary. Instead use the kernel feature of device > wildcarding where if a name with %d is used the kernel will fill in the > next available device. > > Fixes: 02f96a0a82d1 ("net/tap: add TUN/TAP device PMD") > > -Cc: stable@dpdk.org > > Reported-by: Haifeng Li > > Signed-off-by: Stephen Hemminger @@ -19,10 +20, > 10 @@ > > 1 file changed, 17 insertions(+), 16 deletions(-) > > diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c > -index d699b4fb0..ed8483cb9 100644 > > +index aef8b0b9f..a93429973 100644 > > --- a/drivers/net/tap/rte_eth_tap.c > > +++ b/drivers/net/tap/rte_eth_tap.c > > -@@ -80,7 +80,4 @@ static const char *valid_arguments[] = { > > +@@ -79,7 +79,4 @@ static const char *valid_arguments[] = { > > }; > > > > -static unsigned int tap_unit; > > @@ -30,14 +31,14 @@ > > - > > static char tuntap_name[8]; > > > > -@@ -152,6 +149,4 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive) > > - strlcpy(ifr.ifr_name, pmd->name, IFNAMSIZ); > > +@@ -151,6 +148,4 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive) > > + snprintf(ifr.ifr_name, IFNAMSIZ, "%s", pmd->name); > > > > - TAP_LOG(DEBUG, "ifr_name '%s'", ifr.ifr_name); > > - > > fd = open(TUN_TAP_DEV_PATH, O_RDWR); > > if (fd < 0) { > > -@@ -187,4 +182,11 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive) > > +@@ -186,4 +181,11 @@ tun_alloc(struct pmd_internals *pmd, int > > +is_keepalive) > > } > > > > + /* > > @@ -49,22 +50,22 @@ > > + > > if (is_keepalive) { > > /* > > -@@ -1757,4 +1759,5 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, char > *tap_name, > > +@@ -1756,4 +1758,5 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, > > +char *tap_name, > > goto error_exit; > > } > > + TAP_LOG(DEBUG, "allocated %s", pmd->name); > > > > ifr.ifr_mtu = dev->data->mtu; > > -@@ -1919,6 +1922,6 @@ set_interface_name(const char *key __rte_unused, > > +@@ -1895,6 +1898,6 @@ set_interface_name(const char *key __rte_unused, > > strlcpy(name, value, RTE_ETH_NAME_MAX_LEN); > > - } else { > > + else > > - snprintf(name, RTE_ETH_NAME_MAX_LEN, "%s%d", > > - DEFAULT_TAP_NAME, tap_unit - 1); > > + /* use tap%d which causes kernel to choose next available */ > > + strlcpy(name, DEFAULT_TAP_NAME "%d", RTE_ETH_NAME_MAX_LEN); > > - } > > + > > return 0; > > -@@ -2033,6 +2036,6 @@ rte_pmd_tun_probe(struct rte_vdev_device *dev) > > +@@ -2003,6 +2006,6 @@ rte_pmd_tun_probe(struct rte_vdev_device *dev) > > } > > > > - snprintf(tun_name, sizeof(tun_name), "%s%u", > > @@ -73,25 +74,25 @@ > > + strlcpy(tun_name, DEFAULT_TUN_NAME "%d", RTE_ETH_NAME_MAX_LEN); > > > > if (params && (params[0] != '\0')) { > > -@@ -2054,9 +2057,8 @@ rte_pmd_tun_probe(struct rte_vdev_device *dev) > > +@@ -2024,9 +2027,8 @@ rte_pmd_tun_probe(struct rte_vdev_device *dev) > > pmd_link.link_speed = ETH_SPEED_NUM_10G; > > > > -- TAP_LOG(DEBUG, "Initializing pmd_tun for %s as %s", > > +- TAP_LOG(NOTICE, "Initializing pmd_tun for %s as %s", > > - name, tun_name); > > -+ TAP_LOG(DEBUG, "Initializing pmd_tun for %s", name); > > ++ TAP_LOG(NOTICE, "Initializing pmd_tun for %s", name); > > > > ret = eth_dev_tap_create(dev, tun_name, remote_iface, 0, > > - ETH_TUNTAP_TYPE_TUN); > > + ETH_TUNTAP_TYPE_TUN); > > > > leave: > > -@@ -2064,5 +2066,4 @@ leave: > > +@@ -2034,5 +2036,4 @@ leave: > > TAP_LOG(ERR, "Failed to create pmd for %s as %s", > > name, tun_name); > > - tun_unit--; /* Restore the unit number */ > > } > > rte_kvargs_free(kvlist); > > -@@ -2220,6 +2221,7 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev) > > +@@ -2190,6 +2191,7 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev) > > > > speed = ETH_SPEED_NUM_10G; > > - snprintf(tap_name, sizeof(tap_name), "%s%u", > > @@ -101,7 +102,7 @@ > > + strlcpy(tap_name, DEFAULT_TAP_NAME "%d", RTE_ETH_NAME_MAX_LEN); > > memset(remote_iface, 0, RTE_ETH_NAME_MAX_LEN); > > > > -@@ -2284,5 +2286,4 @@ leave: > > +@@ -2255,5 +2257,4 @@ leave: > > tap_devices_count--; > > } > > - tap_unit--; /* Restore the unit number */ > >