DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ranjit Menon <ranjit.menon@intel.com>
To: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>, <dev@dpdk.org>
Cc: Narcisa Ana Maria Vasile <navasile@linux.microsoft.com>,
	Pallavi Kadam <pallavi.kadam@intel.com>,
	Tal Shnaiderman <talshn@mellanox.com>
Subject: Re: [dpdk-dev] [PATCH] eal/windows: detect insufficient privileges for hugepages
Date: Tue, 7 Jul 2020 16:45:07 -0700
Message-ID: <4bcaa42f-1a72-b80e-8afa-327fddd7c7a2@intel.com> (raw)
In-Reply-To: <20200707202203.8780-1-dmitry.kozliuk@gmail.com>


On 7/7/2020 1:22 PM, Dmitry Kozlyuk wrote:
> AdjustTokenPrivileges() succeeds even if no requested privileges have
> been granted; this behavior is documented. Check last error code in
> addition to return value to detect such case.
>
> Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> ---
>   lib/librte_eal/windows/eal_hugepages.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/lib/librte_eal/windows/eal_hugepages.c b/lib/librte_eal/windows/eal_hugepages.c
> index 5779cd325..07a5467d0 100644
> --- a/lib/librte_eal/windows/eal_hugepages.c
> +++ b/lib/librte_eal/windows/eal_hugepages.c
> @@ -41,6 +41,10 @@ hugepage_claim_privilege(void)
>   		goto exit;
>   	}
>   
> +	/* AdjustTokenPrivileges() may succeed with ERROR_NOT_ALL_ASSIGNED. */
> +	if (GetLastError() != ERROR_SUCCESS)
> +		goto exit;
> +
>   	ret = 0;
>   
>   exit:

Wouldn't this be better if we could print a message here after 
explicitly checking for the ERROR_NOT_ALL_ASSIGNED return value?

Otherwise, the caller simply gets a -1 return value for a failure with 
no message.


ranjit m.


  reply	other threads:[~2020-07-07 23:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-07 20:22 Dmitry Kozlyuk
2020-07-07 23:45 ` Ranjit Menon [this message]
2020-07-08  0:20   ` Dmitry Kozlyuk
2020-07-08  6:43     ` Tal Shnaiderman
2020-07-08  7:49       ` Dmitry Kozlyuk
2020-07-08 21:48 ` [dpdk-dev] [PATCH v2] " Dmitry Kozlyuk
2020-07-08 22:27   ` Ranjit Menon
2020-07-10 21:25     ` 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=4bcaa42f-1a72-b80e-8afa-327fddd7c7a2@intel.com \
    --to=ranjit.menon@intel.com \
    --cc=dev@dpdk.org \
    --cc=dmitry.kozliuk@gmail.com \
    --cc=navasile@linux.microsoft.com \
    --cc=pallavi.kadam@intel.com \
    --cc=talshn@mellanox.com \
    /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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git