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 976D4A00E6 for ; Tue, 9 Jul 2019 12:22:19 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 86EB037A2; Tue, 9 Jul 2019 12:22:19 +0200 (CEST) Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) by dpdk.org (Postfix) with ESMTP id 1F1F837A2; Tue, 9 Jul 2019 12:22:18 +0200 (CEST) Received: by mail-pg1-f193.google.com with SMTP id q4so9216851pgj.8; Tue, 09 Jul 2019 03:22:18 -0700 (PDT) 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=FXcWwWSpTZDg9m22xukk3whIYWbifDALyiORi+y6RHo=; b=CR41cNAHCvk6NKHDbsKCylKBTOQU8E2pvCkusUgZJC/MmwTFHkdK+8vHRqixFRWUm8 XJW74Ix5WIrPIjkqqyEg1rxVB8uELv9EmoI+69ImcN+NQFtTN2hjyIdzU+rHu3JH/uLb htLE0HtLwpLkJcuCabJfK5kYzHbDAKU1PuS+uyQcgxWIfvhlvPMJp/EK9VcxV0/rqYZt 5C/Fx4oT7jRy/XOSljQMLtqsXy7owwdI1+RcX9Tu2UTGUiVzy3HmEzqqqE/xEZgnQdSH KA8XFKgvW7tLmYLGM6OQOuS7aq9h1caHmWdrQaI++Y8Pr7XUaxrr6MZVtFVGORTeIvM8 YiDw== 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=FXcWwWSpTZDg9m22xukk3whIYWbifDALyiORi+y6RHo=; b=OrZYq6ovgGCcBo+tfKOyXHSLEiKVxSkbKTxxQBm7qCY/8EEjtM8ASdkyGOtSja4fNI 6WAvG3LogZEWh4sa1oAKbWt/IGYgud9ZRS44geXoAZS0A4pMErer/mKqfo5KyFCE11LM Kfxv1JEUh+4qIGB47TLMeGYzPO0TtFRjXWVSrE71ZSss1BO1iDmllf3Xd9tQ9obQC304 wFsW8mGD090FxbcBerlhOnX5E09U84fZKmySejq38XoqBFylIMASt7EfrI2J36DeHBUm uJBbVI7eqhjVr2x7A1axpqkDyd9DZycuHwfR+h26dhNlKxg5ORtxNMnCuix/ABjbl3Xd bXmA== X-Gm-Message-State: APjAAAUHDn+MzM63bHlP/ACAZH/CvKnHUX6rCXv0I9dnsFmxdHPGkCAZ z1N/xrsTDAbtWFZ7aPT6QjsG0z1A X-Google-Smtp-Source: APXvYqxLCmMJi9gq+AvvkgllsuMCo8SK+xLdTqHCtpU+iq1ydZBI1nMisvlTQ6cu/1iEXp+rWkbo/A== X-Received: by 2002:a63:593:: with SMTP id 141mr29137177pgf.78.1562667737071; Tue, 09 Jul 2019 03:22:17 -0700 (PDT) Received: from mugwort.local ([192.47.164.146]) by smtp.gmail.com with ESMTPSA id h1sm17892409pgv.93.2019.07.09.03.22.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jul 2019 03:22:16 -0700 (PDT) To: "Burakov, Anatoly" Cc: dev@dpdk.org, stable@dpdk.org References: <1555379952-23517-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> <1555386203-23776-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> <1555386203-23776-2-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> From: Yasufumi Ogawa Message-ID: <95821e91-33f1-686c-f4c1-8ce7a07646d4@gmail.com> Date: Tue, 9 Jul 2019 19:22:13 +0900 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 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-stable] [dpdk-dev] [PATCH v2 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" Hi Anatoly, On 2019/07/05 17:53, Burakov, Anatoly wrote: > On 16-Apr-19 4:43 AM, ogawa.yasufumi@lab.ntt.co.jp 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 if the value is 1. >> >> Cc: stable@dpdk.org >> >> Signed-off-by: Yasufumi Ogawa >> --- > > I'm not too well versed in containers - is this hostname 1) always set, > and 2) always unique? For docker, 1) hostname is always set. 2) The hostname is decided as short form of container ID, so it might not be unique even though very low possibility. I found that we can get whole container ID in `/proc/self/cgroup` as discussed [1]. I think using hostname is reasonable way without running many secondary processes. However, it might be better to use 64 digits full container ID instead of 12 digits short ID if ensure uniqueness strongly. What do yo think? [1] https://forums.docker.com/t/get-a-containers-full-id-from-inside-of-itself/37237 > > > >> +    if (getpid() == 1) { >> +        FILE *hn_fp; >> +        hn_fp = fopen("/etc/hostname", "r"); >> +        if (hn_fp == NULL) { >> +            RTE_LOG(ERR, EAL, >> +                "Cannot open '/etc/hostname' for secondary\n"); >> +            return -1; >> +        } >> + >> +        /* with docker, /etc/hostname just has one entry of hostname */ >> +        if (fscanf(hn_fp, "%s", proc_id) == EOF) >> +            return -1; > > Wouldn't an error in fscanf() leak the file handle? I think you need to > fclose() before checking the result. I would like to fix it. Regards, Yasufumi > >> +        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 = rte_fbarray_init(&local_msl->memseg_arr, name, >>           primary_msl->memseg_arr.len, >> > >