From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id F0C7CA32A4 for ; Fri, 25 Oct 2019 17:37:14 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B11541D182; Fri, 25 Oct 2019 17:37:14 +0200 (CEST) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by dpdk.org (Postfix) with ESMTP id 9FE4A1D15E for ; Fri, 25 Oct 2019 17:37:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572017830; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OfOzPkn1HxS1whzM39INGi/fpZYdYiM1ad+UzLSsUQg=; b=CvckzEWIXUnr/e3ZiLoXYPhFPLwjnCmiL0CbWRSLxUiop6V5VozUTzzR916gRhP282+v0G a2LBJzv+4fZZzxycRyM8NTJ2qGP7/+PrlNi67JZSQecz2ou18chAwNdgZv5C3L7HBa+pLV ZPgNKwLY5FrUqvoVVz1LajVAm9Izeys= Received: from mail-ua1-f69.google.com (mail-ua1-f69.google.com [209.85.222.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-380-947ua7-AMZO7PeWn7zXhbg-1; Fri, 25 Oct 2019 11:37:08 -0400 Received: by mail-ua1-f69.google.com with SMTP id r39so660225uad.3 for ; Fri, 25 Oct 2019 08:37:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=jmiu7o7adC1ToPsojTuE7q2WQH7uDr7VfObSlGQDQNw=; b=FD3VkKq//a4ncjjtthO4Llu1/xPE1DknW8rha6OywqfKhddS3kHhkvTD7NsF1EFPSY v71F6tjhTpcsYV3yVyeGU2y5CCmcmI6kLBIl51lMj4/vmjbcei9sWoEvIQf0TxQiSxv4 RJmHfmwQn3+nAcm5NmzAHcMtObeNfxgDtTMyDoKkw6FIkfJzf+kK5rTMDz0NVo8wHHKu /yaU9mlXIYmR64WD9PY6kzipbaxIRuhVJ6ygQAuafeiZ0MZie1QrMWXoWj04rMI9w/N7 zkut7ktOTyjSgzoPsLEgwY3PlddoN3sQUUYhXHZ5HD/yetIiFGrK2Sh7lilX7/JomdwS G4iw== X-Gm-Message-State: APjAAAVvj2k3cxTVi7Zh2jmSnBDeRhVldEa2KBRvshGxV+uOmdaeV5w8 PzG/q+IaGa6wl295XTvJXyt17m4oTBDedz2+jkk5zPXRTAP54eQU/VUybLD5I2Smgn1HyAjuCB9 mETkkChilfYVvyg3M00mtTao= X-Received: by 2002:a05:6102:387:: with SMTP id m7mr2360454vsq.105.1572017827895; Fri, 25 Oct 2019 08:37:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqwS0YQMbh1cYI2Hv9/IOMbMeMsDDAhCZRq3RlzxGdbQmhmDZQfvK0Rqa4OBmUCE7GbIHmO6US+SjdccFQ6ghHc= X-Received: by 2002:a05:6102:387:: with SMTP id m7mr2360426vsq.105.1572017827447; Fri, 25 Oct 2019 08:37:07 -0700 (PDT) MIME-Version: 1.0 References: <20190711103148.9187-1-yasufum.o@gmail.com> <20190724082031.45546-1-yasufum.o@gmail.com> <20190724082031.45546-2-yasufum.o@gmail.com> In-Reply-To: From: David Marchand Date: Fri, 25 Oct 2019 17:36:55 +0200 Message-ID: To: yasufum.o@gmail.com Cc: "Burakov, Anatoly" , dev , dpdk stable , Yasufumi Ogawa X-MC-Unique: 947ua7-AMZO7PeWn7zXhbg-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-stable] [PATCH v4 1/1] fbarray: get fbarrays from containerized secondary 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: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On Fri, Oct 11, 2019 at 11:36 AM David Marchand wrote: > > Some comments. ping. > > The title does not reflect the observed issue. > I understand that secondary processeses can't be started from a docker > container. > The patch title should reflect this. > > On Wed, Jul 24, 2019 at 10:20 AM wrote: > > > > From: Yasufumi Ogawa > > > > In secondary_msl_create_walk(), it creates a file for fbarrays with its > > PID for reserving unique name among secondary processes. However, it > > does not work if secondary is run as app container because each of > > containerized secondary has PID 1. To reserve unique name, use hostname > > instead of PID because hostname is assigned as a short form of 64 > > digits full container ID in docker. > > > > Cc: stable@dpdk.org > > I don't think we want to backport this behavior change. > > > > > Signed-off-by: Yasufumi Ogawa > > --- > > lib/librte_eal/linux/eal/eal_memalloc.c | 28 +++++++++++++++++++++++-- > > 1 file changed, 26 insertions(+), 2 deletions(-) > > > > diff --git a/lib/librte_eal/linux/eal/eal_memalloc.c b/lib/librte_eal/l= inux/eal/eal_memalloc.c > > index 1f6a7c18f..356b304a8 100644 > > --- a/lib/librte_eal/linux/eal/eal_memalloc.c > > +++ b/lib/librte_eal/linux/eal/eal_memalloc.c > > @@ -1366,6 +1366,7 @@ secondary_msl_create_walk(const struct rte_memseg= _list *msl, > > struct rte_memseg_list *primary_msl, *local_msl; > > char name[PATH_MAX]; > > int msl_idx, ret; > > + char proc_id[33] =3D { 0 }; /* 32bytes is enough if using host= name */ > > This variable only makes sense in the if (getpid() =3D=3D 1) branch, > please move it there, and see below comment about using gethostname(). > > > > > if (msl->external) > > return 0; > > @@ -1375,8 +1376,31 @@ secondary_msl_create_walk(const struct rte_memse= g_list *msl, > > local_msl =3D &local_memsegs[msl_idx]; > > > > /* create distinct fbarrays for each secondary */ > > - snprintf(name, RTE_FBARRAY_NAME_LEN, "%s_%i", > > - primary_msl->memseg_arr.name, getpid()); > > + /* If run secondary in a container, the name of fbarray file sh= ould > > + * not be decided with pid because getpid() always returns 1. > > + * In docker, hostname is assigned as a short form of full cont= ainer > > + * ID. So use hostname as unique ID among containers instead. > > I understand this is how it works for docker. > Is this the same in other container environments? > > > > + */ > > + if (getpid() =3D=3D 1) { > > + FILE *hn_fp; > > + hn_fp =3D fopen("/etc/hostname", "r"); > > Why not use gethostname() ? > Plus, this api defines the maximum size of the hostname as HOST_NAME_MAX = bytes. > > > + if (hn_fp =3D=3D NULL) { > > + RTE_LOG(ERR, EAL, > > + "Cannot open '/etc/hostname' for second= ary\n"); > > + return -1; > > + } > > + > > + /* with docker, /etc/hostname just has one entry of hos= tname */ > > + if (fscanf(hn_fp, "%32s", proc_id) =3D=3D EOF) { > > + fclose(hn_fp); > > + return -1; > > + } > > + fclose(hn_fp); > > + } else > > + sprintf(proc_id, "%d", (int)getpid()); > > + > > + snprintf(name, RTE_FBARRAY_NAME_LEN, "%s_%s", > > + primary_msl->memseg_arr.name, proc_id); > > > > ret =3D rte_fbarray_init(&local_msl->memseg_arr, name, > > primary_msl->memseg_arr.len, --=20 David Marchand