Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp708354rdg; Thu, 12 Oct 2023 20:32:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFQ3qHKkon4b41bn7KfmybiYX/+f5rSZwtlyFc8d2wV0lcQlrmOEa1JFPXoRbKPJmXx16SE X-Received: by 2002:a05:6a21:33a8:b0:16b:8bcf:9e27 with SMTP id yy40-20020a056a2133a800b0016b8bcf9e27mr21439295pzb.20.1697167939473; Thu, 12 Oct 2023 20:32:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697167939; cv=pass; d=google.com; s=arc-20160816; b=Vc/Wfperfn8+MJomUZrhxsenDid0lknszxU5V+N+PDkoSMDm9MwBSWRc0qSZwZc/4c xHVhTPATP8DDTyFuLYpX4OhMVaUUkwRzFoKGTrlXKJ5ymZSh77QAoBOOPRZ7f8hrCPN9 /pitoZsIOxzjkzD0nNlTjVcCloHauAZV8RcmwfGLjpoDYO4b9T+wrkD+5t+0d8MTCzYH lHRLJD63QdN8IVvNpJFIpooWZJuOVG41wuCBCXhD6yXSxSssw5Ldy2APfggziEDpPSK6 PpP8RPA3jHVPFBX+Z5dBkPe14wplb5pzp6678oAq0M1Ig/5xowdpkjZOgr1WHnxE2JDk Cxbw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=uiWgNhl01VvplaAyf2iuYByBio3MNffw7BQYB+fLP9o=; fh=hGvksXpWJomenCq+IRP0QZoot/B1Zo6LHbgOlSKBIRE=; b=ViuBNT7U5O8S/ZjxbBUBMEy24vxWplRKNDn+cpjslwv41Iluiv+1XdUAtxdmhnSf96 A77IwKYg+ZEpd8fk9Lv2ab9XOx0e1mRCv/pGS0xmGnTYMuEGOZMMO9SPqaeqjU4W4Z1c kCezkVcHqGy6yLHRy/WEHRAFPbjXBp0C2poKqvSXP8clIvYPpRb/DQbJXg4cRnbmjBUM pSraln/75ze7x9H6nEnHge54C3rXJ2/v21WueiZ7mTSCekCdk4mMQvKmG0Ncx0glrysC YtEdJLUCLke+pJ5iP/FIVqd0qU474w5fIlMF0hlPpnoBBtr5yKxOEPjVqmsZP/aDob3w 92RA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=NXgTWxlW; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id fw21-20020a17090b129500b0026810b074afsi2842033pjb.3.2023.10.12.20.32.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 20:32:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=NXgTWxlW; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 4E20A82A41EC; Thu, 12 Oct 2023 20:32:16 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229563AbjJMDb7 (ORCPT + 99 others); Thu, 12 Oct 2023 23:31:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbjJMDb4 (ORCPT ); Thu, 12 Oct 2023 23:31:56 -0400 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2065.outbound.protection.outlook.com [40.107.96.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FB79BB; Thu, 12 Oct 2023 20:31:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SOQF3ChJiQwcrR1VNIDTV/L5NQ5JFyOMplXkRSqQfl/1Kxj3vVS8TDzUbdahB1qC75povCD0NrtTHZSG2U8mDRt8kyvsqscVuUCrwiSSUurUbxM35ojOd2FBTTAx5QV1fH9ed7mxpSxFW71sIwmMww+XkI7EYFg8Tcei0S80EEZmgkAgwmfejDNg41rmV6MnE93cs/SG8ploItOpC6o50sSvmYXNhheSsktGbKya1vyUM16KyIP/CJwFlv1JXC+E8Oz0gV+POGVOVfUDSFeNMPLqusqXkJvYFXO0uiGvOnV8dBW2nXDPgkXGNy8FK6+16GTO4qBd8wqelGSVtz7BxA== 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=uiWgNhl01VvplaAyf2iuYByBio3MNffw7BQYB+fLP9o=; b=K6Y2CTHPjSKdE95IJTA8FpqYsn1GRGZj1cbEP+ExEjwe7ixZl2jIw74eEFhFyqDH06ga/PDrx775OybmfaNtW0OjRV0y4JF0eS8gViQJcJuhNrxQsyFnfgc6ONn3fN/WjcWcQC9Ry3+nkieGVFIAXA8B1JyBQ++0ENuSayCVvoHJVcnjb9n9M0LyWhCzUcUX2lS4CiLkv2CA8KjFw/nW6jui5XJ1Za2o27WI7Ga4qRYD6Q29be+7kAh5HtaPySvWAxvtrV/D0GLIXBr/M7O2QsajVPEyiwhUNElBGSGrvPbvyeGmf5mkcL4TgUO8oLnfSg3cLF+CrCclEkkbM765CQ== 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 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=uiWgNhl01VvplaAyf2iuYByBio3MNffw7BQYB+fLP9o=; b=NXgTWxlWYL30aRyGHbXYt2KZuZoirAWRfX1jM4/tCigOHePMC75iYHpxXXCIHiIvZLmphNPCg8nzj+Hjws34F84vGc2kADLFlXEwKZKaNocbo1euoCRFhqRtyt9Zu51LQESfLdVXJm0OuwE/WRnRYzYdPuZ31M43exySEwSofpk= Received: from MW4PR04CA0340.namprd04.prod.outlook.com (2603:10b6:303:8a::15) by DS7PR12MB5717.namprd12.prod.outlook.com (2603:10b6:8:70::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.44; Fri, 13 Oct 2023 03:31:47 +0000 Received: from CO1PEPF000042A9.namprd03.prod.outlook.com (2603:10b6:303:8a:cafe::df) by MW4PR04CA0340.outlook.office365.com (2603:10b6:303:8a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.28 via Frontend Transport; Fri, 13 Oct 2023 03:31:47 +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 CO1PEPF000042A9.mail.protection.outlook.com (10.167.243.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Fri, 13 Oct 2023 03:31:47 +0000 Received: from jasmine-meng.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.27; Thu, 12 Oct 2023 22:31:41 -0500 From: Meng Li To: "Rafael J . Wysocki" , Huang Rui CC: , , , , Shuah Khan , , "Nathan Fontenot" , Deepak Sharma , Alex Deucher , Mario Limonciello , Shimmer Huang , "Perry Yuan" , Xiaojian Du , Viresh Kumar , Borislav Petkov , "Oleksandr Natalenko" , Meng Li Subject: [RESEND PATCH V9 0/7] amd-pstate preferred core Date: Fri, 13 Oct 2023 11:31:11 +0800 Message-ID: <20231013033118.3759311-1-li.meng@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: CO1PEPF000042A9:EE_|DS7PR12MB5717:EE_ X-MS-Office365-Filtering-Correlation-Id: 4b1caf4d-bc82-4828-b151-08dbcb9cee2f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KUCM5bfHpEr/TDCSTuhKi/rMn7H+8R1yyrzylMVBvDgeTzADjsVTNGBaFapw5le8g5dCwNPvXIBCLHKgYlCsMvSN7mIF6FDVVUSjUJnoYc5pjWnlc+/TSG9sqfCT0rpqMA7RYF3HesW7buB4icCDI2tEQKXoMM2FuJwnK4IaA0fASDR1OmdnlANUMVnB30QdDmmu+xo+cb9xtRMjaAFR4TwkNCVudeBewNZHhZfbHcpDUP7rn8mgMnCUyvxoJhKagzPDwzxWabU8CTPedo+WRYSFe6jAfAn09+12Vv0omvKEDr7ouBfRWilfnrXU3rK7lKTI7CzuAm3WTMW+/DzLJ2UVnSNTydseca7kWwIn/HnkfIN+Y3N9Zu1S5l+frrgc5dcaMH+bCSCsH6X2L0k/ixGu37HtL1F5wnZ5Vje8zQVtcIEyYXqa/dAxCZS0JVuvjWUIMwItynM6KYeAjEuSQ/TqN9mZQq4S/jVtTf+VIY/mIlVtM7BaNxbcZz7vpLRmGg77ERuj17OsOLi2UPFkz3fqGFS8DvsjFaz5SrhBR3CQAT+PvIHxf0/ZopoH8rs8waZ+xu2NytAuGZIAqlxCdJa4VaP8Bz3krQ7vPRwM9CbMwcbOtvL/4PTKylh9YWNywJ/9anIkD0kvVywYETRLy3etK32CUc7EQcV4MlN8Q6Q3IPZd/hYXbjnkAJVKCCbpTbqfMKznkCux76cBEz+GnrcjKaJfoIuKy5Max4ntJUP45wn0XDDifnGoQ/K0wcCY8s1MRat2pJjChP5VYSjJ9A== 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)(136003)(346002)(376002)(396003)(39860400002)(230922051799003)(186009)(1800799009)(64100799003)(82310400011)(451199024)(46966006)(40470700004)(36840700001)(47076005)(7696005)(26005)(36756003)(6666004)(36860700001)(478600001)(1076003)(16526019)(426003)(2616005)(336012)(110136005)(83380400001)(316002)(6636002)(70206006)(54906003)(70586007)(356005)(41300700001)(81166007)(8676002)(4326008)(8936002)(40460700003)(82740400003)(5660300002)(40480700001)(2906002)(7416002)(86362001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2023 03:31:47.2778 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4b1caf4d-bc82-4828-b151-08dbcb9cee2f 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: CO1PEPF000042A9.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5717 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 12 Oct 2023 20:32:16 -0700 (PDT) Hi all: The core frequency is subjected to the process variation in semiconductors. Not all cores are able to reach the maximum frequency respecting the infrastructure limits. Consequently, AMD has redefined the concept of maximum frequency of a part. This means that a fraction of cores can reach maximum frequency. To find the best process scheduling policy for a given scenario, OS needs to know the core ordering informed by the platform through highest performance capability register of the CPPC interface. Earlier implementations of amd-pstate preferred core only support a static core ranking and targeted performance. Now it has the ability to dynamically change the preferred core based on the workload and platform conditions and accounting for thermals and aging. Amd-pstate driver utilizes the functions and data structures provided by the ITMT architecture to enable the scheduler to favor scheduling on cores which can be get a higher frequency with lower voltage. We call it amd-pstate preferred core. Here sched_set_itmt_core_prio() is called to set priorities and sched_set_itmt_support() is called to enable ITMT feature. Amd-pstate driver uses the highest performance value to indicate the priority of CPU. The higher value has a higher priority. Amd-pstate driver will provide an initial core ordering at boot time. It relies on the CPPC interface to communicate the core ranking to the operating system and scheduler to make sure that OS is choosing the cores with highest performance firstly for scheduling the process. When amd-pstate driver receives a message with the highest performance change, it will update the core ranking. Changes form V8->V9: - all: - - pick up Tested-By flag added by Oleksandr. - cpufreq: amd-pstate: - - pick up Review-By flag added by Wyes. - - ignore modification of bug. - - add a attribute of prefcore_ranking. - - modify data type conversion from u32 to int. - Documentation: amd-pstate: - - pick up Review-By flag added by Wyes. Changes form V7->V8: - all: - - pick up Review-By flag added by Mario and Ray. - cpufreq: amd-pstate: - - use hw_prefcore embeds into cpudata structure. - - delete preferred core init from cpu online/off. Changes form V6->V7: - x86: - - Modify kconfig about X86_AMD_PSTATE. - cpufreq: amd-pstate: - - modify incorrect comments about scheduler_work(). - - convert highest_perf data type. - - modify preferred core init when cpu init and online. - acpi: cppc: - - modify link of CPPC highest performance. - cpufreq: - - modify link of CPPC highest performance changed. Changes form V5->V6: - cpufreq: amd-pstate: - - modify the wrong tag order. - - modify warning about hw_prefcore sysfs attribute. - - delete duplicate comments. - - modify the variable name cppc_highest_perf to prefcore_ranking. - - modify judgment conditions for setting highest_perf. - - modify sysfs attribute for CPPC highest perf to pr_debug message. - Documentation: amd-pstate: - - modify warning: title underline too short. Changes form V4->V5: - cpufreq: amd-pstate: - - modify sysfs attribute for CPPC highest perf. - - modify warning about comments - - rebase linux-next - cpufreq: - - Moidfy warning about function declarations. - Documentation: amd-pstate: - - align with ``amd-pstat`` Changes form V3->V4: - Documentation: amd-pstate: - - Modify inappropriate descriptions. Changes form V2->V3: - x86: - - Modify kconfig and description. - cpufreq: amd-pstate: - - Add Co-developed-by tag in commit message. - cpufreq: - - Modify commit message. - Documentation: amd-pstate: - - Modify inappropriate descriptions. Changes form V1->V2: - acpi: cppc: - - Add reference link. - cpufreq: - - Moidfy link error. - cpufreq: amd-pstate: - - Init the priorities of all online CPUs - - Use a single variable to represent the status of preferred core. - Documentation: - - Default enabled preferred core. - Documentation: amd-pstate: - - Modify inappropriate descriptions. - - Default enabled preferred core. - - Use a single variable to represent the status of preferred core. Meng Li (7): x86: Drop CPU_SUP_INTEL from SCHED_MC_PRIO for the expansion. acpi: cppc: Add get the highest performance cppc control cpufreq: amd-pstate: Enable amd-pstate preferred core supporting. cpufreq: Add a notification message that the highest perf has changed cpufreq: amd-pstate: Update amd-pstate preferred core ranking dynamically Documentation: amd-pstate: introduce amd-pstate preferred core Documentation: introduce amd-pstate preferrd core mode kernel command line options .../admin-guide/kernel-parameters.txt | 5 + Documentation/admin-guide/pm/amd-pstate.rst | 59 ++++- arch/x86/Kconfig | 5 +- drivers/acpi/cppc_acpi.c | 13 ++ drivers/acpi/processor_driver.c | 6 + drivers/cpufreq/amd-pstate.c | 204 ++++++++++++++++-- drivers/cpufreq/cpufreq.c | 13 ++ include/acpi/cppc_acpi.h | 5 + include/linux/amd-pstate.h | 10 + include/linux/cpufreq.h | 5 + 10 files changed, 305 insertions(+), 20 deletions(-) -- 2.34.1