From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5D205A0546; Sat, 1 May 2021 01:05:13 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EA65B41127; Sat, 1 May 2021 01:05:12 +0200 (CEST) Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) by mails.dpdk.org (Postfix) with ESMTP id E12E94013F for ; Sat, 1 May 2021 01:05:11 +0200 (CEST) Received: by mail-lf1-f45.google.com with SMTP id 2so19760937lft.4 for ; Fri, 30 Apr 2021 16:05:11 -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=95hs+fxIt2JEm4WLUvbZIxp+Q0QgKCmcbKF+HrEILfY=; b=Ib79Za8++3SGOQWGVXMeC3SulAQY7+Ha2vYpuL5KZRDb9ueTVwoR7KumkH+9xVsfs5 JgrwLMPDKfAUpg0CA9AKDnRpMgftZrsLvNZX6WRebT20HaLXEm7Mm7bTO9DTx361o0xR +b/BtaxMAN+HF9nqHQG2LWDJR18kk3NOaR8zsxeQBb7a7qFDQCBAV9IZxXgB1nEfL5Fg S1qSI/w1ScR3lM5t+BWXKsUCptcfCq1JbvxzHpWrjtrLVjOLBuuKMbv5DqiJussqpMzO JA7woc6VY0GefWU8hf7koKpu1duOJ/WfLo18qet2Sam1pXoDV3xu04IJdswaQCVbiX0K tlrw== 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=95hs+fxIt2JEm4WLUvbZIxp+Q0QgKCmcbKF+HrEILfY=; b=g+q4gaSMi99Q1LN69QZ9CXpXKxit0F9txfOVkHSSo5VdlUFXmHHK2IXCA/mdadSS0U rCCviz4hQwnuROk670n8iZ3CMws5WeNkE8ZMouOMEWz6bP0cjEEdZi9gQfn0T35HO2IM kcDQh2OsTK2iivj0kTbUL1lo8/IDE1M8FGR8PGBoQvW/MrDIxUiwhWb96WPOTdocg8ub F/DqcR0yS8g+AMV0IRWJub3MZEg3Djn297zB54KkuAXH33jG0Wg3rbxePXwgPt5THuO5 D7VVwCW+N5uqyYyI2V0BqwTuPUte6BP17pGuMafO4l5E1gzm52C3OnILNxb8UE5oxSDl JijA== X-Gm-Message-State: AOAM533G6mjKgz9k3HHNBc/xVUoYs4kXw2d25T+ERqRADyu+OBpQH8ey MkIkTZ4gMi4m0D9k9upT1GU= X-Google-Smtp-Source: ABdhPJzVFbsB6j46tyyj71yFnUYRA/k4pmMA6BGXOaxI6sEp/zJ2qLekqa16Ep8cHAu+VbIJssMHpw== X-Received: by 2002:a05:6512:15d:: with SMTP id m29mr4858863lfo.515.1619823911587; Fri, 30 Apr 2021 16:05:11 -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 m17sm407176lfg.171.2021.04.30.16.05.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Apr 2021 16:05:10 -0700 (PDT) Date: Sat, 1 May 2021 02:05:09 +0300 From: Dmitry Kozlyuk To: Narcisa Ana Maria Vasile Cc: dev@dpdk.org, thomas@monjalon.net, khot@microsoft.com, navasile@microsoft.com, dmitrym@microsoft.com, roretzla@microsoft.com, talshn@nvidia.com, ocardona@microsoft.com, bruce.richardson@intel.com, david.marchand@redhat.com, pallavi.kadam@intel.com Message-ID: <20210501020509.670c9696@sovereign> In-Reply-To: <20210430023944.GA30300@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1617057640-24301-2-git-send-email-navasile@linux.microsoft.com> <1617413948-10504-1-git-send-email-navasile@linux.microsoft.com> <1617413948-10504-4-git-send-email-navasile@linux.microsoft.com> <20210429035038.40c9602f@sovereign> <20210430023944.GA30300@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> X-Mailer: Claws Mail 3.17.6 (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 v6 03/10] windows/eal: translate Windows errors to errno-style errors X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" 2021-04-29 19:39 (UTC-0700), Narcisa Ana Maria Vasile: > On Thu, Apr 29, 2021 at 03:50:38AM +0300, Dmitry Kozlyuk wrote: > > 2021-04-02 18:39 (UTC-0700), Narcisa Ana Maria Vasile: > > > From: Narcisa Vasile [...] > > > (*key)->thread_index = TlsAlloc(); > > > if ((*key)->thread_index == TLS_OUT_OF_INDEXES) { > > > RTE_LOG_WIN32_ERR("TlsAlloc()"); > > > free(*key); > > > - rte_errno = ENOEXEC; > > > - return -1; > > > + return rte_thread_translate_win32_error(); > > > > Logging above can overwrite GetLastError() value. > > I suggest splitting rte_thread_translate_win32_error() into translation part > > for cases when you have error number already, and a wrapper that calls > > GetLastError() to shorten calling code. > > > > Thanks Dmitry! I can split the translation function into something like: > static int rte_thread_translate_win32_error(DWORD error) { > switch(error) { > [...] > } > } > > static int get_error_and_translate(void) { > return rte_thread_translate_win32_error(GetLastError()); > } > > Is the above what you meant? > > Here, however, I don't think the wrapper over GetLastError() will be of much help, as > we still need to do something like: > if ((*key)->thread_index == TLS_OUT_OF_INDEXES) { > ret = GetLastError(); > RTE_LOG(DEBUG, EAL, "TlsAlloc() failed, GetLastError()=%lu: ", ret); > free(*key); > return rte_thread_translate_win32_error(ret); > } I'm afraid we don't have a choice, the logs with exact Win32 API call and its result is very handy for debugging. Patches 4/10 and 5/10 shorten it a bit.