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 F0614A04FD; Mon, 23 May 2022 18:25:36 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DB30A4067B; Mon, 23 May 2022 18:25:36 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 2AA3640156 for ; Mon, 23 May 2022 18:25:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1653323135; x=1684859135; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=vAN+8kEvYIziFBMLQwQtNH5W/exrStZ//HajUaUDypQ=; b=PCkT8t3K/BjSRlh8C1CIgXNONRrDMLfsh/kpvMMgaOtw34ipyf6aiw+j w9R6eWBKXi/+5l5iqiC3auD8o9XdUTN5LxOHcUAWpor4TRvfjxX21J8tQ aoLo3wO8FKluahzK8fc+u8OOxLjx49axPWeLivTiaXL6pKtAB7Pb6t4El VrLvrlGJ44lrDA0XhvH2fEuRGqQWC1Mhq3b4ne0Yvw2asZj2Ng8nmTHyJ S4B2vxKgdhMHtNkv6PfnIjJa8KbAexRSYSoBjfV3nXJS7p46p8gYhf9fy RyeFPSrUwWwHay9kQBfHPGUc+cBjIARKQdg6o4hbDgFQKrlo6IeJBG8ee Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10356"; a="273392064" X-IronPort-AV: E=Sophos;i="5.91,246,1647327600"; d="scan'208";a="273392064" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 May 2022 09:25:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,246,1647327600"; d="scan'208";a="663507374" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by FMSMGA003.fm.intel.com with ESMTP; 23 May 2022 09:25:33 -0700 Received: from orsmsx606.amr.corp.intel.com (10.22.229.19) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Mon, 23 May 2022 09:25:33 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Mon, 23 May 2022 09:25:33 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.172) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Mon, 23 May 2022 09:25:33 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SyXQARDE0FS1+cANs1llEd7KBrTGCBtdy5Cg1wO7nSFFuCmrh5BICtrVe2aaSEg+mnbvF4rn5TK0yhF5zMGdH8MPP6OCnbURRW3IN8uZiCHcsRceASnqTQiVa9r3CtxeL8dWQxTMdfowILFOn6fVFHHPP/u2vxBh2IxJsiKsZZK36LvQTri7PnPcSpmH1WO7ANLcse3cyVryE2wLxNLfE2dN0AzmzkI/Kj9KyCkaaz+pqmcPsmiqVu8SKZeyiQ67imkveBy6tkABjB/DE99CIoyVmKRs0NuFTVHE7Qhbk0Aor6HFaJ//2tW/LYETsT+ci9+yf4IiI13P1AE6l+bhNw== 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=qBaGuKAzNdDeV13+36IMFay9kDoTfyEkgrnE9S/ntSs=; b=UceMJucXoQ981Ut8fRLHVdlgM5tzBsnvAKrbOK1ZmeeOAxs5x6A1lIvug17U1y3nCCZMr++pkuQd9Od1UY65brKFJBlHyBZ7I03T/oirtt6qw6EjCXve6XTtlenJXdNTL2JB8gfJ7T1OAIv33gbIY1DrX9VDDpj294RDl/D8elCofK1O5/F/Ccp0cMbIrHyJz1YDNs/Yq1WvHDnpZL/SC5yg5f9vxZK5C45kwyllPDUC0PmmqwCGdC/upyeX53ZpumuWxVkQhQiq70ZrtvJjsLWnOfavmecuKjJMesWhbqwwJHyGqt4soBekHKITsNS82jy0lNIkjoGv4fT2F/RIUQ== 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 MW4PR11MB5872.namprd11.prod.outlook.com (2603:10b6:303:169::14) by BL1PR11MB5509.namprd11.prod.outlook.com (2603:10b6:208:31f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.16; Mon, 23 May 2022 16:25:32 +0000 Received: from MW4PR11MB5872.namprd11.prod.outlook.com ([fe80::d55d:28c1:bfab:3dd]) by MW4PR11MB5872.namprd11.prod.outlook.com ([fe80::d55d:28c1:bfab:3dd%5]) with mapi id 15.20.5273.022; Mon, 23 May 2022 16:25:31 +0000 Message-ID: <8cdc40ad-b53f-32f6-db3c-260829892837@intel.com> Date: Mon, 23 May 2022 17:25:25 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH v2 3/4] lib/power: add get and set API for scaling freq min and max with pstate mode To: "Burakov, Anatoly" , CC: David Hunt , Ray Kinsella References: <20220408140847.1319312-1-kevin.laatz@intel.com> <20220419112501.1835458-1-kevin.laatz@intel.com> <20220419112501.1835458-4-kevin.laatz@intel.com> From: Kevin Laatz In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO2P265CA0133.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:9f::25) To MW4PR11MB5872.namprd11.prod.outlook.com (2603:10b6:303:169::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: be5412c1-8fb2-4799-3179-08da3cd8db3f X-MS-TrafficTypeDiagnostic: BL1PR11MB5509:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VSzcmyE8BSScX9LLP400FqQiQ6z9qrWewLBioU9TGsOj4UpCx+Nwf+YgjqqznNTopF2uNwNDtFDyxM0PotE8i8V5o11r/bu3Ghq/uJmYJBfq0k8Mha69pMJliH5Ko0avWcj5fT254vISsKy0iU/USdmaPMkH4hYMSZk+iA9dearsM3NAwET8QRVjzIoCYb3zp9oVNBQHx3VZ9b+NOxDiARTmZ7tAuymdefNhsD0iY0HjLs7pEXLQcSWOh/gRIg2Ogn003qCI+DwP8hwt/aXkgzZ2pwjKMmLM6sP5U+pDxGtVT7eE8tvuk2A5gItPbnoIWi4zXiuAGUN1edtNwdIkOzSC6wKRgARpPDkKtnxLXVyverPhi+rUxGzmSTYkz8ZVAVm3TxJH7SK50fQJIgNAe2HT7qGR6Ul93XgFJdWu2h3J0dzazRTAYHLKLPcyYf0K0ihthOIULVcy09Z4fZeohubYbiqV1Q+2Wa6MN7dkeZqPbOO0ciuuHPHTit22NZ8JPpN+k9mBuXdrHCK073WEA5Ila+60bWoj3+3B/2NFUfAz+gVYWuZQ5UpMCeYaGl2RQ7sDNbYaCPmiamNPS5tql7K0zB3cuPVZ5ggU/RebRdlWBdxteu81BSYqj12erugeabUCI1l2ghSizsVEXOO6dkpD2nbwgtoHUjLbHlBE9JdTzHn5zC5H3/3wzL6A4rmwwPH1cgoCBFiHZ60ZJ/E1d6cXAUzSfYf7RW+8K7WEQFA= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW4PR11MB5872.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(8936002)(82960400001)(86362001)(53546011)(44832011)(5660300002)(6506007)(31696002)(54906003)(6666004)(6486002)(508600001)(316002)(186003)(2616005)(83380400001)(2906002)(36756003)(31686004)(6512007)(38100700002)(26005)(8676002)(4326008)(66556008)(66476007)(66946007)(45980500001)(43740500002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?YlJ6R3BKS1FNczhDNFYwUGpqYXVOWXY1Y2c4SUJIOUlFNU1WMkhsVjlORHhs?= =?utf-8?B?UkJEOFdva0dyZEM5RVZMSG55WmFEcTVrYUQxUS9ONEUrb3M2SERrTXVGaDNq?= =?utf-8?B?bVZOcjYzNGJMRzkwaVpJZ2JUM3pKV0NCMnFHWUNuK25sb2w4QnloOFduRzVX?= =?utf-8?B?bXVyaFBON3EwNy93Z2hjRy8wL3dnYU9xRWt4WFpvWVEyY0J3THlHamU1RWJw?= =?utf-8?B?ZmhiMGM5R1M1aVF3QmNpb2hKbkFHK1hXYXZ0YmhWMDFEcjM5MHpoaTJoazhh?= =?utf-8?B?aWkwWnNYbGlmb0V0dnVKS0dieEQ4cFp3UThtdVVVYzBVY0hwN1hRNmtrVVhO?= =?utf-8?B?c29McjFxMWQrd2lja2V3SXVUczcveVBVTjVWNTFqZHNlbUVPYlJLdXFjeEwv?= =?utf-8?B?bjB6ZDlQQ2trWEdHaTBq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EpoeGVTa2dJZjRKaEk0czhDK3hVUElHY0dyWXpRd0tyNHRjbU1N?= =?utf-8?B?YUxCcDRYOVdZZDBnK2orbk12NUV2VWtsRVdGZHZxR1pqVHczMWxVUT09?= X-MS-Exchange-CrossTenant-Network-Message-Id: be5412c1-8fb2-4799-3179-08da3cd8db3f X-MS-Exchange-CrossTenant-AuthSource: MW4PR11MB5872.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2022 16:25:31.8112 (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: jgwsGJM73Y/g0uYLGaTTMMa+jS7+VRS6gtgx6whWdY3OjRIZt+L1dNP3OeQcW7Wo69UQsZOelYGkNV+VHhHexw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR11MB5509 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 18/05/2022 10:05, Burakov, Anatoly wrote: > On 19-Apr-22 12:25 PM, Kevin Laatz wrote: >> Add new get/set API to allow the user or application to set the minimum >> and maximum frequencies to use when scaling. >> Previously, the frequency range was determined by the HW capabilities of >> the CPU. With this new API, the user or application can constrain this >> if required. >> >> Signed-off-by: Kevin Laatz >> --- > > > >>   +int >> +rte_power_pmd_mgmt_set_scaling_freq_min(unsigned int lcore, unsigned >> int min) >> +{ >> +    if (lcore >= RTE_MAX_LCORE) { >> +        RTE_LOG(ERR, POWER, "Invalid lcore ID: %u\n", lcore); >> +        rte_errno = EINVAL; >> +        return -1; >> +    } >> +    scale_freq_min[lcore] = min; > > Are there any constraints on the value ranges, or are we just going to > accept any and all values? If the idea was to allow valid values plus > some special "default" value, you can still restrict the range, but > allow 0 as a special case? When writing min/max values to HW the values are clamped. Since the API takes unsigned integer for the frequency value (in this case 'min'), any value can be considered as 'valid'. That being said, this should at least check that min <= max for the same lcore. I'll add this for v3. > >> + >> +    return 0; >> +} >> + >> +int >> +rte_power_pmd_mgmt_set_scaling_freq_max(unsigned int lcore, unsigned >> int max) >> +{ >> +    if (lcore >= RTE_MAX_LCORE) { >> +        RTE_LOG(ERR, POWER, "Invalid lcore ID: %u\n", lcore); >> +        rte_errno = EINVAL; >> +        return -1; >> +    } >> +    scale_freq_max[lcore] = max; > > Same as above. Also, do we want UINT32_MAX be the "special" value for > the "max" case? What do you think of having "0" as "not set", but > maybe set it internally to UINT32_MAX if you still want to keep using > the RTE_MIN/MAX macros? Similar to  'set_scaling_freq_min', the value will be clamped by HW so any value can be considered 'valid'. I don't see the benefit of having "0" for not set, since UINT32_MAX will achieve the same result, i.e. the value won't be used (it will fall back the max value in sysfs). Do you have a use-case for it if we don't need a 'special case'? Will add a check to make sure max >= min for v3. > >> + >> +    return 0; >> +} >> + >> +int >> +rte_power_pmd_mgmt_get_scaling_freq_min(unsigned int lcore) >> +{ > > > >> diff --git a/lib/power/rte_power_pmd_mgmt.h >> b/lib/power/rte_power_pmd_mgmt.h >> index 18a9c3abb5..74e3fa710b 100644 >> --- a/lib/power/rte_power_pmd_mgmt.h >> +++ b/lib/power/rte_power_pmd_mgmt.h >> @@ -148,6 +148,86 @@ __rte_experimental >>   unsigned int >>   rte_power_pmd_mgmt_get_pause_duration(void); >>   +/** >> + * @warning >> + * @b EXPERIMENTAL: this API may change, or be removed, without >> prior notice. >> + * >> + * Set the min frequency to be used for frequency scaling. >> + * >> + * @note Supported by: Pstate mode. >> + * >> + * @param lcore >> + *   The ID of the lcore to set the min frequency for. >> + * @param min >> + *   The value, in Hertz, to set the minimum frequency to. > > Is it really in Hertz? As far as I can tell, it's in steps of 100MHz > (BUS_FREQ). Correct, the frequency changes in steps of 100MHz, but the value passed to 'min' is in kHz - will ammend the comments.