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 C110BA00BE; Wed, 8 Jul 2020 01:45:14 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E241B1DE47; Wed, 8 Jul 2020 01:45:13 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 25C7A1DE3E for ; Wed, 8 Jul 2020 01:45:11 +0200 (CEST) IronPort-SDR: PyRFlDtF/f+woZC8h0wjSyGI4IryvedYqBiNcJG3s3zNlu2JzgTaRicxu6h3s8N2sqP4sWiaQX f0b7emH3paTg== X-IronPort-AV: E=McAfee;i="6000,8403,9675"; a="146778262" X-IronPort-AV: E=Sophos;i="5.75,325,1589266800"; d="scan'208";a="146778262" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jul 2020 16:45:10 -0700 IronPort-SDR: wcwkCf5BYGNW8uX0itWyTao9YFzyIJvcJo2rF6z6B+ByIbLQjNSZP5cDC0BDZFlZI161JLZDDo GCUaU/WaOiCw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,325,1589266800"; d="scan'208";a="266965690" Received: from orsmsx101.amr.corp.intel.com ([10.22.225.128]) by fmsmga007.fm.intel.com with ESMTP; 07 Jul 2020 16:45:10 -0700 Received: from [10.166.30.253] (10.166.30.253) by ORSMSX101.amr.corp.intel.com (10.22.225.128) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 7 Jul 2020 16:45:10 -0700 To: Dmitry Kozlyuk , CC: Narcisa Ana Maria Vasile , Pallavi Kadam , Tal Shnaiderman References: <20200707202203.8780-1-dmitry.kozliuk@gmail.com> From: Ranjit Menon Message-ID: <4bcaa42f-1a72-b80e-8afa-327fddd7c7a2@intel.com> Date: Tue, 7 Jul 2020 16:45:07 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200707202203.8780-1-dmitry.kozliuk@gmail.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [10.166.30.253] Subject: Re: [dpdk-dev] [PATCH] eal/windows: detect insufficient privileges for hugepages 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 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 > --- > 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.