[dpdk-dev] [PATCH v7 1/1] fbarray: fix duplicated fbarray file in secondary

David Marchand david.marchand at redhat.com
Thu Nov 14 13:27:56 CET 2019


On Thu, Nov 14, 2019 at 12:42 PM Yasufumi Ogawa <yasufum.o at gmail.com> wrote:
>
> On 2019/11/14 2:01, Burakov, Anatoly wrote:
> > On 13-Nov-19 9:43 PM, yasufum.o at gmail.com wrote:
> >> From: Yasufumi Ogawa <ogawa.yasufumi at lab.ntt.co.jp>
> >>
> >> 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 at dpdk.org
> >>
> >> Signed-off-by: Yasufumi Ogawa <yasufum.o at gmail.com>
> >> ---
> >>   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.


-- 
David Marchand



More information about the dev mailing list