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 EB629A00C4; Wed, 28 Sep 2022 14:18:52 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8EB5F4113D; Wed, 28 Sep 2022 14:18:52 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 0E3B24113C for ; Wed, 28 Sep 2022 14:18:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664367531; x=1695903531; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=JxOMhNLa+rVbGSV7TnKSF143lVPa6j6ifS6+ZMbEorI=; b=jLbz9nd0nTnMmpQ9VBR9BMD5ul8kRmJlKLlRFSvW2j4f9uFZC1kJ8HrS CmFeTxqz/x8MEjEQ23xm45OqhuANG8LO9HKa6nhxyVEcPCkUBG173vEuP 93JutcYtMQ9l+ih2bEzYGQOouGYYqgBKC3j4pmVNJQVbZAnoY0MPkMAsj yigDPJYQ+6CSsIE848wt1ANsaxbKtPcQCPy1oNR8nAZmkVwGRwi+jzCRI Su6zdDtecA+hrHFGSb3ofgThZox5pnA2Fl0DXz0WL+SJu2X0iBXEdrkio K5pEUX6pu5bURMGrruEbVSh3SCvluIJTBbSXEPHhXp/KjuiF4Y6Dwax0I w==; X-IronPort-AV: E=McAfee;i="6500,9779,10483"; a="281302870" X-IronPort-AV: E=Sophos;i="5.93,352,1654585200"; d="scan'208";a="281302870" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2022 05:18:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10483"; a="684385450" X-IronPort-AV: E=Sophos;i="5.93,352,1654585200"; d="scan'208";a="684385450" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmsmga008.fm.intel.com with ESMTP; 28 Sep 2022 05:18:49 -0700 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) 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; Wed, 28 Sep 2022 05:18:49 -0700 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx607.amr.corp.intel.com (10.18.126.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 28 Sep 2022 05:18:49 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Wed, 28 Sep 2022 05:18:49 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.168) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Wed, 28 Sep 2022 05:18:48 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ULK6KQKbi39RVsNmo3+jOTQIEx+XjXwX2zsqDR+LJWyCTFuep1wK3AqcJ4K17fZM5aKvV8rcLhW95Bjy/1SJvXP83waW2sREMb860z/tlkRDGTXWHCVBZkFTuUcAhtKZbY5oj39J/7QPgnUH8Lyk66xExQI+nYyySr1R20CkXiZCeHVua9xGRRY26oHKXdEa02A5dR6/pdl1MOC0Lt7L7o4Ds0P2mEFVvg1OcuGikbxpYIfMGptaNWg8PhVY9xid/B/g1rrzfwQ7kp/IyxEp9ZzyGASEwpH0P9WmE7DU9sm5p6b1BbiItuA1SaJnNxm4JMhiV36jkd+6vpgZb/Wmvw== 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=Fux+P6I/E4b12OkNPBuIe0X6vG9yb8xc1MkKbg7tnM0=; b=Yk0KkQbRn11LfiXiPAPGaDAwGITGm3K6Vg/8Dx3g+gcWx1r5lFcQLsk92pkmUbYx2Q9a70b8hAoaxr1O8T1PPDQNrH2hJ4tiAMSGlZhjpRxTQbjkwO5E2UfHIik4fx1bW4wC+pl3e57dhge2mdAiOXcwgTirSeRbeTC10MgUIJuaqn/vFCYF2/TfMgDyYFdZBOTKCQDm/PYviUnd2PPUSrSKW+CzSP2eFHt4JN9BLBCh4f1KZZXu0PRha4pEu3EKh52HcM5npu4pedmfN7V1P8je+b5gl/tnwOmghReEe7XovvXdwBL0Oz93s05r0xrR/ycUJNeSjBUYPEPol67JYQ== 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 BN9PR11MB5258.namprd11.prod.outlook.com (2603:10b6:408:133::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.26; Wed, 28 Sep 2022 12:18:42 +0000 Received: from BYAPR11MB3799.namprd11.prod.outlook.com ([fe80::2a3b:7b9f:8bce:711f]) by BYAPR11MB3799.namprd11.prod.outlook.com ([fe80::2a3b:7b9f:8bce:711f%4]) with mapi id 15.20.5654.025; Wed, 28 Sep 2022 12:18:42 +0000 Message-ID: Date: Wed, 28 Sep 2022 13:18:37 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.13.1 Subject: Re: [PATCH v6 2/3] l3fwd-power: add option to call uncore API Content-Language: en-US To: Tadhg Kearney , CC: , References: <20220927100905.1505722-1-tadhg.kearney@intel.com> <20220928090636.1580647-1-tadhg.kearney@intel.com> <20220928090636.1580647-3-tadhg.kearney@intel.com> From: "Hunt, David" In-Reply-To: <20220928090636.1580647-3-tadhg.kearney@intel.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0061.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:153::12) To BYAPR11MB3799.namprd11.prod.outlook.com (2603:10b6:a03:fb::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR11MB3799:EE_|BN9PR11MB5258:EE_ X-MS-Office365-Filtering-Correlation-Id: 6602f148-5472-41c1-8648-08daa14b94cd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bynarFpAJ0Mz0UgqNt+vgnrATZqsEsx6Q7xr4SYb4KDO3auLfeysyLSE+Cm+5Q9OfW+1jv/VBGpcOS8AJV/WG+UXrRzUKt46iB8AftfbR8Ulr9xuwrzxQpjaosXeJiWmCRiTf7xzSh+xP4crJEybO63k82uOW7TDlwn7c9yxK6eJeFUKtOIGmlMsRYy1fpxcHctirmgVfZ+CerUrNMTds9NJnk6GRz3FEfP+FB8cNJ2IMxjBJxCXdR/XOIhNlAt8ATZ/CzjlTsTugNsHa3evSJ1PwnBs5/wRc9XU0WR5tG46AZeNpjIzuOU5J1FZRL4OVdVU5oPVVzdW20bLQebSRWhv6A/X8LNtLcETTfX7us8Hwh3ZONPFYANGffsCjZZmLXQP/fJO7qQ+kIuZlruN25WJcVqbRyuvuYQ1Q94iqpmpFH8ndFD4HTXQGLVXKn0u+xdHhnUE+HDKxgbQPV2zDnmVEJgYeU86qSq4kXTk3161p8nF9Y6695cvnPtD9TsGYWACvosrBjUSsUC2sSojhWm4jUYoh+kZDsNdbep0foKQ5mjLFcx7h/aHigUuqRfD19Wro3meGZRcq7KoM8IReJ/FPHSNCgmJQZCyWd78Bsh5zEeiYZ4b98Q6uhqqas9n925+ULLbnzdpTD0DKFUpPXysp5QuAkcL3s9PaoBJbSZ2/iJqAJb5yn1tfo5y6kgU1eAgeIUvnlPYnqf3r3YcfEKdWiK/EdBPtry5Tn5L3CETMQkG8D/iYnE+jrJtY14cwpiMRrbjTFDccf2exXyde6pz7Kzl8yJ2A661MLVCA+p+IBVynHIWkafga0exmbXR 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)(136003)(366004)(396003)(376002)(39860400002)(346002)(451199015)(38100700002)(83380400001)(82960400001)(8676002)(4326008)(66946007)(66476007)(316002)(66556008)(2906002)(186003)(8936002)(6506007)(53546011)(2616005)(6666004)(26005)(6486002)(6512007)(5660300002)(478600001)(41300700001)(107886003)(36756003)(31686004)(86362001)(31696002)(32563001)(43740500002)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?aVd0WjRQTlk3cVluODJhMHRRMGlIMnpzNVo2K0lKd2I1MG81MXdEZzFRdGdu?= =?utf-8?B?QzZrZVlNeXdlTE16K0NSWXZuQzI3NkJGMWNTM2N4Wmk0L2NCYU15S094Y05N?= =?utf-8?B?K2s3WTNQUTVLdzhqSnZmdHFsVGlaanJxMndaQnVhWGh0bnBwVi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B?MUp1TUxWTTYwMGswL21lSGdnV0lyTGM4THpzWnI1ZWxYNzdFcktTU2JXR3lE?= =?utf-8?B?eWMvUmtKY3lDK2M0NDFudXltMXhjS09raVRmN1UvUHNGMXIwV1pldFBoYmdT?= =?utf-8?B?dVdOZDg4a3JPVWxGUEE3V3Z2dXh2bTMyMlhsZDBOWnRtNklDNlo5dGhzTENP?= =?utf-8?B?RjJ0VGxtZ1JGcCtaRk9NRWhUcnVzV3VkdjZXS1RXN2VKVldSbFFoVWhyMEk5?= =?utf-8?B?Znc9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: 6602f148-5472-41c1-8648-08daa14b94cd X-MS-Exchange-CrossTenant-AuthSource: BYAPR11MB3799.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Sep 2022 12:18:41.9806 (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: LK0Xyim6lMN8A0YsShCJnJawFZ3Lu98QAFNFfPknBQBGlqjHqHXfvXIdW0m1CrnkqfZu8C5Gl+cXalgAdaCn6A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR11MB5258 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 Hi Tadhg, On 28/09/2022 10:06, 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 > Reviewed-by: David Hunt > --- > .../sample_app_ug/l3_forward_power_man.rst | 29 ++++ > examples/l3fwd-power/main.c | 126 +++++++++++++++++- > 2 files changed, 153 insertions(+), 2 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..0b6acc8e58 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" > @@ -161,6 +162,9 @@ static struct rte_timer telemetry_timer; > /* stats index returned by metrics lib */ > int telstats_index; > > +/* flag to check if uncore option enabled */ > +int enabled_uncore = -1; > + > struct telstats_name { > char name[RTE_ETH_XSTATS_NAME_SIZE]; > }; > @@ -179,6 +183,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 +1626,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 +1685,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) > { > @@ -1864,7 +1945,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:", There's been a spurious ':' added after the 'P' for promiscuous mode, thereby breaking it. > lgopts, &option_index)) != EOF) { > > switch (opt) { > @@ -1893,6 +1974,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 +2466,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 +2479,26 @@ deinit_power_library(void) > return ret; > } > } > + > + /* if uncore option was set */ > + if (enabled_uncore == 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_exit(pkg, die); > + if (ret < 0) { > + RTE_LOG(ERR, L3FWD_POWER, "Failed to exit uncore deinit successfully for pkg %02u die %02u\n" > + , pkg, die); > + return -1; > + } > + } > + } > + } > return ret; > } >