DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
To: Tasnim Bashar <tbashar@mellanox.com>
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
Subject: Re: [dpdk-dev] [PATCH v2] eal/windows: fix invalid thread handle
Date: Mon, 25 May 2020 04:02:12 +0300	[thread overview]
Message-ID: <20200525040212.3f5b262a@sovereign> (raw)
In-Reply-To: <20200523072556.56564-1-tbashar@mellanox.com>

On Sat, 23 May 2020 00:25:56 -0700
Tasnim Bashar <tbashar@mellanox.com> 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 <tbashar@mellanox.com>
> ---

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 <sched.h> and then it's probably worth using
"rte_cpuset_t *" for instead of "long long *" for the parameter.

-- 
Dmitry Kozlyuk

  reply	other threads:[~2020-05-25  1:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200522001112>
2020-05-23  7:25 ` Tasnim Bashar
2020-05-25  1:02   ` Dmitry Kozlyuk [this message]
2020-05-25  6:59     ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200525040212.3f5b262a@sovereign \
    --to=dmitry.kozliuk@gmail.com \
    --cc=dev@dpdk.org \
    --cc=fady@mellanox.com \
    --cc=harini.ramakrishnan@microsoft.com \
    --cc=navasile@linux.microsoft.com \
    --cc=ocardona@microsoft.com \
    --cc=ophirmu@mellanox.com \
    --cc=pallavi.kadam@intel.com \
    --cc=ranjit.menon@intel.com \
    --cc=talshn@mellanox.com \
    --cc=tbashar@mellanox.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).