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 80235A04EF; Mon, 25 May 2020 03:02:16 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A92B81D64B; Mon, 25 May 2020 03:02:15 +0200 (CEST) Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) by dpdk.org (Postfix) with ESMTP id 65CF11D64A for ; Mon, 25 May 2020 03:02:14 +0200 (CEST) Received: by mail-lj1-f194.google.com with SMTP id q2so18949254ljm.10 for ; Sun, 24 May 2020 18:02:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=j89FWiVQ2yQq/nQekLvRdYGBW7YLNVqifzjY4RXk9h8=; b=GLL/xMKViW4vEGry4Zx+3plCG5B6NPP0flHl5i//Cp1kdJuS4iJFAq5PUBpGRq+k+0 svNG7e1HlQ6WLHIpz6dFv3eDYZHwKWILR/rAJXvroDlzy1t2vIArMn3Qoncg1lkV6jWX t9gprQRp/PZJcakeqNxWGTU9vkrKDfhulejID4B2K26poZRamm9BJyA3FmAsvcP9WrKK nxZ1frKBbeI0Mw3G/U95hetx4t6m52TE6nrKpajWdzR/TT4PcYKIPcsFUlq031TcL3cW gTbvpxyaNZZxJC+u/RBubEpBJj2QpVdZswtV+wAWpQrvbsLbWv1hHCzk2jHmbyn7NUg5 QJkA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=j89FWiVQ2yQq/nQekLvRdYGBW7YLNVqifzjY4RXk9h8=; b=iP1V9LMCqAzzw6tGla+X+q1lmtpjU5Fua6ycsuss5g/lQMs3VGbou+43Wh64dH2r3s druJWUuis3w6qXEls/mGD9N3ZDjuMkj5M7jdzKRELYld3l9aST3LcQakklXtz+Xah59k /yGna1lhYWRyUFevwwGgxnkeJmVn+lIzHjHk2eiBDqthQsWaFL67ZjGd8e36hD9c2aNL Ucaruo5+DQkOarJC4nr4Y13Oh40lp5BByG0KCwiPd6u+kJKQkGkVD+KKeJ1nFh1z/obl wAnNQaopT4MrR8wBaR7UGmD5lu1eGqMF2NcQCPggXc3ghEbGVVimVQvDGHPUmEZ9EGuj tCJA== X-Gm-Message-State: AOAM530JFbYPQdF4Wog57e07HgvBhF7ctT8+A2fqvc457aANr+PxaNol HepPjRNCcf6s80fgkUG6py8= X-Google-Smtp-Source: ABdhPJwzfnSfudGeJDFOQTmKRey+xsGJdPN464K/Gi5LuFT288xvOsntcqIhqHM5B6HqYk1Lr3uzhA== X-Received: by 2002:a2e:2a02:: with SMTP id q2mr11009404ljq.311.1590368533862; Sun, 24 May 2020 18:02:13 -0700 (PDT) Received: from sovereign (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id a17sm2013987lji.50.2020.05.24.18.02.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 May 2020 18:02:13 -0700 (PDT) Date: Mon, 25 May 2020 04:02:12 +0300 From: Dmitry Kozlyuk To: Tasnim Bashar Cc: dev@dpdk.org, harini.ramakrishnan@microsoft.com, pallavi.kadam@intel.com, ranjit.menon@intel.com, ocardona@microsoft.com, navasile@linux.microsoft.com, talshn@mellanox.com, fady@mellanox.com, ophirmu@mellanox.com, thomas@monjalon.net Message-ID: <20200525040212.3f5b262a@sovereign> In-Reply-To: <20200523072556.56564-1-tbashar@mellanox.com> References: <20200522001112> <20200523072556.56564-1-tbashar@mellanox.com> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v2] eal/windows: fix invalid thread handle 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Sat, 23 May 2020 00:25:56 -0700 Tasnim Bashar wrote: > Casting thread ID to handle is not accurate way to get thread handle. > Need to use OpenThread function to get thread handle from thread ID. > > pthread_setaffinity_np and pthread_getaffinity_np functions > for Windows are affected because of it. > > Signed-off-by: Tasnim Bashar > --- Please use --in-reply-to=Message-ID-of-previous-version to send v2, etc. If you're using Outlook, you can find message ID as follows: https://support.office.com/en-us/article/view-internet-message-headers-in-outlook-cd039382-dc6e-4264-ac74-c048563d212c For example, this is how this patch should have been sent: git send-email --in-reply-to=20200522001112.48932-1-tbashar@mellanox.com ... [snip] > + > /* set it back! */ > - SetThreadAffinityMask((HANDLE) threadid, dwprevaffinitymask); > + ret = SetThreadAffinityMask(thread_handle, dwprevaffinitymask); > + if (ret == 0) { > + RTE_LOG_WIN32_ERR("SetThreadAffinityMask()"); > + CloseHandle(thread_handle); > + return -1; > + } > *cpuset = dwprevaffinitymask; Getting a warning with MinGW-w64: In file included from ../../../../../lib/librte_eal/include/rte_eal.h:15, from ../../../../../lib/librte_eal/common/eal_common_options.c:24: ../../../../../lib/librte_eal/common/eal_common_options.c: In function 'eal_adjust_config': ../../../../../lib/librte_eal/windows/include/sched.h:63:40: warning: 'default_set' may be used uninitialized in this function [-Wmaybe-uninitialized] 63 | (dst)->_bits[_i] = (src1)->_bits[_i] & (src2)->_bits[_i]; \ | ^ ../../../../../lib/librte_eal/common/eal_common_options.c:1624:15: note: 'default_set' was declared here 1624 | rte_cpuset_t default_set; | ^~~~~~~~~~~ This is correct, because you only initialize first "long long" in rte_cpuset_t and not the second. Since we're trying not to introduce new warnings, the fix is as follows: memset(cpuset, 0, sizeof(rte_cpuset_t)); "sizeof(rte_cpuset_t)" requires and then it's probably worth using "rte_cpuset_t *" for instead of "long long *" for the parameter. -- Dmitry Kozlyuk