From: Dmitry Kozlyuk Date: Wed, 8 Jul 2020 21:48:43 +0000 (+0300) Subject: eal/windows: detect insufficient privileges for hugepages X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=7daf5bdb0f77485e719dbecad0ae508b6195ffb0;p=dpdk.git eal/windows: detect insufficient privileges for hugepages 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. Make error messages more specific and add troubleshooting hint. Signed-off-by: Dmitry Kozlyuk Acked-by: Ranjit Menon --- diff --git a/lib/librte_eal/windows/eal_hugepages.c b/lib/librte_eal/windows/eal_hugepages.c index 5779cd325d..44dae985e5 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: @@ -98,12 +102,13 @@ int eal_hugepage_info_init(void) { if (hugepage_claim_privilege() < 0) { - RTE_LOG(ERR, EAL, "Cannot claim hugepage privilege\n"); + RTE_LOG(ERR, EAL, "Cannot claim hugepage privilege\n" + "Verify that large-page support privilege is assigned to the current user\n"); return -1; } if (hugepage_info_init() < 0) { - RTE_LOG(ERR, EAL, "Cannot get hugepage information\n"); + RTE_LOG(ERR, EAL, "Cannot discover available hugepages\n"); return -1; }