From patchwork Sat Nov 30 15:20:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13889249 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2086.outbound.protection.outlook.com [40.107.94.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D285C15539F; Sat, 30 Nov 2024 15:20:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732980054; cv=fail; b=YNhZPl25FbtauGsGKDwmYQu+9UckDW4TWaIRTom08gXonxdT+P/O3zM+GSKM99NRXUMEMAzMzMlV/3SB7gkFNbq1DFI31WBbEX7Pdg0Z1S05wX8+jmE76jTPgR6IQnTGq+LEFJfED/Qh0qJnbsJoNLu0Z+rLDFgnBDOo/2XPdy8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732980054; c=relaxed/simple; bh=Ym4yT35wGMMQbxcWlPxkIQTjx8JE5uBWKCiNtRMfpzo=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=PMkyi9SfOI1bzzpR6+GbNG6wLgu00+SHAUB89u+kBUg1QcAo3ykoTzp7zB4pWNcn5B2g1+jJeN3nAV4TK/wUaorQlcH0buBx7pfEMJ5bZ7kGG2XargQ5YwXfxruo5btO2GuPzaVLhnjFa37TogNur+jN0SDivtR5gVjfgrLteiI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=aOxM3EU9; arc=fail smtp.client-ip=40.107.94.86 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="aOxM3EU9" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YULwknrUvuH5wq2tt0eIvFCbfU9ZXIb/0cp3tYmfwKV8cHOz0BMOuVuoHRzVAhfyptYSemyvvmQhGhwIW0m/X2ANuW7Y8tIajoo815FnkNoI3EdL3oJ5HD64hGat7YxOlE1IkfZMvXbfganraKv6Z5DrIM02fvZORv6LVdwRxaHcX5kL8PL3XF2p4LYo5J1pr3BHW3n+wq+/YQih6Y+WOYvFriYJ+Csvf9ddxJpvt1XCd/lfk+bqYpWMfFijtDXQ6XDf3XmboSRAqEKQxUiJkIA6o/iHiNSALcD5vkeq3fH/YrrkxcmLeTfBdYfWkPxd41iJvemMcQR3asItQ1zP/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=2IfDqWf+Mkd3RsyQnyNtAVKMN0tvP5deMjCf8zrT6EY=; b=pN2hN73eGa5T3DmC005GPaD4MXty6Rw4GPqtbNd7s8YUm6C8YAEiFqLxe3hP/eRHyb6jCgrYSV3a0zDJYE5vPtfA2i4/ftSOABhQ8qPZrL+KHqbpoJ96PuZspEpk9oJ9RFjg4fYDGKhWGtVqOb0hB+TKnGeb2QveEBVXPR7FIaZPsjaTLTMI4Vx7Y6z03FTWBlux04N3bTEPyL3bDsTNCBuYMSzxtacL9AB2an2uWonQy4lFB9rW2nltkpzsCltNSOtwg4RELh7c76tTOkhtj1cw80RBdLPzTOniBPihnUFLnlCf/o2CyQaPmakY+OJJ7PqxlWt2/IRoD9WVjqp6zg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de 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=2IfDqWf+Mkd3RsyQnyNtAVKMN0tvP5deMjCf8zrT6EY=; b=aOxM3EU9S0a2T9MmUCR4S596sVoipn6MVdtUK/uj04sgQhBYwvYasrh5D//C84FnD9vhnO3Sr3tEpjICpc0Y4RxIYEq+RA3llGZwEPmw+7kgQYUGFEyYoN2WY2AuWyBgSvJ2MHVY9rszuDkOojByvk7BsCya3jqjhuxK085kgC8= Received: from CH0PR03CA0324.namprd03.prod.outlook.com (2603:10b6:610:118::18) by PH7PR12MB5855.namprd12.prod.outlook.com (2603:10b6:510:1d6::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.16; Sat, 30 Nov 2024 15:20:46 +0000 Received: from DS3PEPF0000C37B.namprd04.prod.outlook.com (2603:10b6:610:118:cafe::59) by CH0PR03CA0324.outlook.office365.com (2603:10b6:610:118::18) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.15 via Frontend Transport; Sat, 30 Nov 2024 15:20:45 +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 DS3PEPF0000C37B.mail.protection.outlook.com (10.167.23.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8230.7 via Frontend Transport; Sat, 30 Nov 2024 15:20:45 +0000 Received: from AUS-P9-MLIMONCI.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.39; Sat, 30 Nov 2024 09:20:43 -0600 From: Mario Limonciello To: Borislav Petkov , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: , "Gautham R . Shenoy" , "Mario Limonciello" , Perry Yuan , , , , , "Shyam Sundar S K" Subject: [PATCH v7 00/12] Add support for AMD hardware feedback interface Date: Sat, 30 Nov 2024 09:20:11 -0600 Message-ID: <20241130152023.684-1-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: DS3PEPF0000C37B:EE_|PH7PR12MB5855:EE_ X-MS-Office365-Filtering-Correlation-Id: 54b526bf-a020-4172-3465-08dd11528fa3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?GdlysJjGQbgaZbeb4RFKXd1ekQhCNMM?= =?utf-8?q?/tc1+NlsrQfBFDtmaz5LoU6y4i0LklTPWW+vO5fiRznu557GHjuMENCm1A4PFW7uY?= =?utf-8?q?8rDu1FGr8wqJGPuu8TXRDfQlC4pe0Vx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WpnpvV0WehpIrHi7FPbUEbAqySJ3AqPbLe?= =?utf-8?q?85ooKcbnBFQrnDP57f66WSXG1+Bs4y9MUQFHNO+elzCYv4zlPm9i4cigbjw5M+ton?= =?utf-8?q?ZukBw8SOwvrpC+zywUXAJ5W5fFCQApncsX61IHtNsSTzS1gg64GND0rZZ6PgM3KRs?= =?utf-8?q?UKHBk97YcWabk4JpF9OiBwUQpZZW7z73cp2DrxLJoRCwZ6nHAl9gEQUl4fSjt5Tig?= =?utf-8?q?UEn/CChKrnLOv0MIRiu974k1/3U4IB7aRf9mmPRx8KT63SEL2C/VvaVGvPGxBhX06?= =?utf-8?q?qaXPJkF3LGvKkJaQWiw8e5cEjlXEc0wKoMghPEybsFBnlVsFIwmRb3OlepbIXgpJz?= =?utf-8?q?iA8ci0T+W57b/Nu13/o0DIjE47hRXdNTmniceNxt7ZP9nVh2jJYqK72FxLLtgZ5wO?= =?utf-8?q?pFO/BExAaKs?= 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:(13230040)(1800799024)(36860700013)(376014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2024 15:20:45.0369 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 54b526bf-a020-4172-3465-08dd11528fa3 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: DS3PEPF0000C37B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5855 The AMD Heterogeneous core design and Hardware Feedback Interface (HFI) provide behavioral classification and a dynamically updated ranking table for the scheduler to use when choosing cores for tasks. Threads are classified during runtime into enumerated classes. Currently, the driver supports 3 classes (0 through 2). These classes represent thread performance/power characteristics that may benefit from special scheduling behaviors. The real-time thread classification is consumed by the operating system and is used to inform the scheduler of where the thread should be placed for optimal performance or energy efficiency. The thread classification helps to select CPU from a ranking table that describes an efficiency and performance ranking for each classification from two dimensions. The ranking data provided by the ranking table are numbers ranging from 0 to 255, where a higher performance value indicates higher performance capability and a higher efficiency value indicates greater efficiency. All the CPU cores are ranked into different class IDs. Within each class ranking, the cores may have different ranking values. Therefore, picking from each classification ID will later allow the scheduler to select the best core while threads are classified into the specified workload class. This series was originally submitted by Perry Yuan [1] but he is now doing a different role and he asked me to take over. Link: https://lore.kernel.org/all/cover.1724748733.git.perry.yuan@amd.com/ On applicable hardware this series has between a 2% and 5% improvement across various benchmarks. There is however a cost associated with clearing history on the process context switch. On average it increases the delay by 119ns, and also has a wider range in delays (the standard deviation is 25% greater). --- Sorry for those of you that got this twice. I picked the wrong entry in my gitconfig and it didn't use platform-x86. Mario Limonciello (4): MAINTAINERS: Add maintainer entry for AMD Hardware Feedback Driver cpufreq/amd-pstate: Disable preferred cores on designs with workload classification platform/x86/amd: hfi: Set ITMT priority from ranking data platform/x86/amd: hfi: Add debugfs support Perry Yuan (8): Documentation: x86: Add AMD Hardware Feedback Interface documentation x86/msr-index: define AMD heterogeneous CPU related MSR platform/x86: hfi: Introduce AMD Hardware Feedback Interface Driver platform/x86: hfi: parse CPU core ranking data from shared memory platform/x86: hfi: init per-cpu scores for each class platform/x86: hfi: add online and offline callback support platform/x86: hfi: add power management callback x86/process: Clear hardware feedback history for AMD processors Documentation/arch/x86/amd-hfi.rst | 127 ++++++ Documentation/arch/x86/index.rst | 1 + MAINTAINERS | 9 + arch/x86/include/asm/msr-index.h | 5 + arch/x86/kernel/process_32.c | 4 + arch/x86/kernel/process_64.c | 4 + drivers/cpufreq/amd-pstate.c | 6 + drivers/platform/x86/amd/Kconfig | 1 + drivers/platform/x86/amd/Makefile | 1 + drivers/platform/x86/amd/hfi/Kconfig | 21 + drivers/platform/x86/amd/hfi/Makefile | 7 + drivers/platform/x86/amd/hfi/hfi.c | 546 ++++++++++++++++++++++++++ 12 files changed, 732 insertions(+) create mode 100644 Documentation/arch/x86/amd-hfi.rst create mode 100644 drivers/platform/x86/amd/hfi/Kconfig create mode 100644 drivers/platform/x86/amd/hfi/Makefile create mode 100644 drivers/platform/x86/amd/hfi/hfi.c