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 B319842AE1; Wed, 17 May 2023 13:42:25 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9E4FA406B7; Wed, 17 May 2023 13:42:25 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by mails.dpdk.org (Postfix) with ESMTP id 08CB54067B for ; Wed, 17 May 2023 13:42:24 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fgne24xlg/aceKeWepLhU0tMikk1nf3IktJxjdZCHoho0Zr8ZBo6LjSX8DoN75IaWfJr61WVKcqH3qXHskr+0yX7Mba7wc7bxxoiu47BbV8lSHls5Ha3D2+HMAf6bDRN6i7sugJqvt0COn3Bl3UR/pNOpuzlq+WlrT994eh/ftcyEvItwtgmGl3wFkdwi3Pwy3QLtXx26FS5NYTO7YDYIynnQqPr2Zi/871evHh21n+XDsggPmKZZsxjtweWiQXsfqCokueNCOAdYDJvwXWO9QxQQXv+qtQwLct51C52TcEXW+/oio3v5kfYsezCyYZmatEjX1DYLSCAXPnv6rTYzA== 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=/wcVCS+TM2tEfLehdDwTk01pV6vlSbClZBjAl9Vb6Zk=; b=nS6WvQ1jsPvg1+PcQ94HYk8BM7TAGvHaarwDuVk1Ibs5z3pSUtdtffm2tEWrDnLKO4s+oopbSjfzd4PUAPIO82pQdLBqLfMu9CFOwAPYUBNRmDsHq9JXF6PfNgj3Ck/KAoDUixGaA9xHF8uDEEp0lNDpNNHqLpqOiiJ/BBbcv4IVSfDVl96TOIjxnAEnNKHScyV3zqIv/jHgB9Oz3XTYZRb5wq0iqyWXuW4rjr0tYsWQVEIYk/ZRrwYpylh5ifCXnlCQODr7d9F0x1RUmcPJ/+qZa8VFDuEEhp4N4mY7BLNKROVDjRH98f9aYMB+Z14GIbeADNGyB6uEc3Ahw0hrgw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/wcVCS+TM2tEfLehdDwTk01pV6vlSbClZBjAl9Vb6Zk=; b=JiluYxZseGli+LzH1+9t6P+rzD3Dt7H9YM7uY9J1C3iMGKcBj/FA2Cvy29chGt9j6E1eExdNu1NJxT0eKM7hjcAhosl59y1qWbkmX42AQ6IeguhmOSJJ7Pjsr/sC/WKPmDT0o09c+VKEADiPGjb5cr3LVFC29BCHVqv3Na3Ygz4= Received: from BL1PR12MB5777.namprd12.prod.outlook.com (2603:10b6:208:390::21) by SJ0PR12MB6989.namprd12.prod.outlook.com (2603:10b6:a03:448::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.20; Wed, 17 May 2023 11:42:21 +0000 Received: from BL1PR12MB5777.namprd12.prod.outlook.com ([fe80::5c9d:beed:3d8d:1d1b]) by BL1PR12MB5777.namprd12.prod.outlook.com ([fe80::5c9d:beed:3d8d:1d1b%4]) with mapi id 15.20.6387.033; Wed, 17 May 2023 11:42:20 +0000 From: "Tummala, Sivaprasad" To: "david.hunt@intel.com" , "anatoly.burakov@intel.com" CC: "dev@dpdk.org" , "Yigit, Ferruh" Subject: RE: [RFC PATCH] power: refactor uncore power management interfaces Thread-Topic: [RFC PATCH] power: refactor uncore power management interfaces Thread-Index: AQHZfeFFK9ikBvPVnEueOygtohEgua9ebFgQ Date: Wed, 17 May 2023 11:42:20 +0000 Message-ID: References: <20230503170349.740528-1-sivaprasad.tummala@amd.com> In-Reply-To: <20230503170349.740528-1-sivaprasad.tummala@amd.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2023-05-17T11:42:18Z; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Method=Standard; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Name=General; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=0bef1fb7-d765-4e41-a4fd-69b3e35f0911; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=1 msip_label_4342314e-0df4-4b58-84bf-38bed6170a0f_enabled: true msip_label_4342314e-0df4-4b58-84bf-38bed6170a0f_setdate: 2023-05-17T11:42:18Z msip_label_4342314e-0df4-4b58-84bf-38bed6170a0f_method: Standard msip_label_4342314e-0df4-4b58-84bf-38bed6170a0f_name: General msip_label_4342314e-0df4-4b58-84bf-38bed6170a0f_siteid: 3dd8961f-e488-4e60-8e11-a82d994e183d msip_label_4342314e-0df4-4b58-84bf-38bed6170a0f_actionid: a23a2485-aea5-48f2-b70f-210bb35eb4e2 msip_label_4342314e-0df4-4b58-84bf-38bed6170a0f_contentbits: 0 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BL1PR12MB5777:EE_|SJ0PR12MB6989:EE_ x-ms-office365-filtering-correlation-id: aba19850-d2af-4a85-ddae-08db56cbc64c x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ZFvX2vRPBL5nHdru9wJCX0NS1Vwbws7tfEw97whejPcnHfI/yIlcpNlZgt58I9m6OY9QfFtDiOWH/4ZxGg8eJjwKP4BPAnI8bGRLrM7FujIqViCKS/ePTiCe71mwJ3JpW/QHqreIEE+sQcDKOXnF3OPoFQDjkqzuI5EVqsBODOCTPvUWqYaR8MsLvKNC4fg7KtNL1hz9vC5lueN5/bQ+Qutf5eLOYBz4wCDkvaMVmY3zBS6k4s3vjY8qjxIEmp71cRoV4OSxOCKHMK3I+PLbAY07j5Jzj8MN3j0SLr26/kPFKbTAqXMHATNz27B8oG1ZN9ZY5cY41kGQyg8RY3Rx92DY/VDPhaGCnrsl61kqtZvWPPjQdoCVRWxZIPozKC6j6cktcu0lTxSGa2o0RvOfGpbVmDjufIsKjnhZML/omPZeMOrFAE7UMD97ebO5Bk5yqbHX0cEMVzuaXFzUX220qF65hJqTtBk3z6209lreNGfoINwdUZToez4/J14bABbSOsVe1Yc2g9wZbO3VE3iGdOQLOE6EGNEUeCbAKT/sA7s4u5fjf/HSxyxN1bk9QZs5QlCc49wEphXE0EgJki8CIU69N0Brn/U+kFiSDPmSGTv3iEy5HYeF0cQpaVIgsRte x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BL1PR12MB5777.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(346002)(366004)(39860400002)(136003)(376002)(396003)(451199021)(33656002)(38100700002)(86362001)(122000001)(38070700005)(4326008)(55016003)(316002)(41300700001)(54906003)(8936002)(6506007)(53546011)(9686003)(52536014)(8676002)(186003)(5660300002)(71200400001)(26005)(110136005)(478600001)(66556008)(2906002)(66946007)(64756008)(76116006)(7696005)(66446008)(66476007)(83380400001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?aRjQR4XBc2cMj92mh4qmLpKQx6l9eLr5grLSd3GX6komKCg8ciJz06Mkvh4k?= =?us-ascii?Q?i4mwaDeIIFAD2VYA2RdDNwt6DOL2uuN9rbA+DixKeGaTl9cC9H77JsIRZ2Ls?= =?us-ascii?Q?FQl7/zWWvHEr72MuHcM6W5RoM1Szj4DAMAVCcv6N9OgaDUd+QnWKRz+bhbIt?= =?us-ascii?Q?C+1XCFyagQObMPsyh8XKRPV+IH2iGl3q120toFbdcr9atqmER8m5A4gczr/j?= =?us-ascii?Q?ExD2q58IOdtZnmllYccaOaE0caXuQv6LmbrkixhEbi6/GYyZjwnSkUZlEoID?= =?us-ascii?Q?jgyJYkpV/rlnfLL0NuM1CvuYw9wtwe816gpMhWY6pAHwXnhakeaSWMasJ3T6?= =?us-ascii?Q?qDjWtNk++thVAZKzV+S2XfiTqrKE4ELGtDrSbv6mvEAjKdGvTmm90YGvldlH?= =?us-ascii?Q?FVs5IjFzgv5sSU4eFlRouU5EYcrBlZnx2HwOsq4ZADeaAUdNwwyD8bg2b7JO?= =?us-ascii?Q?mszh9xIuOwkLkswhKD/pLpjrHHrk9SfemjYuHwJmm0cwpnQQUTxDJ+Ik40uh?= =?us-ascii?Q?vqBs5rmN6U9KgtQdE28KHDjy26qO4u3psnSMM3/8/pZDBNOBkh5HoB9Js59o?= =?us-ascii?Q?+qPv7dqS86JECLWH/VGmUEN9n2tx+GhHMvmz8no/fo83WfQ4ey+Qp5azL8wB?= =?us-ascii?Q?QRFMkMomJFWNqnuygPiuGsK3tbl4HsvpHbIA4Cyad/SDA7XLBevCCOfEpIqs?= =?us-ascii?Q?nZkl6bvCqnoZd039Y31dNffxsAd9ffx2R+hnFfe76cXgzWYiC8+aBGcQVrbe?= =?us-ascii?Q?9RKjbfZu+GRECaHqJaClGv8K1eDgGsujOk+aqaMde3BmPmIdmKkQXEFpLaZd?= =?us-ascii?Q?gXxDNxeUxthgmqd2RINwvIHK+4584n79QmlTYfhe8ne1UD5gyhe7vNTRvDt9?= =?us-ascii?Q?VzmoGHRIomS1dh0MfgE12T0oyddHGH35f1REY+UYBmv5iCC+KEwfXyNvsEUw?= =?us-ascii?Q?57goBGvyhBlxOa+4Zv4uXXuus9RpVFCTcitKprAEielNFRVu6hb+MTmXfaoh?= =?us-ascii?Q?Wyts9E7v/XK0ZqFIBo20Nd4tagjj7dywDlMsHIX1RXvSKpIsNH3Pll/zwGT8?= =?us-ascii?Q?ngl4qD3REU3oPWhOJOCzCyddfGOBzupkpksaXYgm+TEh3gBShZUd7Z0/rwai?= =?us-ascii?Q?nQk8pekukhlURrAE3Qm3iDhF0aMR1hYDNQhRWSz9gjtiawY/DkCblD8T4YXN?= =?us-ascii?Q?zJt90atoowRCbWRrlHqfkHAnECnlQ57eDIg13XJKIXh64b+i78bfCLkKONNT?= =?us-ascii?Q?JJXTyEQeWqSHk9+TvO1GgcaxUeUixJqSStW7CulbYA7FfSbVeF2LpaYOrU+o?= =?us-ascii?Q?Uf0+4j2FS843dt1/1D7U1swnwt8aaARj5AWW1KFptKoPS2embZUhB4Szi0V4?= =?us-ascii?Q?fT10iE8z6QQGw6aJ6CiREBATuU2mWE1L17XK94NYMtW4h6W4VDfN76uYqHgS?= =?us-ascii?Q?clfewmPanyjc788x5phFXtvSc7Ofzx+W9sPeGP6K2SitXy5p2/ugs3wORpvH?= =?us-ascii?Q?bcy+ShPK0OCz01GgvDKVoKXLaV6crgGI7EYPsRhHa9mMW7rJX9EEOHi3M3bM?= =?us-ascii?Q?oP0zZGbiAYy1vh/cu2U=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BL1PR12MB5777.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: aba19850-d2af-4a85-ddae-08db56cbc64c X-MS-Exchange-CrossTenant-originalarrivaltime: 17 May 2023 11:42:20.8202 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ei1GkxfEf9XJFcvFKmTkwVIYXUj/nehOqJsbakaQ/GmVyCVhiGEcOxr4WvG6NHZAr4MRTU2/H/cCX1kIxzjKAQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6989 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 [AMD Official Use Only - General] Hi Dave, Anatoly, We are planning to implement these changes in 23.07 release.=20 Would like to hear your comments and any objections. Can you please review this and share your thoughts.=20 Thanks & Regards, Sivaprasad > -----Original Message----- > From: Tummala, Sivaprasad > Sent: Wednesday, May 3, 2023 10:34 PM > To: david.hunt@intel.com > Cc: dev@dpdk.org; anatoly.burakov@intel.com; Yigit, Ferruh > ; Tummala, Sivaprasad > > Subject: [RFC PATCH] power: refactor uncore power management interfaces >=20 > From: Sivaprasad Tummala >=20 > currently the uncore power management implementation is vendor specific. > Added new vendor agnostic uncore power interface similar to rte_power and > subsequently will rename specific implementations > ("rte_power_intel_uncore") to "power_intel_uncore" along with functions. >=20 > Signed-off-by: Sivaprasad Tummala > --- > lib/power/rte_power_uncore.h | 234 > +++++++++++++++++++++++++++++++++++ > 1 file changed, 234 insertions(+) > create mode 100644 lib/power/rte_power_uncore.h >=20 > diff --git a/lib/power/rte_power_uncore.h b/lib/power/rte_power_uncore.h = new file > mode 100644 index 0000000000..196fb9ec01 > --- /dev/null > +++ b/lib/power/rte_power_uncore.h > @@ -0,0 +1,234 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2022 Intel Corporation > + * Copyright(c) 2023 AMD Corporation > + */ > + > +#ifndef RTE_POWER_UNCORE_H > +#define RTE_POWER_UNCORE_H > + > +/** > + * @file > + * RTE Uncore Frequency Management > + */ > + > +#include > +#include "rte_power.h" > + > +#ifdef __cplusplus > +extern "C" { > +#endif > + > +/* Uncore Power Management Environment */ enum uncore_power_mgmt_env > { > +UNCORE_PM_ENV_NOT_SET, > + UNCORE_PM_ENV_INTEL_UNCORE, UNCORE_PM_ENV_AMD_HSMP}; > + > +/** > + * Initialize uncore frequency management for specific die on a package. > + * It will get the available frequencies and prepare to set new die freq= uencies. > + * > + * This function should NOT be called in the fast path. > + * > + * @param pkg > + * Package number. > + * Each physical CPU in a system is referred to as a package. > + * @param die > + * Die number. > + * Each package can have several dies connected together via the uncore= mesh. > + * > + * @return > + * - 0 on success. > + * - Negative on error. > + */ > +__rte_experimental > +int > +rte_power_uncore_init(unsigned int pkg, unsigned int die); > + > +/** > + * Exit uncore frequency management on a specific die on a package. > + * It will restore uncore min and* max values to previous values > + * before initialization of API. > + * > + * This function should NOT be called in the fast path. > + * > + * @param pkg > + * Package number. > + * Each physical CPU in a system is referred to as a package. > + * @param die > + * Die number. > + * Each package can have several dies connected together via the uncore= mesh. > + * > + * @return > + * - 0 on success. > + * - Negative on error. > + */ > +__rte_experimental > +int > +rte_power_uncore_exit(unsigned int pkg, unsigned int die); > + > +/** > + * Return the current index of available frequencies of a specific die o= n a package. > + * It should be protected outside of this function for threadsafe. > + * > + * This function should NOT be called in the fast path. > + * > + * @param pkg > + * Package number. > + * Each physical CPU in a system is referred to as a package. > + * @param die > + * Die number. > + * Each package can have several dies connected together via the uncore= mesh. > + * > + * @return > + * The current index of available frequencies. > + * If error, it will return 'RTE_POWER_INVALID_FREQ_INDEX =3D (~0)'. > + */ > +typedef uint32_t (*rte_power_get_uncore_freq_t)(unsigned int pkg, > +unsigned int die); > + > +extern rte_power_get_uncore_freq_t rte_power_get_uncore_freq; > + > +/** > + * Set minimum and maximum uncore frequency for specified die on a > +package > + * to specified index value. > + * It should be protected outside of this function for threadsafe. > + * > + * This function should NOT be called in the fast path. > + * > + * @param pkg > + * Package number. > + * Each physical CPU in a system is referred to as a package. > + * @param die > + * Die number. > + * Each package can have several dies connected together via the uncore= mesh. > + * @param index > + * The index of available frequencies. > + * > + * @return > + * - 1 on success with frequency changed. > + * - 0 on success without frequency changed. > + * - Negative on error. > + */ > +typedef int (*rte_power_set_uncore_freq_t)(unsigned int pkg, unsigned > +int die, uint32_t index); > + > +extern rte_power_set_uncore_freq_t rte_power_set_uncore_freq; > + > +/** > + * Function pointer definition for generic frequency change functions. > + * > + * @param pkg > + * Package number. > + * Each physical CPU in a system is referred to as a package. > + * @param die > + * Die number. > + * Each package can have several dies connected together via the uncore= mesh. > + * > + * @return > + * - 1 on success with frequency changed. > + * - 0 on success without frequency changed. > + * - Negative on error. > + */ > +typedef int (*rte_power_uncore_freq_change_t)(unsigned int pkg, > +unsigned int die); > + > +/** > + * Set minimum and maximum uncore frequency for specified die on a > +package > + * to maximum value according to the available frequencies. > + * It should be protected outside of this function for threadsafe. > + * > + * This function should NOT be called in the fast path. > + * > + * @param pkg > + * Package number. > + * Each physical CPU in a system is referred to as a package. > + * @param die > + * Die number. > + * Each package can have several dies connected together via the uncore= mesh. > + * > + * @return > + * - 1 on success with frequency changed. > + * - 0 on success without frequency changed. > + * - Negative on error. > + */ > +extern rte_power_uncore_freq_change_t rte_power_uncore_freq_max; > + > +/** > + * Set minimum and maximum uncore frequency for specified die on a > +package > + * to minimum value according to the available frequencies. > + * It should be protected outside of this function for threadsafe. > + * > + * This function should NOT be called in the fast path. > + * > + * @param pkg > + * Package number. > + * Each physical CPU in a system is referred to as a package. > + * @param die > + * Die number. > + * Each package can have several dies connected together via the uncore= mesh. > + * > + * @return > + * - 1 on success with frequency changed. > + * - 0 on success without frequency changed. > + * - Negative on error. > + */ > +extern rte_power_uncore_freq_change_t rte_power_uncore_freq_min; > + > +/** > + * Return the list length of available frequencies in the index array. > + * > + * This function should NOT be called in the fast path. > + * > + * @param pkg > + * Package number. > + * Each physical CPU in a system is referred to as a package. > + * @param die > + * Die number. > + * Each package can have several dies connected together via the uncore= mesh. > + * @param freqs > + * The buffer array to save the frequencies. > + * @param num > + * The number of frequencies to get. > + * > + * @return > + * - The number of available index's in frequency array. > + * - Negative on error. > + */ > +typedef int (*rte_power_uncore_freqs_t)(unsigned int pkg, unsigned int d= ie, > + uint32_t *freqs, uint32_t num); > + > +extern rte_power_uncore_freqs_t rte_power_uncore_freqs; > + > +/** > + * Return the number of packages (CPUs) on a system > + * by parsing the uncore sysfs directory. > + * > + * This function should NOT be called in the fast path. > + * > + * @return > + * - Zero on error. > + * - Number of package on system on success. > + */ > +typedef unsigned int (*rte_power_uncore_get_num_pkgs_t)(void); > + > +extern rte_power_uncore_get_num_pkgs_t rte_power_uncore_get_num_pkgs; > + > +/** > + * Return the number of dies for pakckages (CPUs) specified > + * from parsing the uncore sysfs directory. > + * > + * This function should NOT be called in the fast path. > + * > + * @param pkg > + * Package number. > + * Each physical CPU in a system is referred to as a package. > + * > + * @return > + * - Zero on error. > + * - Number of dies for package on sucecss. > + */ > +typedef unsigned int (*rte_power_uncore_get_num_pkgs_t)(unsigned int > +pkg); > + > +extern rte_power_uncore_get_num_dies_t rte_power_uncore_get_num_dies; > + > +#ifdef __cplusplus > +} > +#endif > + > +#endif /* RTE_POWER_UNCORE_H */ > -- > 2.34.1