From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <bruce.richardson@intel.com>
Received: from mga11.intel.com (mga11.intel.com [192.55.52.93])
 by dpdk.org (Postfix) with ESMTP id C71AA5A86
 for <dev@dpdk.org>; Tue, 13 Jan 2015 14:55:56 +0100 (CET)
Received: from fmsmga001.fm.intel.com ([10.253.24.23])
 by fmsmga102.fm.intel.com with ESMTP; 13 Jan 2015 05:55:55 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.07,750,1413270000"; d="scan'208";a="650414730"
Received: from bricha3-mobl3.ger.corp.intel.com ([10.237.220.69])
 by fmsmga001.fm.intel.com with SMTP; 13 Jan 2015 05:55:51 -0800
Received: by  (sSMTP sendmail emulation); Tue, 13 Jan 2015 13:55:50 +0025
Date: Tue, 13 Jan 2015 13:55:49 +0000
From: Bruce Richardson <bruce.richardson@intel.com>
To: "Ferriter, Cian" <cian.ferriter@intel.com>
Message-ID: <20150113135549.GA3460@bricha3-MOBL3>
References: <1421140920-9964-1-git-send-email-cian.ferriter@intel.com>
 <D9B9B7EDAA4D17468E64B453458633E4044E9D21@IRSMSX108.ger.corp.intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <D9B9B7EDAA4D17468E64B453458633E4044E9D21@IRSMSX108.ger.corp.intel.com>
Organization: Intel Shannon Ltd.
User-Agent: Mutt/1.5.23 (2014-03-12)
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] lib/librte_ether: change socket_id passed to
 rte_memzone_reserve
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Tue, 13 Jan 2015 13:55:57 -0000

On Tue, Jan 13, 2015 at 09:23:16AM +0000, Ferriter, Cian wrote:
> Passing a socket id of "rte_socket_id()" can cause problems in non DPDK applications as there is a dependency on the current logical core we are running on.
> Passing " rte_lcore_to_socket_id(rte_get_master_lcore())" as the socket id to rte_memzone_reserve resolves these issues as the master lcore doesn't change.
> 

The only trouble is that when affinitizing the memory for the NICs to the socket
of the master lcore, it gives us no way to correctly configure an app
to use NICs connected to two different sockets on the one system. All memory for
all NICs will end up on the same socket. Two possible alternative solutions:
1) affinitize memory to the socket the NIC is connected to
2) add a socket parameter to the API calls to allow the user complete control
over their memory allocations

Obviously the second one breaks backward compatibility (assume we modify existing
API call), but is more powerful.

Thoughts?

/Bruce

> -----Original Message-----
> From: Ferriter, Cian 
> Sent: Tuesday, January 13, 2015 9:22 AM
> To: dev@dpdk.org
> Cc: Ferriter, Cian
> Subject: [PATCH] lib/librte_ether: change socket_id passed to rte_memzone_reserve
> 
> Change the socket id that is passed to rte_memzone_reserve from the socket id of current logical core to the socket id of the master_lcore.
> ---
>  lib/librte_ether/rte_ethdev.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)  mode change 100644 => 100755 lib/librte_ether/rte_ethdev.c
> 
> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c old mode 100644 new mode 100755 index 95f2ceb..835540d
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -184,7 +184,7 @@ rte_eth_dev_data_alloc(void)
>  	if (rte_eal_process_type() == RTE_PROC_PRIMARY){
>  		mz = rte_memzone_reserve(MZ_RTE_ETH_DEV_DATA,
>  				RTE_MAX_ETHPORTS * sizeof(*rte_eth_dev_data),
> -				rte_socket_id(), flags);
> +				rte_lcore_to_socket_id(rte_get_master_lcore()), flags);
>  	} else
>  		mz = rte_memzone_lookup(MZ_RTE_ETH_DEV_DATA);
>  	if (mz == NULL)
> --
> 1.7.4.1
>