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 4665743209; Thu, 26 Oct 2023 17:20:23 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 12472406B8; Thu, 26 Oct 2023 17:20:23 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2054.outbound.protection.outlook.com [40.107.92.54]) by mails.dpdk.org (Postfix) with ESMTP id D1DD6402D4 for ; Thu, 26 Oct 2023 17:20:21 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kI3r6cJoWVFuZY9EoWZp1aj8JPq3XUwzM9/loZuWlFS9CxurQsGybN6Zy7KM+bJ/EJx0/VgLGy9KRIs0hepj4QFjvjMWJI4ML/RX6zwtCAUDK4Ljc77+C4FeOA0xM+/e1sWAtaSf7wEe/ooYVBrB1b787pfBk0iCxwz21OuWfRJX1q/vL+151Q0Wtuitndz1TzrnDKMSVD+AMoD1dcn+d5edZth9R/N+++HHo6u0WRai4SFXNkbly7q8bawn9DKI8wfTuSr1hz6aWbgP9C0rHPSualXZfLIAAuQc+ow1NHD9Bj4kCsXBKQKezV2pUeaab9p6gjCBTj+wPMa4I3Hg/g== 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=w6HoETu7IfgyYW3t86I6mzz8VW6hr0YgsevCQYVzbO8=; b=QV7Kmhhrfh8bWU6CgO4RlQJE3V4PHmyl18SjZWo0p3xCJVtyy6lwQ3KXMbEZ5pMEPfKqC/zBhVySPvku/54G44fKbW3Lga8yrIgtO6KEDfNv21HWO6mMdKKkdMjEljI5BugqEOVWnvaIjWvk4SBqQILN0YWa0SAAnQhWIe7phz2B0c/7DC0KAROrtAnF4MCuOvr/XicpOvbLMePKX1R06bCS+8US0shR8HeK1YBbT1oQC/gG16R/XUliWQfMOMs9VeVW2+46cjLJgP9fsS++pjRMdTNKawo8HmHcRlsYDtL4JfE+mEpZ9xWhtrQQlN4D+iKwuRE2H98OpoHdIOmMoA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) 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=w6HoETu7IfgyYW3t86I6mzz8VW6hr0YgsevCQYVzbO8=; b=scho7kN3TxfUb21K6cDMIateHeOcL0b9LSwuZCdu8oQM4bB+u4eFIy55CDw8lUzvkBHTpehTkR6ynFu8mPBTf1gxPLDNSijzV9hd5R861WQ6T7wH3FEa9hVrhjBNMKKvph5oJjcHr4Dv6aJ6Zm5VfdgNOEuH7DJDRdEqIHbQ6yA= Received: from MN2PR18CA0026.namprd18.prod.outlook.com (2603:10b6:208:23c::31) by BY5PR12MB4273.namprd12.prod.outlook.com (2603:10b6:a03:212::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.26; Thu, 26 Oct 2023 15:20:19 +0000 Received: from BL6PEPF0001AB74.namprd02.prod.outlook.com (2603:10b6:208:23c:cafe::31) by MN2PR18CA0026.outlook.office365.com (2603:10b6:208:23c::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.22 via Frontend Transport; Thu, 26 Oct 2023 15:20:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL6PEPF0001AB74.mail.protection.outlook.com (10.167.242.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6933.15 via Frontend Transport; Thu, 26 Oct 2023 15:20:18 +0000 Received: from telco-siena.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Thu, 26 Oct 2023 10:20:17 -0500 From: Sivaprasad Tummala To: , , CC: , , , , Subject: [PATCH] examples/l3fwd-power: fix to configure the uncore env Date: Thu, 26 Oct 2023 08:19:59 -0700 Message-ID: <20231026151959.1458112-1-sivaprasad.tummala@amd.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB74:EE_|BY5PR12MB4273:EE_ X-MS-Office365-Filtering-Correlation-Id: 5778971a-d2f3-422f-9b6c-08dbd6371043 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DFBvHICcJNngpoqSlKVSjMe6Jaw99VEsa875KB9br/Cbkdz3jaBphbf5G1ptdSfjT8aCY1leMVJDxHgEcuEJ1qEvepiXkmztb+9dYyAagVkuWF2Y0DLPd+sTagymI7DGXb4p5ImPIyAws8ikUB5OuMgNuvKyeu/Ey5E8x8CXEhJZcmUn+26Oxv2vYa3+UNlEXDxGZlysGOFQqKN6KmyPVpw64sl+YP9qmgokR3eI0AnjGhib8F4ToPcJ46wh5J/+mBsZhawxuqeukkNyD/ND/VPY80LRxG5rNTkjg3hOqnEjo7n1M0/WpHyAYmoZ3Nfd6jJZfCy3WgZfgPVFSZHNsZT7iP5xS70jrC76mjnWRamtexfoHFAiwPPWxD7TSVF3kh+Rdtr+RN54ep6HEs985T98dET8JwaqfIEbHFq2B48vPs8NK9rnP+ZnQ6KIiZzI4Bz9Km7uW38ooHV/jySFpoiADANBQ6qirWotPeALF8r5Q9DbfmiXcW08DzxgfrtnQqRAMhsKK9q+NKwC8GjMrTh/LwEp44d42wDfqzH8Iid+LuTLulwOPVYn39nip3SphXd2g4cF/iPa0T7F3EOQosAXQdn+t53UnkQoEQysefsG7yrq5BwZQ7CSXDijtw0XOhflnTywhjXJUK/6/gIcvoctbDk83Ykjp4PkGbTif/1IOP6RXkVjEyRXt8rH+fKNNwZH3PaX6F127P/3HqhVaIIlUOndBKYXHIsmZSWIQQ2NRMDwYLPCMiY6W1P2XPVJI9WOZSf/Pe6pjDj6tzB4xg== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(396003)(39860400002)(136003)(346002)(376002)(230922051799003)(82310400011)(186009)(64100799003)(1800799009)(451199024)(46966006)(36840700001)(40470700004)(40460700003)(83380400001)(2906002)(36860700001)(8936002)(44832011)(8676002)(82740400003)(36756003)(47076005)(81166007)(336012)(426003)(1076003)(2616005)(356005)(26005)(16526019)(7696005)(40480700001)(110136005)(4326008)(478600001)(6666004)(316002)(5660300002)(41300700001)(86362001)(54906003)(70586007)(70206006)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Oct 2023 15:20:18.7156 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5778971a-d2f3-422f-9b6c-08dbd6371043 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF0001AB74.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4273 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 Updated the l3fwd-power app to configure the uncore env before invoking any uncore APIs. With auto-detection in 'rte_power_uncore_init()' it is too late because other APIs already called. Bugzilla ID: 1304 Fixes: ac1edcb6621a ("power: refactor uncore power management API") Cc: karen.kelly@intel.com Signed-off-by: Sivaprasad Tummala --- examples/l3fwd-power/main.c | 6 ++++++ lib/power/rte_power_uncore.c | 7 +++++++ lib/power/rte_power_uncore.h | 9 +++++---- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 5fbc16bb2a..9c0dcd343b 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -1561,6 +1561,12 @@ parse_uncore_options(enum uncore_choice choice, const char *argument) { unsigned int die, pkg, max_pkg, max_die; int ret = 0; + ret = rte_power_set_uncore_env(RTE_UNCORE_PM_ENV_AUTO_DETECT); + if (ret < 0) { + RTE_LOG(INFO, L3FWD_POWER, "Failed to set uncore env\n"); + return ret; + } + max_pkg = rte_power_uncore_get_num_pkgs(); if (max_pkg == 0) return -1; diff --git a/lib/power/rte_power_uncore.c b/lib/power/rte_power_uncore.c index 78a823d34c..d87328bedf 100644 --- a/lib/power/rte_power_uncore.c +++ b/lib/power/rte_power_uncore.c @@ -105,6 +105,13 @@ rte_power_set_uncore_env(enum rte_uncore_power_mgmt_env env) return -1; } + if (env == RTE_UNCORE_PM_ENV_AUTO_DETECT) + /* Currently only intel_uncore is supported. This will be + * extended with auto-detection support for multiple uncore + * implementations. + */ + env = RTE_UNCORE_PM_ENV_INTEL_UNCORE; + ret = 0; if (env == RTE_UNCORE_PM_ENV_INTEL_UNCORE) { rte_power_get_uncore_freq = power_get_intel_uncore_freq; diff --git a/lib/power/rte_power_uncore.h b/lib/power/rte_power_uncore.h index 295017b7f4..ede50a5f87 100644 --- a/lib/power/rte_power_uncore.h +++ b/lib/power/rte_power_uncore.h @@ -21,15 +21,16 @@ extern "C" { /* Uncore Power Management Environment */ enum rte_uncore_power_mgmt_env { RTE_UNCORE_PM_ENV_NOT_SET, + RTE_UNCORE_PM_ENV_AUTO_DETECT, RTE_UNCORE_PM_ENV_INTEL_UNCORE, RTE_UNCORE_PM_ENV_AMD_HSMP }; /** - * Set the default uncore power management implementation. If this is not called prior - * to rte_power_uncore_init(), then auto-detect of the environment will take place. - * It is thread safe. New env can be set only in uninitialized state - * (thus rte_power_unset_uncore_env must be called if different env was already set). + * Set the default uncore power management implementation. This has to be called + * prior to calling any other rte_power_uncore_*() API. + * It is thread safe. New env can be set only in uninitialized state. + * rte_power_unset_uncore_env must be called if different env was already set). * * @param env * env. The environment in which to initialise Uncore Power Management for. -- 2.34.1