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 0275EA04F2; Thu, 5 Dec 2019 21:13:57 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 347301BF7F; Thu, 5 Dec 2019 21:13:57 +0100 (CET) Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) by dpdk.org (Postfix) with ESMTP id 67CE91BF7B for ; Thu, 5 Dec 2019 21:13:56 +0100 (CET) Received: by mail-pg1-f193.google.com with SMTP id x7so2089368pgl.11 for ; Thu, 05 Dec 2019 12:13:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=BoyTSHgmMg67jhNhc7yVDRB42HkNkLj5jBDNcr9XPUo=; b=ENTJ5dMhq9WKfmW+PzY9MPlGMqv/EzuBJDnmvxLeu8uJUqAnkrDgOEsaL7s6Xe4rYx lOHlRcaAmUnGD/xGhGRbkW/A84/exPt/KgFtcNakByp3Y+T80jLLXxRNdBO0Qcqwj2MD sbhLLHBlhoqfqWajTF2LsOtabhsWegLshuFTodqYx4hwaihyuocw9wfvoteVmk87aoZA I7SAGSqbiE863XKO/5P/Uv8sswYvvHuuBaAPm4yW9lOZpbKYEpYynuX3G9TilVzg1Lfv GJ0zCI9jXpD8Ht6FrhKAQOvhWA1W4Nmwi5gafstr+Th4ewQlh2wGiQOfBJYUAWigMmRN WYXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=BoyTSHgmMg67jhNhc7yVDRB42HkNkLj5jBDNcr9XPUo=; b=P3Qyz5YDtmgAX2ggDs2ry1VFIAwB6U71r/04ZWpg7YyFb/qfGQrFQI1VCMCNYTilg1 +pKemHQT8WxMXEuNsBh/X8S16sFM+mDcQsDN/HzA24MpR9tob+SgH6fcNGYNqXXgHw2E UTFWvujnsJGm2PljS3RmvueIEKPWGf5szA+aO1u7dKNjnp1vdTRTRl1BYk3u08PI0qbm a8tIx8b0rEwq9Qw5D8kDCOWsfRBZ6DRcZTctwNGyeBtX2Rrla1bUkRj3UnWyIHaVpp+p Cdgs642uUzzm6hcqW2bXZbfFC/F6JH4Gb3zUqle3dclrnIaI0KinjSLYzoiNF651460K AISQ== X-Gm-Message-State: APjAAAXHIpo+YyOtrSf+CUdl09Gl/ioHw6ZeoRDjO4iJrhK1dw8kQWjW GFny91aNTyNJ6Rex0BAJ/s8= X-Google-Smtp-Source: APXvYqxm922EyQbwZnQXt/e9hRLMornzskFtAVwU7j0E7vck84DPZd/jl4EuJdHoXuPdMHWhReCdfg== X-Received: by 2002:a63:3404:: with SMTP id b4mr11129766pga.438.1575576835382; Thu, 05 Dec 2019 12:13:55 -0800 (PST) Received: from mugwort.local ([2400:4050:c8c2:de00:55a2:f021:694c:15b4]) by smtp.gmail.com with ESMTPSA id h11sm12068315pgv.38.2019.12.05.12.13.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Dec 2019 12:13:54 -0800 (PST) To: "Burakov, Anatoly" Cc: David Marchand , "Ananyev, Konstantin" , dev , Yasufumi Ogawa References: <20190724082031.45546-1-yasufum.o@gmail.com> <20191113214346.33749-1-yasufum.o@gmail.com> <20191113214346.33749-2-yasufum.o@gmail.com> <6a6d7228-f22b-9ba5-c288-1701b738b7c4@intel.com> <61dd1730-3c80-da57-126d-84596b23ff31@gmail.com> <4144a7d7-f6af-8ebf-e572-d907e1975837@gmail.com> From: Yasufumi Ogawa Message-ID: <9fa34e1d-8140-63a7-f25d-8e02415b2840@gmail.com> Date: Fri, 6 Dec 2019 05:13:52 +0900 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH v7 1/1] fbarray: fix duplicated fbarray file in 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" Hi Anatoly, On 2019/12/02 19:43, Burakov, Anatoly wrote: > On 29-Nov-19 5:44 AM, Yasufumi Ogawa wrote: >> Hi Anatoly, >> >> On 2019/11/27 19:26, Burakov, Anatoly wrote: >>> On 26-Nov-19 7:40 PM, Yasufumi Ogawa wrote: >>>> Hi David, >>>> >>>> Sorry for slow reply. >>>> >>>> On 2019/11/14 21:27, David Marchand wrote: >>>>> On Thu, Nov 14, 2019 at 12:42 PM Yasufumi Ogawa >>>>> wrote: >>>>>> >>>>>> On 2019/11/14 2:01, Burakov, Anatoly wrote: >>>>>>> On 13-Nov-19 9:43 PM, yasufum.o@gmail.com 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 several secondaries run as app containers >>>>>>>> because each >>>>>>>> of containerized secondary has PID 1, and failed to reserve >>>>>>>> unique name >>>>>>>> other than first one. To reserve unique name in each of >>>>>>>> containers, use >>>>>>>> hostname in addition to PID. >>>>>>>> >>>>>>>> Cc: stable@dpdk.org >>>>>>>> >>>>>>>> Signed-off-by: Yasufumi Ogawa >>>>>>>> --- >>>>>>>>    lib/librte_eal/linux/eal/eal_memalloc.c | 16 +++++++++++++--- >>>>>>>>    1 file changed, 13 insertions(+), 3 deletions(-) >>>>>>>> >>>>>>>> diff --git a/lib/librte_eal/linux/eal/eal_memalloc.c >>>>>>>> b/lib/librte_eal/linux/eal/eal_memalloc.c >>>>>>>> index af6d0d023..11de6d4d6 100644 >>>>>>>> --- a/lib/librte_eal/linux/eal/eal_memalloc.c >>>>>>>> +++ b/lib/librte_eal/linux/eal/eal_memalloc.c >>>>>>>> @@ -1365,6 +1365,12 @@ 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 hostname[HOST_NAME_MAX+1] = { 0 }; >>>>>>>> +    /* filename of secondary's fbarray is defined such as >>>>>>>> +     * "fbarray_memseg-1048576k-0-0_PID_HOSTNAME" and length of >>>>>>>> PID >>>>>>>> +     * can be 7 digits maximumly. >>>>>>>> +     */ >>>>>>>> +    int fbarray_sec_name_len = 32 + 7 + 1 + HOST_NAME_MAX + 1; >>>>>>> >>>>>>> What does 32 stand for? Maybe #define both 32 and 7 values? >>>>>> Hi Anatoly, >>>>>> >>>>>> Thank you for your comments! If my understanding is correct, the >>>>>> prefix >>>>>> "fbarray_memseg-1048576k-0-0_" is 28 digits and it could be larger if >>>>>> using the size of hugepage or the number of NUMA nodes are larger >>>>>> possibly. However, I think 32 digits is still enough. >>>>>> >>>>>>   > Maybe #define both 32 and 7 values? >>>>>> Yes. I think it should be better to use #define if this values are >>>>>> referred several times. >>>>> >>>>> >>>>> We can truncate to RTE_FBARRAY_NAME_LEN in all cases. >>>>> And iiuc, rte_fbarray_init will refuse any longer name anyway. >>>> Could I confirm the issue? I've understood that it is failed to >>>> validate the name of fbarray in fully_validate() at >>>> "lib/librte_eal/common/eal_common_fbarray.c:697". >>>> >>>> static int >>>> fully_validate(const char *name, unsigned int elt_sz, unsigned int len) >>>> { >>>>          if (name == NULL || elt_sz == 0 || len == 0 || len > >>>> INT_MAX) { >>>>                  rte_errno = EINVAL; >>>>                  return -1; >>>>          } >>>> >>>>          if (strnlen(name, RTE_FBARRAY_NAME_LEN) == >>>> RTE_FBARRAY_NAME_LEN) { >>>>                  rte_errno = ENAMETOOLONG; >>>>                  return -1; >>>>          } >>>>          return 0; >>>> } >>>> >>>> I should overwrite the definition of RTE_FBARRAY_NAME_LEN as >>>> previous patch in this case, and it causes an ABI breakage, right? >>>> If so, I would like to make the change and give up to update stable >>>> release. >>>> >>>> Thanks, >>>> Yasufumi >>>> >>> >>> It seems we're getting into bikeshedding... >>> >>> We can do this without ABI breakage. You could have just used >>> RTE_FBARRAY_NAME_LEN as max fbarray name length for >>> fbarray_sec_name_len (i.e. that would include hostname + pid + >>> whatever else there is). The name, as David has pointed out, would be >>> truncated to RTE_FBARRAY_NAME_LEN anyway (or, more precisely, it will >>> be refused if it's longer than that), so this is the most you can >>> have - so you can just use that as the maximum. >> I sent v8 patch to change the size of RTE_FBARRAY_NAME_LEN itself to >> be allowed the size of secondary's fbarray over 64 bytes. I appreciate >> if you agree that. >> > > Why not just limit the name to RTE_FBARRAY_NAME_LEN instead of changing > the definition of RTE_FBARRAY_NAME_LEN? Could I confirm my understanding? I understand that RTE_FBARRAY_NAME_LEN is 64 currently and it is not enough for secondary in a container if hostname is added to the name of secondary's fbarray. Regards, Yasufumi > > One the other hand, technically, fbarray API is experimental. The only > structure that uses rte_fbarray is rte_memseg_list, but API's using > either rte_fbarray or rte_memseg_list are either internal (memory/VFIO > subsystem), or are marked as experimental (walk functions). > > So i *think* we're actually OK with changing the length of > RTE_FBARRAY_NAME_LEN as far as ABI policy goes: nothing in the stable > ABI gets affected. David, thoughts? > > (i think it's probably time to make experimental memory/fbarray stuff > stable, but that's a different conversation...) > >> Thanks, >> Yasufumi >> > >