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 86C97A32A4 for ; Fri, 25 Oct 2019 17:37:12 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 399A31D15E; Fri, 25 Oct 2019 17:37:12 +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 50F371D14B 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=1572017829; 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=dym/uQ7hlnvzgpwNQb1yBav0FjuGjTNzS0fDLqtVnDbe6w534+MDpnmz1CY6ZECWKclt5V ce+1UQGZOuGRGvmp6+tGdrqlqZOSbKEVoKHg4x10oOWCoEW16A2EOcDrleLSm8SzertLzp IebXLO3HXsUkjdUdhhFPK6uakVEEUbs= Received: from mail-ua1-f70.google.com (mail-ua1-f70.google.com [209.85.222.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-434-h336OPh1NauE15CpyL5F1A-1; Fri, 25 Oct 2019 11:37:08 -0400 Received: by mail-ua1-f70.google.com with SMTP id a32so636093uad.22 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=gk2w36oY/TPTcC6feokohiabNnHr3dA2O9PS0t5bkn9T/zcGzls9Q4L5MIaaZvgm/q gYGoYAgoC/e/IbUyJfkd/R95z+t258fAx/NTHT8OiI0rJlsyMi24dEX/vDSqRbL97XeB 0V0X94ONSCCMbMieuVg797BVdktWoBF7XYSN2Qe7a1JMuinZGGwIZi9+x/6buGMpjyje TcW6m2O95KERBH5tPrxs6jnzi8C2Ee/b/vS3k+Hai+0VCKsuqlNv/4qHKupmJnl8Cpie 7R8mYmDE0PBFZPtG7QSMFX0QVs+/A8AXd4h6ENqnGUR9yS+wDMl9POFb88Z7Dc26x9tE DYtg== X-Gm-Message-State: APjAAAV49hhWsyvTBG10CmxlMx5TwYZwiQ0+hdk3eyviBUSX9c+hi+Gx DfjTYeqLX2rF4bWfKhMrjK16sZyE8OENNek9Lx4PGOhb9HZPBMFInump+ECWFpxG3evoAyaZKYW tNAEBrjKPuPiV43QQUk8= X-Received: by 2002:a05:6102:387:: with SMTP id m7mr2360452vsq.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: h336OPh1NauE15CpyL5F1A-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-dev] [PATCH v4 1/1] fbarray: get fbarrays from containerized secondary X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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