From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by dpdk.org (Postfix) with ESMTP id 6C21E1B207 for ; Wed, 6 Feb 2019 18:45:48 +0100 (CET) Received: by mail-pf1-f195.google.com with SMTP id c123so3420510pfb.0 for ; Wed, 06 Feb 2019 09:45:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Y4QzAVY+IjixgdwdooF2s2bLM5noPYk7nuVrz6/Uzks=; b=GNt5LrtNvoQ3F5sPYDDsB1ijkB1iLaUCBZQunB9vfOWr659FqDwSIZm8x+bTxOLsoU nEVoU9Hwf2tyfQtQ0qCIjHVoA9e9vFhhg47xYzTE0wcbWbwSil9gxSv4hecNtCFXNrUm DXGpkKIti5Vq6lf8LaOhBbO3uPCWgIJ2Tc4g1J7F2NX1sz6Ojb6RJdmBpf+l1elg3Izm ukxA5RdDfnlJH6msgreY8iji5lyU5a19n7ae1zxxNmHthEJm6zY8L1vBh36qyYnpSorJ 81jkOnUPEaR1OAxBzinyKcUqSg1atxzrOWPl0XtFDNO9VPblzoPFXdVAm/zX6VZcDmFb v6TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Y4QzAVY+IjixgdwdooF2s2bLM5noPYk7nuVrz6/Uzks=; b=aktAmMA83oIA3khFQhHEa3QSW82WUPg6a9mmqWRe3s7Jae7VXdFv7OgPmRFmOJ/hPK rsFPA8Lv1sDdvbrl0G4nZxhgLD0D+AstfXTLH3gALPhux6H+lfy2ewk0teiJAg3XlYmP yweqFAOUyC4BTMcruEllePNJDTNOeTK+feo3rY3+yoSScc8SwUslSBp8xu1Nk965buh0 I18EvN1yNspSYTzMmdkzkG7G1trCE5J/B0FErf5iLrzGv8k55qms/799X8ls2Rp+Yzmz V+cRx4HOqRffy4tTW+hvULqn3uIDGoHaCX9LCrSnx9ysVW6g7jDTAgJVwybs90Am2mjY JO0w== X-Gm-Message-State: AHQUAubJnhYBhnKrrJ241Cvwtk0a50TdJvAXE5CgTEVSd2yGlxHtXi/L lGSiLehoda9kZ7pzhO+7MKTpvg== X-Google-Smtp-Source: AHgI3IYoVmD2dIl8qydNhcqiTjFwPe0NlPRD4a/r3LlqVQjPjgxdX9DhrY9anNQ2iH7uG85Fw+GdEQ== X-Received: by 2002:a65:6242:: with SMTP id q2mr10683106pgv.245.1549475147096; Wed, 06 Feb 2019 09:45:47 -0800 (PST) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id k1sm1557793pgq.45.2019.02.06.09.45.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Feb 2019 09:45:47 -0800 (PST) Date: Wed, 6 Feb 2019 09:45:39 -0800 From: Stephen Hemminger To: Cc: "'Kevin Traynor'" , , , , "'dpdk stable'" , Message-ID: <20190206094539.57208bba@hermes.lan> In-Reply-To: <003901d4ba18$ee13bf40$ca3b3dc0$@netitest.com> References: <003901d4ba18$ee13bf40$ca3b3dc0$@netitest.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-stable] patch 'net/tap: let kernel choose tun device name' has been queued to LTS release 18.11.1 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: Wed, 06 Feb 2019 17:45:48 -0000 On Fri, 1 Feb 2019 18:28:52 +0800 wrote: > Hi Guys, >=20 > =20 >=20 > 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 s= ome > commands on our network devices. >=20 > =20 >=20 > 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? >=20 > =20 >=20 > spawn telnet 192.168.16.230 >=20 > *** buffer overflow detected ***: /usr/bin/expect terminated >=20 > =3D=3D=3D=3D=3D=3D=3D Backtrace: =3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 > /lib64/libc.so.6(__fortify_fail+0x37)[0x7f033f6759e7] >=20 > /lib64/libc.so.6(+0x115b62)[0x7f033f673b62] >=20 > /lib64/libc.so.6(+0x117947)[0x7f033f675947] >=20 > /lib64/libtcl8.5.so(+0xe37d8)[0x7f033ff147d8] >=20 > /lib64/libpthread.so.0(+0x7dd5)[0x7f033f146dd5] >=20 > /lib64/libc.so.6(clone+0x6d)[0x7f033f65bead] >=20 > =20 >=20 >=20 >=20 > =20 >=20 > =20 >=20 > Thanks and Regards, >=20 > Haifeng >=20 > =20 >=20 > -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- >=20 > =E5=8F=91=E4=BB=B6=E4=BA=BA: Kevin Traynor =20 >=20 > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2019=E5=B9=B41=E6=9C=8831=E6=97=A5 = 23:49 >=20 > =E6=94=B6=E4=BB=B6=E4=BA=BA: Stephen Hemminger >=20 > =E6=8A=84=E9=80=81: Haifeng Li ; dpdk stable >=20 > =E4=B8=BB=E9=A2=98: patch 'net/tap: let kernel choose tun device name' ha= s been queued to > LTS release 18.11.1 >=20 > =20 >=20 > Hi, >=20 > =20 >=20 > FYI, your patch has been queued to LTS release 18.11.1 >=20 > =20 >=20 > Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. >=20 > It will be pushed if I get no objections before 02/07/19. So please shout= if > anyone has objections. >=20 > =20 >=20 > Also note that after the patch there's a diff of the upstream commit vs t= he > 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 >=20 > (ie: not only metadata diffs), please double check that the rebase was > correctly done. >=20 > =20 >=20 > Thanks. >=20 > =20 >=20 > Kevin Traynor >=20 > =20 >=20 > --- >=20 > From d3034e04e58ca7bed78182fa9a1439afe4a73d4b Mon Sep 17 00:00:00 2001 >=20 > From: Stephen Hemminger >=20 > Date: Fri, 11 Jan 2019 12:35:18 -0800 >=20 > Subject: [PATCH] net/tap: let kernel choose tun device name >=20 > =20 >=20 > [ upstream commit b5235d61f3b7d2b1c2b9ee2601f3aca2b151b508 ] >=20 > =20 >=20 > 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 n= ext > available device. >=20 > =20 >=20 > Fixes: 02f96a0a82d1 ("net/tap: add TUN/TAP device PMD") >=20 > =20 >=20 > Reported-by: Haifeng Li >=20 > Signed-off-by: Stephen Hemminger Acked-by Ke= ith > Wiles >=20 > --- >=20 > drivers/net/tap/rte_eth_tap.c | 33 +++++++++++++++++---------------- >=20 > 1 file changed, 17 insertions(+), 16 deletions(-) >=20 > =20 >=20 > diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c > index aef8b0b9f..a93429973 100644 >=20 > --- a/drivers/net/tap/rte_eth_tap.c >=20 > +++ b/drivers/net/tap/rte_eth_tap.c >=20 > @@ -79,7 +79,4 @@ static const char *valid_arguments[] =3D { }; >=20 > -static unsigned int tap_unit; >=20 > -static unsigned int tun_unit; >=20 > - >=20 > static char tuntap_name[8]; >=20 > @@ -151,6 +148,4 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive) >=20 > snprintf(ifr.ifr_name, IFNAMSIZ, "%s", pmd->name); >=20 > - TAP_LOG(DEBUG, "ifr_name '%s'", ifr.ifr_name); >=20 > - >=20 > fd =3D open(TUN_TAP_DEV_PATH, O_RDWR); >=20 > if (fd < 0) { >=20 > @@ -186,4 +181,11 @@ tun_alloc(struct pmd_internals *pmd, int is_keepaliv= e) >=20 > } >=20 > + /* >=20 > + * Name passed to kernel might be wildcard like dtun%d >=20 > + * and need to find the resulting device. >=20 > + */ >=20 > + TAP_LOG(DEBUG, "Device name is '%s'", ifr.ifr_name); >=20 > + strlcpy(pmd->name, ifr.ifr_name, RTE_ETH_NAME_MAX_LEN); >=20 > + >=20 > if (is_keepalive) { >=20 > /* >=20 > @@ -1756,4 +1758,5 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, ch= ar > *tap_name, >=20 > goto error_exit; >=20 > } >=20 > + TAP_LOG(DEBUG, "allocated %s", pmd->name); >=20 > ifr.ifr_mtu =3D dev->data->mtu; >=20 > @@ -1895,6 +1898,6 @@ set_interface_name(const char *key __rte_unused, >=20 > strlcpy(name, value, RTE_ETH_NAME_MAX_LEN); >=20 > else >=20 > - snprintf(name, RTE_ETH_NAME_MAX_LEN, "%s%d", >=20 > - DEFAULT_TAP_NAME, tap_unit - 1); >=20 > + /* use tap%d which causes kernel to choose next available > */ >=20 > + strlcpy(name, DEFAULT_TAP_NAME "%d", RTE_ETH_NAME_MAX_LE= N); >=20 > return 0; >=20 > @@ -2003,6 +2006,6 @@ rte_pmd_tun_probe(struct rte_vdev_device *dev) >=20 > } >=20 > - snprintf(tun_name, sizeof(tun_name), "%s%u", >=20 > - DEFAULT_TUN_NAME, tun_unit++); >=20 > + /* use tun%d which causes kernel to choose next available */ >=20 > + strlcpy(tun_name, DEFAULT_TUN_NAME "%d", RTE_ETH_NAME_MAX_LEN); >=20 > if (params && (params[0] !=3D '\0')) { >=20 > @@ -2024,9 +2027,8 @@ rte_pmd_tun_probe(struct rte_vdev_device *dev) >=20 > pmd_link.link_speed =3D ETH_SPEED_NUM_10G; >=20 > - TAP_LOG(NOTICE, "Initializing pmd_tun for %s as %s", >=20 > - name, tun_name); >=20 > + TAP_LOG(NOTICE, "Initializing pmd_tun for %s", name); >=20 > ret =3D eth_dev_tap_create(dev, tun_name, remote_iface, 0, >=20 > - ETH_TUNTAP_TYPE_TUN); >=20 > + ETH_TUNTAP_TYPE_TUN); >=20 > leave: >=20 > @@ -2034,5 +2036,4 @@ leave: >=20 > TAP_LOG(ERR, "Failed to create pmd for %s as %s", >=20 > name, tun_name); >=20 > - tun_unit--; /* Restore the unit number */ >=20 > } >=20 > rte_kvargs_free(kvlist); >=20 > @@ -2190,6 +2191,7 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev) >=20 > speed =3D ETH_SPEED_NUM_10G; >=20 > - snprintf(tap_name, sizeof(tap_name), "%s%u", >=20 > - DEFAULT_TAP_NAME, tap_unit++); >=20 > + >=20 > + /* use tap%d which causes kernel to choose next available */ >=20 > + strlcpy(tap_name, DEFAULT_TAP_NAME "%d", RTE_ETH_NAME_MAX_LEN); >=20 > memset(remote_iface, 0, RTE_ETH_NAME_MAX_LEN); >=20 > @@ -2255,5 +2257,4 @@ leave: >=20 > tap_devices_count--; >=20 > } >=20 > - tap_unit--; /* Restore the unit number= */ >=20 > } >=20 > rte_kvargs_free(kvlist); >=20 > -- >=20 > 2.19.0 >=20 > =20 >=20 > --- >=20 > Diff of the applied patch vs upstream commit (please double-check if > non-empty: >=20 > --- >=20 > --- - 2019-01-31 15:44:06.948575581 +0000 >=20 > +++ 0052-net-tap-let-kernel-choose-tun-device-name.patch 2019-01= -31 > 15:44:05.000000000 +0000 >=20 > @@ -1,15 +1,16 @@ >=20 > -From b5235d61f3b7d2b1c2b9ee2601f3aca2b151b508 Mon Sep 17 00:00:00 2001 >=20 > +From d3034e04e58ca7bed78182fa9a1439afe4a73d4b Mon Sep 17 00:00:00 2001 >=20 > From: Stephen Hemminger >=20 > Date: Fri, 11 Jan 2019 12:35:18 -0800 >=20 > Subject: [PATCH] net/tap: let kernel choose tun device name >=20 > +[ upstream commit b5235d61f3b7d2b1c2b9ee2601f3aca2b151b508 ] >=20 > + >=20 > 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. >=20 > Fixes: 02f96a0a82d1 ("net/tap: add TUN/TAP device PMD") >=20 > -Cc: stable@dpdk.org >=20 > Reported-by: Haifeng Li >=20 > Signed-off-by: Stephen Hemminger @@ -19,10 += 20, > 10 @@ >=20 > 1 file changed, 17 insertions(+), 16 deletions(-) >=20 > diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap= .c > -index d699b4fb0..ed8483cb9 100644 >=20 > +index aef8b0b9f..a93429973 100644 >=20 > --- a/drivers/net/tap/rte_eth_tap.c >=20 > +++ b/drivers/net/tap/rte_eth_tap.c >=20 > -@@ -80,7 +80,4 @@ static const char *valid_arguments[] =3D { >=20 > +@@ -79,7 +79,4 @@ static const char *valid_arguments[] =3D { >=20 > }; >=20 > =20 >=20 > -static unsigned int tap_unit; >=20 > @@ -30,14 +31,14 @@ >=20 > - >=20 > static char tuntap_name[8]; >=20 > =20 >=20 > -@@ -152,6 +149,4 @@ tun_alloc(struct pmd_internals *pmd, int is_keepaliv= e) >=20 > - strlcpy(ifr.ifr_name, pmd->name, IFNAMSIZ); >=20 > +@@ -151,6 +148,4 @@ tun_alloc(struct pmd_internals *pmd, int is_keepaliv= e) >=20 > + snprintf(ifr.ifr_name, IFNAMSIZ, "%s", pmd->name); >=20 > =20 >=20 > - TAP_LOG(DEBUG, "ifr_name '%s'", ifr.ifr_name); >=20 > - >=20 > fd =3D open(TUN_TAP_DEV_PATH, O_RDWR); >=20 > if (fd < 0) { >=20 > -@@ -187,4 +182,11 @@ tun_alloc(struct pmd_internals *pmd, int is_keepali= ve) >=20 > +@@ -186,4 +181,11 @@ tun_alloc(struct pmd_internals *pmd, int=20 >=20 > +is_keepalive) >=20 > } >=20 > =20 >=20 > + /* >=20 > @@ -49,22 +50,22 @@ >=20 > + >=20 > if (is_keepalive) { >=20 > /* >=20 > -@@ -1757,4 +1759,5 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, c= har > *tap_name, >=20 > +@@ -1756,4 +1758,5 @@ eth_dev_tap_create(struct rte_vdev_device *vdev,=20 >=20 > +char *tap_name, >=20 > goto error_exit; >=20 > } >=20 > + TAP_LOG(DEBUG, "allocated %s", pmd->name); >=20 > =20 >=20 > ifr.ifr_mtu =3D dev->data->mtu; >=20 > -@@ -1919,6 +1922,6 @@ set_interface_name(const char *key __rte_unused, >=20 > +@@ -1895,6 +1898,6 @@ set_interface_name(const char *key __rte_unused, >=20 > strlcpy(name, value, RTE_ETH_NAME_MAX_LEN); >=20 > - } else { >=20 > + else >=20 > - snprintf(name, RTE_ETH_NAME_MAX_LEN, "%s%d", >=20 > - DEFAULT_TAP_NAME, tap_unit - 1); >=20 > + /* use tap%d which causes kernel to choose next available = */ >=20 > + strlcpy(name, DEFAULT_TAP_NAME "%d", RTE_ETH_NAME_MAX_LEN); >=20 > - } >=20 > +=20 >=20 > return 0; >=20 > -@@ -2033,6 +2036,6 @@ rte_pmd_tun_probe(struct rte_vdev_device *dev) >=20 > +@@ -2003,6 +2006,6 @@ rte_pmd_tun_probe(struct rte_vdev_device *dev) >=20 > } >=20 > =20 >=20 > - snprintf(tun_name, sizeof(tun_name), "%s%u", >=20 > @@ -73,25 +74,25 @@ >=20 > + strlcpy(tun_name, DEFAULT_TUN_NAME "%d", RTE_ETH_NAME_MAX_LEN); >=20 > =20 >=20 > if (params && (params[0] !=3D '\0')) { >=20 > -@@ -2054,9 +2057,8 @@ rte_pmd_tun_probe(struct rte_vdev_device *dev) >=20 > +@@ -2024,9 +2027,8 @@ rte_pmd_tun_probe(struct rte_vdev_device *dev) >=20 > pmd_link.link_speed =3D ETH_SPEED_NUM_10G; >=20 > =20 >=20 > -- TAP_LOG(DEBUG, "Initializing pmd_tun for %s as %s", >=20 > +- TAP_LOG(NOTICE, "Initializing pmd_tun for %s as %s", >=20 > - name, tun_name); >=20 > -+ TAP_LOG(DEBUG, "Initializing pmd_tun for %s", name); >=20 > ++ TAP_LOG(NOTICE, "Initializing pmd_tun for %s", name); >=20 > =20 >=20 > ret =3D eth_dev_tap_create(dev, tun_name, remote_iface, 0, >=20 > - ETH_TUNTAP_TYPE_TUN); >=20 > + ETH_TUNTAP_TYPE_TUN); >=20 > =20 >=20 > leave: >=20 > -@@ -2064,5 +2066,4 @@ leave: >=20 > +@@ -2034,5 +2036,4 @@ leave: >=20 > TAP_LOG(ERR, "Failed to create pmd for %s as %s", >=20 > name, tun_name); >=20 > - tun_unit--; /* Restore the unit number */ >=20 > } >=20 > rte_kvargs_free(kvlist); >=20 > -@@ -2220,6 +2221,7 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev) >=20 > +@@ -2190,6 +2191,7 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev) >=20 > =20 >=20 > speed =3D ETH_SPEED_NUM_10G; >=20 > - snprintf(tap_name, sizeof(tap_name), "%s%u", >=20 > @@ -101,7 +102,7 @@ >=20 > + strlcpy(tap_name, DEFAULT_TAP_NAME "%d", RTE_ETH_NAME_MAX_LEN); >=20 > memset(remote_iface, 0, RTE_ETH_NAME_MAX_LEN); >=20 > =20 >=20 > -@@ -2284,5 +2286,4 @@ leave: >=20 > +@@ -2255,5 +2257,4 @@ leave: >=20 > tap_devices_count--; >=20 > } >=20 > - tap_unit--; /* Restore the unit number */ >=20 I wonder if the real problem here is the number of open file descriptors th= at get leftover from the new EAL memory changes.