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 828B0A0C5E; Sun, 15 Aug 2021 21:57:03 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EE7B440395; Sun, 15 Aug 2021 21:57:02 +0200 (CEST) Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) by mails.dpdk.org (Postfix) with ESMTP id 963094014F for ; Sun, 15 Aug 2021 21:57:01 +0200 (CEST) Received: by mail-lf1-f54.google.com with SMTP id i28so3665546lfl.2 for ; Sun, 15 Aug 2021 12:57:01 -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=b714jFBcskdvW3C8GjaZaxM9rMkHE/6jWDc1xIvvMgE=; b=bpt+dlqhmH+lJW+sTdiZGVDJ4iaAK/XNRAth0smYriGANeNSt3hsKl2MlinyLo8lm1 UmR8YVgb9Qy/KGMFGv9vjEGctI4CyqzVlr+ynQxlDwV4ekzqBDp6vZJtq3VpijXVXo8e jv9EC5Y1c8xnZYUOLSnl7StXHoG66b0fgaLme2IzN5VV1wWxGpYyUwnLspHjfpcL7EzF Wr5ODam0USlezvx7idXNqLDWxV+yFUuKPiSv00BIclMvsku9ZYflBNs/JOjYKiO/3S5f OXUZ6rSvx4VUYGjoY1BnJjZJAtxPAM3Qq+Swtter6L3AFaVpC5D8PzOHrLvvCX4u6XJ7 jfng== 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=b714jFBcskdvW3C8GjaZaxM9rMkHE/6jWDc1xIvvMgE=; b=H5q7h+D5EZudhRsuZ1i6zVmj+wLgKugIA++Pfj5/svkaoCYrH1CTPfPYF1OLMYxIv2 TjYVvuMDf5OQ3VLh0kqT0/S3YhAvhu5ZfbKw8twZxOF4xuI72kubeTAYMui3PiHjOIh/ L1cBQnNW10bx6EtKWbiShVp1GmsNY0T1SRLuO2+gYXkrVAZZqg5LdX+MjpJKwQ1MZh1U 2eAkhmqXpCmuKjatFxkD26/Epq6zIu3Vvr8k66CdW7al4jIKf2fkuP9rPp7ZUy1vFyLg s7bpHWrje1J+Lnzx3PWymNBRX4PHlZC2ZqbjkKGxcIIkrPRLdl8r34x/2SrzSAOdHmf0 WwJw== X-Gm-Message-State: AOAM532hyoZSRnB3oj2gRiS74Pa2KwtAkZNhcmt/Zg52N0kzyoN6cTVj 1hMgo+JwYh9BE22Bc2S5VZM= X-Google-Smtp-Source: ABdhPJy2XubmksDDXlXWT75W+hGxHgDoTM2BWVi3rPt8QLU2JuRluI+fxlNVMIir+GSPAvYueBH7LA== X-Received: by 2002:a05:6512:e9a:: with SMTP id bi26mr9172016lfb.282.1629057421049; Sun, 15 Aug 2021 12:57:01 -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 q8sm943681ljj.76.2021.08.15.12.56.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Aug 2021 12:57:00 -0700 (PDT) Date: Sun, 15 Aug 2021 22:56:59 +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: <20210815225659.6646d969@sovereign> In-Reply-To: <1628017291-3756-10-git-send-email-navasile@linux.microsoft.com> References: <1627925546-29982-1-git-send-email-navasile@linux.microsoft.com> <1628017291-3756-1-git-send-email-navasile@linux.microsoft.com> <1628017291-3756-10-git-send-email-navasile@linux.microsoft.com> X-Mailer: Claws Mail 3.17.8 (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 v13 09/10] eal: add EAL argument for setting thread priority 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-08-03 12:01 (UTC-0700), Narcisa Ana Maria Vasile: > From: Narcisa Vasile > > Allow the user to choose the thread priority through an EAL > command line argument. EAL options documentation update is needed. With current wording the user may ask: the priority of which thread? > The user can choose thread priority through an EAL parameter, > when starting an application. If EAL parameter is not used, > the per-platform default value for thread priority is used. > Otherwise administrator has an option to set one of available options: > --thread-prio normal > --thread-prio realtime > > Example: > ./dpdk-l2fwd -l 0-3 -n 4 --thread-prio normal -- -q 8 -p ffff IIUC, with this patch --thread-prio affects nothing, because the value it fills is not used anywhere. Why is it needed in this patchset then? > > Signed-off-by: Narcisa Vasile > --- > lib/eal/common/eal_common_options.c | 28 +++++++++++++++++++++++++++- > lib/eal/common/eal_internal_cfg.h | 2 ++ > lib/eal/common/eal_options.h | 2 ++ > 3 files changed, 31 insertions(+), 1 deletion(-) > > diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c > index ff5861b5f3..9d29696b84 100644 > --- a/lib/eal/common/eal_common_options.c > +++ b/lib/eal/common/eal_common_options.c > @@ -107,6 +107,7 @@ eal_long_options[] = { > {OPT_TELEMETRY, 0, NULL, OPT_TELEMETRY_NUM }, > {OPT_NO_TELEMETRY, 0, NULL, OPT_NO_TELEMETRY_NUM }, > {OPT_FORCE_MAX_SIMD_BITWIDTH, 1, NULL, OPT_FORCE_MAX_SIMD_BITWIDTH_NUM}, > + {OPT_THREAD_PRIORITY, 1, NULL, OPT_THREAD_PRIORITY_NUM}, > > /* legacy options that will be removed in future */ > {OPT_PCI_BLACKLIST, 1, NULL, OPT_PCI_BLACKLIST_NUM }, > @@ -1412,6 +1413,24 @@ eal_parse_simd_bitwidth(const char *arg) > return 0; > } > > +static int > +eal_parse_thread_priority(const char *arg) > +{ > + struct internal_config *internal_conf = > + eal_get_internal_configuration(); > + enum rte_thread_priority priority; > + > + if (!strncmp("normal", arg, sizeof("normal"))) > + priority = RTE_THREAD_PRIORITY_NORMAL; > + else if (!strncmp("realtime", arg, sizeof("realtime"))) > + priority = RTE_THREAD_PRIORITY_REALTIME_CRITICAL; > + else > + return -1; Why not just `strcmp()`? > + > + internal_conf->thread_priority = priority; > + return 0; > +} > + > static int > eal_parse_base_virtaddr(const char *arg) > { > @@ -1825,7 +1844,13 @@ eal_parse_common_option(int opt, const char *optarg, > return -1; > } > break; > - > + case OPT_THREAD_PRIORITY_NUM: > + if (eal_parse_thread_priority(optarg) < 0) { > + RTE_LOG(ERR, EAL, "invalid parameter for --" > + OPT_THREAD_PRIORITY "\n"); > + return -1; > + } > + break; > /* don't know what to do, leave this to caller */ > default: > return 1; > @@ -2088,6 +2113,7 @@ eal_common_usage(void) > " (can be used multiple times)\n" > " --"OPT_VMWARE_TSC_MAP" Use VMware TSC map instead of native RDTSC\n" > " --"OPT_PROC_TYPE" Type of this process (primary|secondary|auto)\n" > + " --"OPT_THREAD_PRIORITY" Set threads priority (normal|realtime)\n" > #ifndef RTE_EXEC_ENV_WINDOWS > " --"OPT_SYSLOG" Set syslog facility\n" > #endif > diff --git a/lib/eal/common/eal_internal_cfg.h b/lib/eal/common/eal_internal_cfg.h > index d6c0470eb8..b2996cd65b 100644 > --- a/lib/eal/common/eal_internal_cfg.h > +++ b/lib/eal/common/eal_internal_cfg.h > @@ -94,6 +94,8 @@ struct internal_config { > unsigned int no_telemetry; /**< true to disable Telemetry */ > struct simd_bitwidth max_simd_bitwidth; > /**< max simd bitwidth path to use */ > + enum rte_thread_priority thread_priority; > + /**< thread priority to configure */ Where is the default set? If you remove RTE_THREAD_PRIORITY_UNDEFINED in patch 2/10, it will be RTE_THREAD_PRIORITY_NORMAL in zeroed-out structure, which is OK. > }; > > void eal_reset_internal_config(struct internal_config *internal_cfg); > diff --git a/lib/eal/common/eal_options.h b/lib/eal/common/eal_options.h > index 7b348e707f..9f5b209f64 100644 > --- a/lib/eal/common/eal_options.h > +++ b/lib/eal/common/eal_options.h > @@ -93,6 +93,8 @@ enum { > OPT_NO_TELEMETRY_NUM, > #define OPT_FORCE_MAX_SIMD_BITWIDTH "force-max-simd-bitwidth" > OPT_FORCE_MAX_SIMD_BITWIDTH_NUM, > +#define OPT_THREAD_PRIORITY "thread-prio" > + OPT_THREAD_PRIORITY_NUM, > > /* legacy option that will be removed in future */ > #define OPT_PCI_BLACKLIST "pci-blacklist"