From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f47.google.com (mail-pg0-f47.google.com [74.125.83.47]) by dpdk.org (Postfix) with ESMTP id ABC61107A for ; Fri, 29 Sep 2017 03:24:47 +0200 (CEST) Received: by mail-pg0-f47.google.com with SMTP id 188so1875733pgb.2 for ; Thu, 28 Sep 2017 18:24:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=RiA/kSIoB8SbXEeVxDGl7hk/tBprHSW9I0It7bZyRqo=; b=mC6YMGTV43jeHlaVcBbfg8e3CM53izs8rl9LO6LyeS6Vbo31coP5e9aNwD+wEtK/l6 jJ39TLt1ndj0ipEHl+jxvLHajIJu8llSeyQjphfquyJjdkry7j38WO6AHOSh9qcEOjTw VDhaocHvzQDdSAha2YZTxfcvf0odKDFh7ndnarswzczkX/YX0X27TRT8ygZmINArG5nD TcPiE3wivFp2+qkbrUb81J9K1uUbM9ROII8ir+3TbT50ANWSxzizph78qS5qy/8x4tEI 7i4zOQ10dgdwyYdgD7PpQwqejwK8PlPGe1pHr7v88LHiftE7GyceYPu7ds9LHDnPLxCO lxkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=RiA/kSIoB8SbXEeVxDGl7hk/tBprHSW9I0It7bZyRqo=; b=aFSXESZsmTLVADEbn6zVvmwZRgSVnja5VUG15Mn1U1lpccYTlzXqTttH/oyXPoU4At RMuIxh02aNMxhMUmKZRbi5fPAtmwBAsj6OubqrRGsSHSfC1xA5je/abq0nrEQuLuA2TF ziKe0Ory7Lv2Oo42JEHemAVj4lL8k/fInmYCnT4MCzR9ZkK6Xu43460a5vLdm7t/mKUL HNvtFffhDPUT3JbDoDU3YK6MIYbbzQLdnf/9QV/pb56cyBw6IWcTJ5l/42mAX5O3mm5z N40wvUKV0wfWaS4IEmJyJHmbvUReDRlNzj/wdIZuStuG+kcC8GcI/gvfKZ4/ZYUyeG7m 2bGg== X-Gm-Message-State: AHPjjUgqImbriUHZVMjXvTe/5CqHio9CfcOZoYarsbxSH8fkB3ftmEro 53/8vmuDq7FyC2HBhBu/sDt1iA== X-Google-Smtp-Source: AOwi7QAxT9pDKSjOvIhvLfA5mC5QBww8/gEAf4OFu3hzW9SHdbbEYWumjgRNXweqcZ6jpr6lNrl9Hg== X-Received: by 10.98.210.138 with SMTP id c132mr5765143pfg.331.1506648286651; Thu, 28 Sep 2017 18:24:46 -0700 (PDT) Received: from yliu-home ([45.63.61.64]) by smtp.gmail.com with ESMTPSA id z8sm4750885pgs.41.2017.09.28.18.24.42 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Sep 2017 18:24:44 -0700 (PDT) Date: Fri, 29 Sep 2017 09:24:37 +0800 From: Yuanhan Liu To: "Tan, Jianfeng" Cc: "dev@dpdk.org" , "Richardson, Bruce" , "Ananyev, Konstantin" , "De Lara Guarch, Pablo" , "thomas@monjalon.net" , "maxime.coquelin@redhat.com" , "mtetsuyah@gmail.com" , "Yigit, Ferruh" Message-ID: <20170929012437.GM2251@yliu-home> References: <1503654052-84730-1-git-send-email-jianfeng.tan@intel.com> <1503654052-84730-7-git-send-email-jianfeng.tan@intel.com> <20170927121947.GL2251@yliu-home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Subject: Re: [dpdk-dev] [PATCH 06/12] eal: add channel for primary/secondary communication 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: , X-List-Received-Date: Fri, 29 Sep 2017 01:24:48 -0000 On Thu, Sep 28, 2017 at 01:50:20PM +0000, Tan, Jianfeng wrote: > > > +int > > > +rte_eal_primary_secondary_add_action(const char *action_name, > > > + rte_eal_primary_secondary_t action) > > > +{ > > > + struct action_entry *entry = malloc(sizeof(struct action_entry)); > > > + > > > + if (entry == NULL) > > > + return -ENOMEM; > > > + > > > + strncpy(entry->action_name, action_name, > > MAX_ACTION_NAME_LEN); > > > + entry->action = action; > > > + TAILQ_INSERT_TAIL(&action_entry_list, entry, next); > > > > Since you intended to support "one primary process and multiple secondary > > process", here we need a lock to protect the list. > > Only one thread of each process (either primary or secondary) does the register. So I wonder we don't have to add lock? Of course, no harm to add a lock. Right, I was wrong. I was thinking secondary processes could start at the same time, that we need a lock here. But as you said, the list is process specific: each process has it's own copy. No locked is needed then. > > > > Another wonder is do we really need that, I mean 1:N model? > > I'm open to suggestions. IMO, not much extra code for 1:N model than 1:1 model. So not necessary to restrict that. Fair enough. I was just wondering; I have no objection though. > > > +/** Path of primary/secondary communication unix socket file. */ > > > +#define PRIMARY_SECONDARY_UNIX_PATH_FMT "%s/.%s_unix" > > > +static inline const char * > > > +eal_primary_secondary_unix_path(void) > > > +{ > > > + static char buffer[PATH_MAX]; /* static so auto-zeroed */ > > > + const char *directory = default_config_dir; > > > + const char *home_dir = getenv("HOME"); > > > > It's not a good practice to generate such file at HOME dir. User would > > be surprised to find it at HOME dir. In the worst case, user might delete > > it. > > This way is the legacy way in DPDK, for example the config path. So I think we should fix that in another patch. Yes, I think so. --yliu > > > > > The more common way is to put it to tmp dir, like "/tmp". > > Thanks, > Jianfeng