Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2475967rwb; Fri, 9 Dec 2022 02:34:24 -0800 (PST) X-Google-Smtp-Source: AA0mqf5WWz59Dj5qj6fFCXxB1V4QDwNIgG8cR1sjcczXHbpRBo4WBHHEgcv1+3pmyJ5mMWjI+aAo X-Received: by 2002:a17:907:c0b:b0:7ae:cd3b:207f with SMTP id ga11-20020a1709070c0b00b007aecd3b207fmr7189487ejc.46.1670582064738; Fri, 09 Dec 2022 02:34:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1670582064; cv=pass; d=google.com; s=arc-20160816; b=QgzpdrPRFJkoJOCRoZPl4NpHwEip/hSM1YVGR6EHN3soUd9saqcOgf83iaeR9X6T5z D4GhTRJf+z2o/Ek+AIx1bDJizuxISBgnUqIiQb/KJCk6u0ZzYh6AeKjzqD/4SV1j6wDR knCNRUJcIFUlkrvXnbx5A4OgMEDUA1MSe/TmiX8yqSCwqqk9JV5rMmXY2I6+Mg1Qx4Xl TQ1AvMGrBVBKFr6/jYzk6mrGbEmaTIGVmy0HVuS8Quee7J7uLCRcbjL0GSS/88R+mVlH F7vdekrNx/hThlyvK8CB5FEmvGlYecTfIfXvkmp90OhMczQQ3QAQonVEtAPNbGzwxgBG 84OA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=2uHmQkfTVeLQQ3ARz6mPCHvI5t/ufkyMypamyJu2OSQ=; b=L4IQw5b4TDDnUAmxIukHQ+cnOWl1J8YdeBLphY8jrJWJWbU2q4S0IZTTDP+zY2dK2H c366OZGc9JEFNkqa1P1gTh+eqC6Ug0xKWxaZXzs8SZoo30q2ehf2SFyA2Xq2eqjNN9/P 8u4jIdfwNQhCZ6QK8c7gqTcqXlYl9MtIr6cR1v0ZZaCmar0HtShXZV38SIbtsryCU2Wx DjQCkQ/L3EXDcrcRzMS3KscKK6d3iNlQBh7njaGO8Wm7QuSaC9qaredE/9Q08zMj/b7z NtC78VdqBpeDA4FwrTWMwrbpyNro+rT1xqa/CoOCJTq81AedDSUIRdpekyzhppxOJzDi P6qQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="bbPz/RxU"; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id go39-20020a1709070da700b007c0bc7057d7si1109704ejc.202.2022.12.09.02.34.07; Fri, 09 Dec 2022 02:34:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="bbPz/RxU"; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229908AbiLIKFB (ORCPT + 74 others); Fri, 9 Dec 2022 05:05:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229816AbiLIKEp (ORCPT ); Fri, 9 Dec 2022 05:04:45 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2070.outbound.protection.outlook.com [40.107.93.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE8F763B90; Fri, 9 Dec 2022 02:04:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KzbcV48YyBWwgqpCWaUoWl/Rh2/WeXMzX2esW8b8RJz7rRD/WcMhQKwJMrhM0dKymuwQQ9TicqUGIlMrj6DJX3dJJY68euzGu/x/2qWsGqen/70uSBDn+4jBOJ8txJOhzl/IfhnwO9/eS1U51/jZQX+3qlFSa19SIJRlDDh+2py3U9vtnHupV6JNAckaCPfg236ZV4/cGGDCZzrPb2oQaVIn0fpcK+y8hDgHHGQ6FEPoUBnM3QBdLiMBMrKRQ+YKsOsvBvTkBrllzXmBFNy76Qi0DX2Gmp58FsgzvidyTurfKh7kF+Gf6auUaNyK58vbgGxqExYVUsnrKkOf/gr8sw== 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=2uHmQkfTVeLQQ3ARz6mPCHvI5t/ufkyMypamyJu2OSQ=; b=AqB0TBpth1jsyZVswCxsWGVH4G5/lku7tedSthle0Vi/lwnrWOP7k7T65xhuO032hxwLXgXcisjkhKT54BT2TT29uYeT7lu8+ntAsewUAeYOgpRvk68pJxgEtw8b9bLl2jJ9OU9rW4I3eXoYjc7SQAZCkIzRtRNcc70dJqrfs5wJyzYAf23fwZUr5+D9oK7BCLp8Ji5/REcJpdcV9cGOuTW8R+Yaji3b7qoX5Ky18jOYmuYjOaEChD3mQ6DEuFIQAY4HFJp18nbgZhTLy0jsRRArEETzvvyKFoitDivbIjoLNS+gK4zmNRaBTUS62kB2trjmxwq5hGgPSYpuBSuR0w== 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=2uHmQkfTVeLQQ3ARz6mPCHvI5t/ufkyMypamyJu2OSQ=; b=bbPz/RxUAbp9ae1lWjxtWnYYNy+hM9DyLvXAT7tYTkSJoadAajykJP2YBoXwCPz5c9Erlh9yk+EZTH4PUlKcq1uLM6sSlwLSgH/hEccW76iCsYP4fpuXdvjRDYT8dlmvE/KBKQTIxSugo7Xx7KbIiSB73ofQ0cT2jgHxEql6Aw8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from BY5PR12MB3876.namprd12.prod.outlook.com (2603:10b6:a03:1a7::26) by DM4PR12MB6302.namprd12.prod.outlook.com (2603:10b6:8:a4::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.14; Fri, 9 Dec 2022 10:04:41 +0000 Received: from BY5PR12MB3876.namprd12.prod.outlook.com ([fe80::45ef:724b:4b64:b98]) by BY5PR12MB3876.namprd12.prod.outlook.com ([fe80::45ef:724b:4b64:b98%3]) with mapi id 15.20.5880.016; Fri, 9 Dec 2022 10:04:41 +0000 Message-ID: <99fdd501-9cc3-1570-21fb-7d5878e21543@amd.com> Date: Fri, 9 Dec 2022 15:34:28 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH 1/4] cpufreq: amd_pstate: Add guided autonomous mode Content-Language: en-US To: Huang Rui Cc: "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-pm@vger.kernel.org" , Jonathan Corbet , "Rafael J . Wysocki" , Viresh Kumar , "Limonciello, Mario" , "Yuan, Perry" , "Narayan, Ananth" , "Shenoy, Gautham Ranjal" References: <20221207154648.233759-1-wyes.karny@amd.com> <20221207154648.233759-2-wyes.karny@amd.com> From: Wyes Karny In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: PN3PR01CA0156.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:c8::9) To BY5PR12MB3876.namprd12.prod.outlook.com (2603:10b6:a03:1a7::26) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY5PR12MB3876:EE_|DM4PR12MB6302:EE_ X-MS-Office365-Filtering-Correlation-Id: f08f7174-dbba-4f56-222c-08dad9ccca05 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: U87VgzdIsvudEl4SvcFJJovjfYgFWd2remKg50EdiDAEUbHS0EVhHi94MOkk+joy422RMQ7MYm2pltTT6tsEfahN0bje304KxI9+ezfYRhR5TeWnV/Gi5rGc9gKSrZSW1b0kKY7Lz4wMLi/yzfbfMGVM9drz2U3xopXQOQ+p3ZIiWrrIFyBTI605VvDLGroS2Js5Mrja38JvasbnVtFVXtOO2NcVybhvar8vdk2OtKdF00PQXdllA5PS+V6TkV8Nz/5i3rnSAhKYZL8s0PF5477WuH8v/5k+TkfYj4nwlV0A+AiAc0OvboDjTaE4/TnSZZG3uQCWejQgCqZKIxqZO9XiHtaZdiHVGu42TZnL14+3UmxVfmCyLDqPJcp1awj7ZroYLmRWtYdW4R3s5s02MbeMBPTGlSkZoWWdVNM7tsZyFtyBtVgluty2EDfPsmMzehHxgA2TeJAzjhm79AmV33lR00FLzihMMXrn5jZ2ftc+JX2N5QqlzkjEOxPuc3l/QBfNtd+L3YQtfHmgJvfoqrIw66RNWHUVIoFkIjqY6iGnrzRa+n5HXvoAbQFKo0rRUuwiQjl1rlHHLR631ATkMIBl+YQ4a5DcffpaNHZRZn6BsEh+J3PTDNBvmn+4PH4RVuVVdvepcmCBuxJ0QnfCrLNZRFEuBDlXC8rwrkROBvPDwju3pTc4s9kaS2P6RcJupm4h1VRIkRoQNwvccBUivfuH578HVIdcL8UVp2pfLx4= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR12MB3876.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(346002)(396003)(136003)(376002)(39860400002)(366004)(451199015)(6512007)(83380400001)(6506007)(26005)(53546011)(186003)(6666004)(2616005)(38100700002)(31696002)(36756003)(6486002)(478600001)(86362001)(66556008)(37006003)(8936002)(66946007)(66476007)(6636002)(4326008)(316002)(5660300002)(44832011)(41300700001)(54906003)(2906002)(8676002)(6862004)(31686004)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?bW5hNThqeG1JS3A5WVpjQzZ0L29tTVBvZytQTnVtL0o1S2Npb3FUcUJseUZh?= =?utf-8?B?QWFaTC9JZGxzVVdiRmJ4VVp3RGVic251Zjl0V3FHNm5WUWg5MmhKcmFhNEVn?= =?utf-8?B?THpwK3VNc1dkMXFaQmRiYmZIdVJGWUFKY1grTDVsSUlJdmF6OENnMzJXOWJx?= =?utf-8?B?NEMyc2RVdmQ0dzAzS0NPam0zMlRJOUZ6UnMrckJwMklkWHVtbXhseFU3d2xT?= =?utf-8?B?bXNTTFFCSXh3cDNzblR4d3k5S3JZTk41WUp0eFduWWhmbVFmdnltZlQrdHpn?= =?utf-8?B?T2JmSXNHTFFuRFgyMUNKL3YyZVROWnRJV1o0VVVIK2V3d3hhSHQyY0tpUHl4?= =?utf-8?B?UTdUN0hTTGlhZFY5N2MvczREd1V3K0VvMTNPZkthSWZRblp4RC93azRt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08dad9ccca05 X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB3876.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2022 10:04:41.6142 (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: v4saKOp0pRrEsvoVt0PTGtePkRk7Y9Omg/0A/iqOsq/nh9mz7DRnqjVplycbRLsS+sTaB+DwbUDiAewgAi9ErA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6302 X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Ray, On 12/9/2022 1:13 PM, Huang Rui wrote: > On Wed, Dec 07, 2022 at 11:46:45PM +0800, Karny, Wyes wrote: >> From ACPI spec below 3 modes for CPPC can be defined: >> 1. Non autonomous: OS scaling governor specifies operating frequency/ >> performance level through `Desired Performance` register and PMFW >> follows that. >> 2. Guided autonomous: OS scaling governor specifies min and max >> frequencies/ performance levels through `Minimum Performance` and >> `Maximum Performance` register, and PMFW can autonomously select an >> operating frequency in this range. >> 3. Fully autonomous: OS only hints (via EPP) to PMFW for the required >> energy performance preference for the workload and PMFW autonomously >> scales the frequency. >> >> Currently (1) is supported by amd_pstate as passive mode, and (3) is >> implemented by EPP support. This change is to support (2). >> >> In guided autonomous mode the min_perf is based on the input from the >> scaling governor. For example, in case of schedutil this value depends >> on the current utilization. And max_perf is set to max capacity. >> >> To activate guided auto mode ``amd_pstate=guided`` command line >> parameter has to be passed in the kernel. >> >> Signed-off-by: Wyes Karny >> --- >> .../admin-guide/kernel-parameters.txt | 4 ++ >> drivers/cpufreq/amd-pstate.c | 60 +++++++++++++++---- >> 2 files changed, 53 insertions(+), 11 deletions(-) >> >> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt >> index 42af9ca0127e..75e57afba77e 100644 >> --- a/Documentation/admin-guide/kernel-parameters.txt >> +++ b/Documentation/admin-guide/kernel-parameters.txt >> @@ -6970,3 +6970,7 @@ >> management firmware translates the requests into actual >> hardware states (core frequency, data fabric and memory >> clocks etc.) >> + guided >> + Activate guided autonomous mode. Driver requests minimum >> + performance and maximum performance and the PMFW autonomously >> + selects frequencies in this range. >> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c >> index 204e39006dda..05e4003a77ee 100644 >> --- a/drivers/cpufreq/amd-pstate.c >> +++ b/drivers/cpufreq/amd-pstate.c >> @@ -50,6 +50,20 @@ >> #define AMD_PSTATE_TRANSITION_LATENCY 20000 >> #define AMD_PSTATE_TRANSITION_DELAY 1000 >> >> +enum amd_pstate_mode { >> + CPPC_DISABLE = 0, >> + CPPC_PASSIVE, >> + CPPC_GUIDED, >> + CPPC_MODE_MAX, >> +}; >> + >> +static const char * const amd_pstate_mode_string[] = { >> + [CPPC_DISABLE] = "disable", >> + [CPPC_PASSIVE] = "passive", >> + [CPPC_GUIDED] = "guided", >> + NULL, >> +}; >> + >> /* >> * TODO: We need more time to fine tune processors with shared memory solution >> * with community together. >> @@ -60,7 +74,18 @@ >> * module parameter to be able to enable it manually for debugging. >> */ >> static struct cpufreq_driver amd_pstate_driver; >> -static int cppc_load __initdata; >> +static int cppc_state = CPPC_DISABLE; >> + >> +static inline int get_mode_idx_from_str(const char *str, size_t size) >> +{ >> + int i = 0; >> + >> + for (; i < CPPC_MODE_MAX; ++i) { >> + if (!strncmp(str, amd_pstate_mode_string[i], size)) >> + return i; >> + } >> + return -EINVAL; >> +} >> >> static inline int pstate_enable(bool enable) >> { >> @@ -212,12 +237,18 @@ static inline bool amd_pstate_sample(struct amd_cpudata *cpudata) >> } >> >> static void amd_pstate_update(struct amd_cpudata *cpudata, u32 min_perf, >> - u32 des_perf, u32 max_perf, bool fast_switch) >> + u32 des_perf, u32 max_perf, bool fast_switch, int flags) >> { >> u64 prev = READ_ONCE(cpudata->cppc_req_cached); >> u64 value = prev; >> >> des_perf = clamp_t(unsigned long, des_perf, min_perf, max_perf); >> + >> + if (cppc_state == CPPC_GUIDED && flags & CPUFREQ_GOV_DYNAMIC_SWITCHING) { >> + min_perf = des_perf; >> + des_perf = 0; >> + } > > Since we would like to modify the min_perf on share memory processors as > well. The current cppc_set_perf() in cppc_acpi doesn't provide the MIN/MAX > values. Could you please add the max_perf/min_perf in cppc_acpi.c as well? > Then the APIs will be available on the share memory processors like Rome. Sure. Thanks for pointing this out. > > Thanks, > Ray > >> + >> value &= ~AMD_CPPC_MIN_PERF(~0L); >> value |= AMD_CPPC_MIN_PERF(min_perf); >> >> @@ -272,7 +303,7 @@ static int amd_pstate_target(struct cpufreq_policy *policy, >> >> cpufreq_freq_transition_begin(policy, &freqs); >> amd_pstate_update(cpudata, min_perf, des_perf, >> - max_perf, false); >> + max_perf, false, policy->governor->flags); >> cpufreq_freq_transition_end(policy, &freqs, false); >> >> return 0; >> @@ -306,7 +337,8 @@ static void amd_pstate_adjust_perf(unsigned int cpu, >> if (max_perf < min_perf) >> max_perf = min_perf; >> >> - amd_pstate_update(cpudata, min_perf, des_perf, max_perf, true); >> + amd_pstate_update(cpudata, min_perf, des_perf, max_perf, true, >> + policy->governor->flags); >> } >> >> static int amd_get_min_freq(struct amd_cpudata *cpudata) >> @@ -627,7 +659,7 @@ static int __init amd_pstate_init(void) >> * enable the amd_pstate passive mode driver explicitly >> * with amd_pstate=passive in kernel command line >> */ >> - if (!cppc_load) { >> + if (cppc_state == CPPC_DISABLE) { >> pr_debug("driver load is disabled, boot with amd_pstate=passive to enable this\n"); >> return -ENODEV; >> } >> @@ -670,16 +702,22 @@ device_initcall(amd_pstate_init); >> >> static int __init amd_pstate_param(char *str) >> { >> + int size, mode_idx; >> + >> if (!str) >> return -EINVAL; >> >> - if (!strcmp(str, "disable")) { >> - cppc_load = 0; >> - pr_info("driver is explicitly disabled\n"); >> - } else if (!strcmp(str, "passive")) >> - cppc_load = 1; >> + size = strlen(str); >> + mode_idx = get_mode_idx_from_str(str, size); >> >> - return 0; >> + if (mode_idx >= CPPC_DISABLE && mode_idx < CPPC_MODE_MAX) { >> + cppc_state = mode_idx; >> + if (cppc_state == CPPC_DISABLE) >> + pr_info("driver is explicitly disabled\n"); >> + return 0; >> + } >> + >> + return -EINVAL; >> } >> early_param("amd_pstate", amd_pstate_param); >> >> -- >> 2.34.1 >> -- Thanks & Regards, Wyes