From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E4536A0508; Wed, 13 Apr 2022 09:30:24 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 931CC40694; Wed, 13 Apr 2022 09:30:24 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id AD11B4068B for ; Wed, 13 Apr 2022 09:30:22 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id EDFC220A693C; Wed, 13 Apr 2022 00:30:21 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com EDFC220A693C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1649835021; bh=jKHT87Lm4pcAeJsbRCVVCLFgNE8v8UKkgbJCCzPwqRg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WfG/Ur3t1YbJjMQxEBHVLQT47CRTAY78xmwdrG5ron1Axt8cy0/fu9HQe5bDt+S0z 1MUKen/2brOlBdZQ7i+ZQkxh+lEV45jvZPNKBg3IELROB6DzWs0r8HuwF/GmVtL0uE hOlS3zEmjRkUknQ2+VRct1RO9D+mydhz7po+tdaM= Date: Wed, 13 Apr 2022 00:30:21 -0700 From: Tyler Retzlaff To: dev@dpdk.org Cc: thomas@monjalon.net, dmitry.kozliuk@gmail.com, anatoly.burakov@intel.com, Narcisa Vasile Subject: Re: [PATCH v2 3/4] eal: implement functions for get/set thread affinity Message-ID: <20220413073021.GB792@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1648819793-18948-1-git-send-email-roretzla@linux.microsoft.com> <1649760220-8683-1-git-send-email-roretzla@linux.microsoft.com> <1649760220-8683-4-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1649760220-8683-4-git-send-email-roretzla@linux.microsoft.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Tue, Apr 12, 2022 at 03:43:39AM -0700, Tyler Retzlaff wrote: > diff --git a/lib/eal/windows/eal_lcore.c b/lib/eal/windows/eal_lcore.c > index 476c2d2..4f2224e 100644 > --- a/lib/eal/windows/eal_lcore.c > +++ b/lib/eal/windows/eal_lcore.c ... snip ... > int > eal_create_cpu_map(void) > { > SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *infos, *info; > DWORD infos_size; > bool full = false; > + int ret = 0; > > + infos = NULL; > infos_size = 0; > if (!GetLogicalProcessorInformationEx( > RelationNumaNode, NULL, &infos_size)) { > @@ -62,7 +166,8 @@ struct cpu_map { > log_early("Cannot get NUMA node info size, error %lu\n", > GetLastError()); > rte_errno = ENOMEM; > - return -1; > + ret = -1; > + goto exit; > } > } > it can't be seen in the context of this diff but there is a leak of infos on an error path. a v3 of the series will be submitted to address the half-conversion to ret = -1 goto exit pattern. > @@ -83,52 +188,24 @@ struct cpu_map { > > info = infos; > while ((uint8_t *)info - (uint8_t *)infos < infos_size) { > - unsigned int node_id = info->NumaNode.NodeNumber; > - GROUP_AFFINITY *cores = &info->NumaNode.GroupMask; > - struct lcore_map *lcore; > - unsigned int i, socket_id; > - > - /* NUMA node may be reported multiple times if it includes > - * cores from different processor groups, e. g. 80 cores > - * of a physical processor comprise one NUMA node, but two > - * processor groups, because group size is limited by 32/64. > - */ > - for (socket_id = 0; socket_id < cpu_map.socket_count; > - socket_id++) { > - if (cpu_map.sockets[socket_id].node_id == node_id) > - break; > - } > - > - if (socket_id == cpu_map.socket_count) { > - if (socket_id == RTE_DIM(cpu_map.sockets)) { > - full = true; > - goto exit; > - } > - > - cpu_map.sockets[socket_id].node_id = node_id; > - cpu_map.socket_count++; > - } > - > - for (i = 0; i < EAL_PROCESSOR_GROUP_SIZE; i++) { > - if ((cores->Mask & ((KAFFINITY)1 << i)) == 0) > - continue; > - > - if (cpu_map.lcore_count == RTE_DIM(cpu_map.lcores)) { > - full = true; > - goto exit; > - } > - > - lcore = &cpu_map.lcores[cpu_map.lcore_count]; > - lcore->socket_id = socket_id; > - lcore->core_id = > - cores->Group * EAL_PROCESSOR_GROUP_SIZE + i; > - cpu_map.lcore_count++; > + if (eal_create_lcore_map(info)) { > + full = true; > + break; > } > > info = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *)( > (uint8_t *)info + info->Size); > } > > + if (eal_query_group_affinity()) { > + /* > + * No need to set rte_errno here. > + * It is set by eal_query_group_affinity(). > + */ > + ret = -1; > + goto exit; > + } > + > exit: > if (full) { > /* Not a fatal error, but important for troubleshooting. */