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 8CD1BA0544; Fri, 23 Sep 2022 15:13:43 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3C82B4003F; Fri, 23 Sep 2022 15:13:43 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id CFD1E4003C for ; Fri, 23 Sep 2022 15:13:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663938821; x=1695474821; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=XbkDrjMk5Ho1kRfQS5kJ3/oRoP4VFCSmgh4lx2O52Q4=; b=HWy6mJBSqvbyH/2U18ogMtlwUlNFxDr4Rf9+lm49V6VOD6qpNuh8NcOZ qvhD90K5o+t1dx627KE972ofWMnccJPt0WlCzjndfnQAkOAUJlx6LcnHy eEve2oc2KAi3P23gykHBF3l1jav/4QzZtrPC4lWw6EoVlKFzGROAKbQJd 9GjpioXJ1HgFygKRN7kOq053+YTcmXYSKkhKk7CVfKpJgLo+8S4FQKNUN DtE5w+oMf5j8yrngl3grGG/3nk3T95wFCzyrgTrWiUxDgSsiuiZDyzEcx jkrIH9eAYwX4NLRDDGYdvUWIgTu+u2S5FPqpDPV0yQlkT314XQg+GLTxh A==; X-IronPort-AV: E=McAfee;i="6500,9779,10479"; a="283685877" X-IronPort-AV: E=Sophos;i="5.93,339,1654585200"; d="scan'208";a="283685877" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2022 06:13:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,339,1654585200"; d="scan'208";a="745791753" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by orsmga004.jf.intel.com with ESMTP; 23 Sep 2022 06:13:39 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 23 Sep 2022 06:13:39 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 23 Sep 2022 06:13:38 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Fri, 23 Sep 2022 06:13:38 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.106) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Fri, 23 Sep 2022 06:13:38 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Oa/uR7JTDf06DQdkKHjRua3WDCmbAHuRFWNBYgR3aSh+aJNzfeQPPvUhTGcg8MkWWtTkfztz+6L0RQj8FmXO1vHcwpIh8/j6O6OornNErYq6QArn9eD+7BsmyJvSoCe6tJkBE/m0YBNXadapzgnWbgKrLDzewEoUfw+ncItS0WrMegLtLMXCMbwo+X1oR6onFyv6x+q/S5PMuyZLmIFBM364VDjVO8llG5e049XIu4hIeaVOQZdgy0ipYrJKRKbOjpdHQLSz2LXdX2ho+42DGbP8Wu5GtZnoEFKSxlk6BfmZoupzegX8x9THjmIaGa3xnGTJ17uwh7c4V204IcxIUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2ycKrtSKjGcbqgRG7dNdCh5CGPATWrtH9Dr+AGccHr0=; b=n6ZcE8/7GuCTkh+JNmqUINP6AUz4GAq4NbCWfpbqjdWvgaWmt6xhUokVDLe1Jbx0Wnak/OeVcbmqClWMETO9uSkO586ad4eTHV9WWGNi0Id02SI9WgPc0JDGDqpFR+lXytmV+5PoDcFdI6fU7YfwRaffMWofYAi++/xae+0BqXu9KV1w63tWT9nGhLnGyvMmtRy0bPYykI3V2v69ELvEo1rCMTmjAk0h/8GSHod7Xp2rmHfFCb0M/C+u+k7E1oGXlUzCP40tViKNaSpHjG2zbbbX4uN9rrrMiTcnzGyhgap+N3DbXSwJT2wMeIj2l+hsOeO1nGaws0YRE9NjY/23kw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from BYAPR11MB3799.namprd11.prod.outlook.com (2603:10b6:a03:fb::19) by SJ0PR11MB5119.namprd11.prod.outlook.com (2603:10b6:a03:2d6::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.21; Fri, 23 Sep 2022 13:13:37 +0000 Received: from BYAPR11MB3799.namprd11.prod.outlook.com ([fe80::1331:f80e:20cb:3546]) by BYAPR11MB3799.namprd11.prod.outlook.com ([fe80::1331:f80e:20cb:3546%5]) with mapi id 15.20.5654.019; Fri, 23 Sep 2022 13:13:37 +0000 Message-ID: <5cf9a7b3-2060-cb88-95da-0fe9cf1b3b74@intel.com> Date: Fri, 23 Sep 2022 14:13:31 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 Subject: Re: [PATCH v4 2/3] l3fwd-power: add option to call uncore API Content-Language: en-US To: Tadhg Kearney , CC: , References: <20220920094822.1403168-1-tadhg.kearney@intel.com> <20220920094822.1403168-3-tadhg.kearney@intel.com> From: "Hunt, David" In-Reply-To: <20220920094822.1403168-3-tadhg.kearney@intel.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0434.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1a9::7) To BYAPR11MB3799.namprd11.prod.outlook.com (2603:10b6:a03:fb::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR11MB3799:EE_|SJ0PR11MB5119:EE_ X-MS-Office365-Filtering-Correlation-Id: f2b63e59-ec4b-41df-9164-08da9d656cac X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LrspQSPrR5wJr7+Nmia5Mdef8q4CMvHkDQpQVo+dqiPGq/7GL4kqhPbxYIaxkNGxP7hjnFLHg83xWCwTIoUYrCeKqXQvxVYiegjKV9ZAiJxd/fD6IVQco581RsyThWLj9hhqG1SUxvqGv+YExeA083/LzERq+d2ROadt4/AqI6rf2ri6/Jdjon5/L2DGF3SF/Pry47r11MXLFTD/4bPFAho/C0wYi/TMIz8rWitATimRYvTqB41f4SqvIAoRLdnh2BGVe28u1OiTtH5FuK0c5qQt/PK+wOiPj4Y2MQRPxK1fjXmbicB6gi6ylERxWyE4zDQQeHah7yUcOi/u2M8zq7ReT2HiXJDorg/VtsfJRUnPMqjEGWoWJFZYC/pIwvL8dShoFdp4lzvd05q9/cHbi+F4OfjO0cvkJ2o/fxNNV4hGHKlGM8lzwjhl7nfYF/t7kxHpVIfyEA1WTNE9fEHTkA7XyXwja7p9ahZqOnTucOgGMLUeGp/z3BOqb2ZV9PYYqu3rGD4NDx0erUGfmZQXMgS6oGr98Qu5UKh0BgoPe7wSbNZTUWlBV1r5an7x8z3eIs09oUAJd+5/pzm+32n8mzt/bAZsMqAZ1Zbug3ugUrGzVPAKYPDlu3NCGzzsfgaxrvoEFyMK50ttPty6CWcA1Daudx4WW9tM80Rn5zKbaG/yYQCBVz+J74hujEBT5bxSjBj1NQg2lq+kn2ja+FOU1LIVCoxW7tUN2qbwitzOlr7hUsnnH8lk7+mEsiBeuNlf6dbr3gs/8umwIRQJVL63xBaxlLLmPJzyyTbs/E+l+PEti3Mh+sv8aU1o2LqcKiPv X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR11MB3799.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(366004)(396003)(376002)(346002)(39860400002)(136003)(451199015)(38100700002)(6506007)(82960400001)(478600001)(6486002)(8676002)(316002)(26005)(83380400001)(6666004)(53546011)(2906002)(186003)(107886003)(5660300002)(4326008)(66476007)(6512007)(66946007)(8936002)(41300700001)(2616005)(66556008)(36756003)(31696002)(31686004)(86362001)(32563001)(43740500002)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?WlFiaVpadXkrN29BR2hVZ1pBMUJXb1NqVWdBazVsYjdqV3BSUDBnd2R1eXlu?= =?utf-8?B?YVJuelc2SVRmV3E2R0ViNkc2SWVRNDk3b1g4TWtlZWRrdjFTaTlSeU5SYm1t?= =?utf-8?B?dDAxL3ZzbjRMTHRBbEJ3QVNRc1A3eitnR2FJKzZFM1VzbnV5L1dtdWI4M0NQ?= =?utf-8?B?QTNlaFJRa3ps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Ja?= =?utf-8?B?SDBJb3lXUStXSGhUR1NEVjFGV3YrYStjbkZ2QmxrRWExUUp1aUFDVjlhWXVJ?= =?utf-8?B?VVpSMklTeDVyZEprd0pRc1c5N3FVZjhVL1p5MXgrODRma1hBWkFzTm4wYnlS?= =?utf-8?B?ck9jM0VGNjF0NG1LNjBRR0tpRWR4YTRZR3cyUkx0ZTVmRGxSWFFYaWliMWxW?= =?utf-8?B?ZGc9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: f2b63e59-ec4b-41df-9164-08da9d656cac X-MS-Exchange-CrossTenant-AuthSource: BYAPR11MB3799.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2022 13:13:36.9509 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Xq63rTSG06Von/KwvRosorA44I+WIlQ6AaLsRGPBVJuR2s7pDNejJD3oCOFNuJmetIhbXFZnQrDQB0KmsnE3BA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB5119 X-OriginatorOrg: intel.com 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 On 20/09/2022 10:48, Tadhg Kearney wrote: > Add option for setting uncore frequency min/max/index, through uncore API. > This will be set for each package and die on the SKU. On exit, uncore min > and max frequency will be reverted back to previous frequencies. > > Signed-off-by: Tadhg Kearney > --- > .../sample_app_ug/l3_forward_power_man.rst | 29 +++++ > examples/l3fwd-power/main.c | 122 +++++++++++++++++- > 2 files changed, 148 insertions(+), 3 deletions(-) > > diff --git a/doc/guides/sample_app_ug/l3_forward_power_man.rst b/doc/guides/sample_app_ug/l3_forward_power_man.rst > index 8f6d906200..08ac8ef369 100644 > --- a/doc/guides/sample_app_ug/l3_forward_power_man.rst > +++ b/doc/guides/sample_app_ug/l3_forward_power_man.rst > @@ -97,6 +97,12 @@ where, > * -P: Sets all ports to promiscuous mode so that packets are accepted regardless of the packet's Ethernet MAC destination address. > Without this option, only packets with the Ethernet MAC destination address set to the Ethernet address of the port are accepted. > > +* -u: optional, sets uncore min/max frequency to minimum value. > + > +* -U: optional, sets uncore min/max frequency to maximum value. > + > +* -i (frequency index): optional, sets uncore frequency to frequency index value, by setting min and max values to be the same. > + > * --config (port,queue,lcore)[,(port,queue,lcore)]: determines which queues from which ports are mapped to which cores. > > * --max-pkt-len: optional, maximum packet length in decimal (64-9600) > @@ -364,3 +370,26 @@ in the DPDK Programmer's Guide for more details on PMD power management. > .. code-block:: console > > .//examples/dpdk-l3fwd-power -l 1-3 -- -p 0x0f --config="(0,0,2),(0,1,3)" --pmd-mgmt=scale > + > +Setting Uncore Values > +--------------------- > + > +Uncore frequency can be adjusted through manipulating related sysfs entries to adjust the minimum and maximum uncore values. > +This will be set for each package and die on the SKU. The driver for enabling this is available from kernel version 5.6 and above. > +Three options are available for setting uncore frequency: > + > +``-u`` > + This will set uncore minimum and maximum frequencies to minimum possible value. > + > +``-U`` > + This will set uncore minimum and maximum frequencies to maximum possible value. > + > +``-i`` > + This will allow you to set the specific uncore frequency index that you want, by setting > + the uncore frequency to a frequency pointed by index. Frequency index's are set 100MHz apart from > + maximum to minimum. > + Frequency index values are in descending order, ie, index 0 is maximum frequency index. > + > +.. code-block:: console > + > + .//examples/dpdk-l3fwd-power -l 1-3 -- -p 0x0f --config="(0,0,2),(0,1,3)" -i 1 > diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c > index 887c6eae3f..d1a32594c0 100644 > --- a/examples/l3fwd-power/main.c > +++ b/examples/l3fwd-power/main.c > @@ -47,6 +47,7 @@ > #include > #include > #include > +#include > > #include "perf_core.h" > #include "main.h" > @@ -179,6 +180,12 @@ enum busy_rate { > FULL = 100 > }; > > +enum uncore_choice { > + UNCORE_MIN = 0, > + UNCORE_MAX = 1, > + UNCORE_IDX = 2 > +}; > + > /* reference poll count to measure core busyness */ > #define DEFAULT_COUNT 10000 > /* > @@ -1616,6 +1623,9 @@ print_usage(const char *prgname) > " [--max-pkt-len PKTLEN]\n" > " -p PORTMASK: hexadecimal bitmask of ports to configure\n" > " -P: enable promiscuous mode\n" > + " -u: set min/max frequency for uncore to minimum value\n" > + " -U: set min/max frequency for uncore to maximum value\n" > + " -i (frequency index): set min/max frequency for uncore to specified frequency index\n" > " --config (port,queue,lcore): rx queues configuration\n" > " --high-perf-cores CORELIST: list of high performance cores\n" > " --perf-config: similar as config, cores specified as indices" > @@ -1672,6 +1682,74 @@ static int parse_max_pkt_len(const char *pktlen) > return len; > } > > +static int > +parse_uncore_options(enum uncore_choice choice, const char *argument) > +{ > + unsigned int die, pkg, max_pkg, max_die; > + int ret = 0; > + max_pkg = rte_power_uncore_get_num_pkgs(); > + if (max_pkg == 0) > + return -1; > + > + for (pkg = 0; pkg < max_pkg; pkg++) { > + max_die = rte_power_uncore_get_num_dies(pkg); > + if (max_die == 0) > + return -1; > + for (die = 0; die < max_die; die++) { > + ret = rte_power_uncore_init(pkg, die); > + if (ret == -1) { > + RTE_LOG(INFO, L3FWD_POWER, "Unable to initialize uncore for pkg %02u die %02u\n" > + , pkg, die); > + return ret; > + } > + if (choice == UNCORE_MIN) { > + ret = rte_power_uncore_freq_min(pkg, die); > + if (ret == -1) { > + RTE_LOG(INFO, L3FWD_POWER, > + "Unable to set the uncore min/max to minimum uncore frequency value for pkg %02u die %02u\n" > + , pkg, die); > + return ret; > + } > + } else if (choice == UNCORE_MAX) { > + ret = rte_power_uncore_freq_max(pkg, die); > + if (ret == -1) { > + RTE_LOG(INFO, L3FWD_POWER, > + "Unable to set uncore min/max to maximum uncore frequency value for pkg %02u die %02u\n" > + , pkg, die); > + return ret; > + } > + } else if (choice == UNCORE_IDX) { > + char *ptr = NULL; > + int frequency_index = strtol(argument, &ptr, 10); > + if (argument == ptr) { > + RTE_LOG(INFO, L3FWD_POWER, "Index given is not a valid number."); > + return -1; > + } > + int freq_array_len = rte_power_uncore_get_num_freqs(pkg, die); > + if (frequency_index > freq_array_len - 1) { > + RTE_LOG(INFO, L3FWD_POWER, > + "Frequency index given out of range, please choose a value from 0 to %d.\n", > + freq_array_len); > + return -1; > + } > + ret = rte_power_set_uncore_freq(pkg, die, frequency_index); > + if (ret == -1) { > + RTE_LOG(INFO, L3FWD_POWER, > + "Unable to set min/max uncore index value for pkg %02u die %02u\n", > + pkg, die); > + return ret; > + } > + } else { > + RTE_LOG(INFO, L3FWD_POWER, "Uncore choice provided invalid\n"); > + return -1; > + } > + } > + } > + > + RTE_LOG(INFO, L3FWD_POWER, "Successfully set max/min/index uncore frequency.\n"); > + return ret; > +} > + > static int > parse_portmask(const char *portmask) > { > @@ -1838,7 +1916,7 @@ parse_ep_config(const char *q_arg) > static int > parse_args(int argc, char **argv) > { > - int opt, ret; > + int opt, ret, enabled_uncore = 0; > char **argvopt; > int option_index; > uint32_t limit; > @@ -1864,7 +1942,7 @@ parse_args(int argc, char **argv) > > argvopt = argv; > > - while ((opt = getopt_long(argc, argvopt, "p:l:m:h:P", > + while ((opt = getopt_long(argc, argvopt, "p:l:m:h:P:uUi:", > lgopts, &option_index)) != EOF) { > > switch (opt) { > @@ -1893,6 +1971,27 @@ parse_args(int argc, char **argv) > limit = parse_max_pkt_len(optarg); > freq_tlb[HGH] = limit; > break; > + case 'u': > + enabled_uncore = parse_uncore_options(UNCORE_MIN, NULL); > + if (enabled_uncore < 0) { > + print_usage(prgname); > + return -1; > + } > + break; > + case 'U': > + enabled_uncore = parse_uncore_options(UNCORE_MAX, NULL); > + if (enabled_uncore < 0) { > + print_usage(prgname); > + return -1; > + } > + break; > + case 'i': > + enabled_uncore = parse_uncore_options(UNCORE_IDX, optarg); > + if (enabled_uncore < 0) { > + print_usage(prgname); > + return -1; > + } > + break; > /* long options */ > case 0: > if (!strncmp(lgopts[option_index].name, "config", 6)) { > @@ -2364,7 +2463,7 @@ init_power_library(void) > static int > deinit_power_library(void) > { > - unsigned int lcore_id; > + unsigned int lcore_id, max_pkg, max_die, die, pkg; > int ret = 0; > > RTE_LCORE_FOREACH(lcore_id) { > @@ -2377,6 +2476,23 @@ deinit_power_library(void) > return ret; > } > } > + > + max_pkg = rte_power_uncore_get_num_pkgs(); > + if (max_pkg == 0) > + return -1; > + for (pkg = 0; pkg < max_pkg; pkg++) { > + max_die = rte_power_uncore_get_num_dies(pkg); > + if (max_die == 0) > + return -1; > + for (die = 0; die < max_die; die++) { > + ret = rte_power_uncore_exit(pkg, die); > + if (ret < 0) { > + RTE_LOG(ERR, L3FWD_POWER, "Failed to exit uncore deninit successfully for pkg %02u die %02u\n" > + , pkg, die); > + return -1; > + } > + } > + } > return ret; > } > Thanks Tadhg. I've also tested this and it sets the uncore frequencies as expected with the -U, -u and -i options. Reviewed-by: David Hunt