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 DF50AA00BE; Wed, 8 Jul 2020 02:20:37 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D0AF41D9C4; Wed, 8 Jul 2020 02:20:35 +0200 (CEST) Received: from mail-lf1-f68.google.com (mail-lf1-f68.google.com [209.85.167.68]) by dpdk.org (Postfix) with ESMTP id D6E0A1D989 for ; Wed, 8 Jul 2020 02:20:34 +0200 (CEST) Received: by mail-lf1-f68.google.com with SMTP id k15so25829403lfc.4 for ; Tue, 07 Jul 2020 17:20:34 -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=QtwvsG0trU46lh+7SNGK+KiULjWqJXKpz6EI2b2Fo8A=; b=nLCXL2hEox2M0xdUIPggvLPtxRMoGvCiVZ3BQiqflmqyU8D1MBOJk3RIRoXLT9MlUC NpaIaBaw9mSU3p69X+Tfo1nhaE6lzxMgEhMyoXlhAz7eRDwYhyafVAPVFOohlvbG5ZSR YzNdj2lRkS+JUOnDCHaCPVKlmhF3ZBCfWqix5Om/DO0DuA51uoaULJd2rEvMVQOXJheG lmPyQRWFGBL4B7L6o56V4oV0vY8dq9CX5XXSvRgUu9ZSlMGHJSW0jg9G1/mH6XbJwxaq q0N5qoghaxSplsA25jh36v8JpkXZiM9gBtsGzxHzco6zbmjHyS1hE0FlM/f4z1znP32d ZK8g== 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=QtwvsG0trU46lh+7SNGK+KiULjWqJXKpz6EI2b2Fo8A=; b=IbMIJUI20SSRCcKDfG8Zg64vwmqpOpPcHTwGNJbLYGz8Qpv2EOycIRLf5FrlpnOErZ yELkgeFfDntBF81QffapFR5Q0Fy/cNIRg27sGzJyIFgs70cDZ23gRq0RW0ZZLbu36L7f 4MYD6dgjQ2uJFL+v4DDh1jFZPa4Evu83Eux7yHk8r/qyx0AQ/sU9XKn3anrXd70IdOK+ dA1uKeVm+CwgsAbtmW/MNKBnMoBfTT06pqjooV2ETCgd6oyDI09CSSQTj5PMgjScy862 r+PLS0JHInG/JpNKJWXSWKeprkDXS7imJRZiAW3+2DZkt1lTqYN5cgW1Ur1n4VSYZ0RZ FtmA== X-Gm-Message-State: AOAM532ukagIrN14snkGJOyNuvWFg2bBjwuEcs8WA3Rr7kp0iKBObhRH swo9809R0MI9Txe3yRaOlXo= X-Google-Smtp-Source: ABdhPJxhzHouxhnR1ji0n6tJ4lzWmpWeVlNMBKW5VzBMLxoJD0gS0vSPtKJB8lGli5StEqOAB5PMdA== X-Received: by 2002:ac2:46f0:: with SMTP id q16mr34708677lfo.51.1594167634202; Tue, 07 Jul 2020 17:20:34 -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 p1sm496057lji.93.2020.07.07.17.20.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jul 2020 17:20:33 -0700 (PDT) Date: Wed, 8 Jul 2020 03:20:31 +0300 From: Dmitry Kozlyuk To: Ranjit Menon Cc: , Narcisa Ana Maria Vasile , Pallavi Kadam , Tal Shnaiderman Message-ID: <20200708032031.2ceaca0b@sovereign> In-Reply-To: <4bcaa42f-1a72-b80e-8afa-327fddd7c7a2@intel.com> References: <20200707202203.8780-1-dmitry.kozliuk@gmail.com> <4bcaa42f-1a72-b80e-8afa-327fddd7c7a2@intel.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] 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 Tue, 7 Jul 2020 16:45:07 -0700, Ranjit Menon wrote: > 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. Message is printed at ERR level by the caller. There's no context to add here. -- Dmitry Kozlyuk