Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp777703pxb; Wed, 8 Sep 2021 12:06:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqrNH98c+HI+m6eciICSMrZNy+y3sB5+BJowlVfdrnnwH+rSORBfkNqrADl5Ag+0GE6qdO X-Received: by 2002:a05:6402:49a:: with SMTP id k26mr5482024edv.279.1631127977939; Wed, 08 Sep 2021 12:06:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1631127977; cv=pass; d=google.com; s=arc-20160816; b=wTPdmH4UuY5SJ6NAKaBOZ70p9kfCQalZ+tkTRT8wlLSuodbsb64fWFzL9JEFhW3aVL uLEXzIiwtd14Y4n3a2jB8P33TaWfzt4P8d+A6bi/LnhYNTY5TlHQDZovihkd6kIEqgdH ynMzJ5pYcRbEdi2iw0MB9GcxWYUXSPn1kZFWrF/ZYDLPrKGOZW7z9mQmNvI58pJ082B+ xYL0DXZ0PV6TI7zAMT0TCmQO5U3gJ/utH9IKSP5NBlUNmkc0vEBxHemfaXDeXjmh1WH9 oi7XBZcjmiRtdXB1SWwULcXcVLe32y86EAzmRAKLHG4cFvyyu8QvvBQXT2lgloe0NaKB Q95g== 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 :content-language:in-reply-to:user-agent:date:message-id:from :references:cc:to:subject:dkim-signature; bh=ZcJaBEYfCPIioKJYKEYgkbuC6LkyPjeI8YzhvRS79F8=; b=H4xfntIOMNroZzBRazNzg/XR3S1dGbkOEC2FxTDIy+DL+1FOh+MwHsspbvrYxtFjwA 0O1QV1+kBJ8z9oDo15fMHI+aLnn2SA1MlSWOKBWaiuij7Jqz2Q2aRFV4fgOo0C9OfoeC fI6TD5SUI8hAm9x1tj0QvrZX2EBR49qJWWNdVrWlZ84VJpmUtyRkgDXrog/6OcG2bklZ IZXdzJ8nkqqD29j5dObLIT6ePKc1PvPl9mQHKAXSU35zp2QlHK5TPM8dhB2QiWYgvp0E jaGVAsurNOMihGj/KEExWjFeXxRxRm0R3Zybw93RxIrC9P/IEKp9a6jcmu/iAe4kDX7k ahOw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=E0gzwHS3; 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 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b23si3102720edv.199.2021.09.08.12.05.52; Wed, 08 Sep 2021 12:06:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=E0gzwHS3; 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 23.128.96.18 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 S1349726AbhIHSWM (ORCPT + 99 others); Wed, 8 Sep 2021 14:22:12 -0400 Received: from mail-mw2nam12on2067.outbound.protection.outlook.com ([40.107.244.67]:64545 "EHLO NAM12-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1347196AbhIHSWL (ORCPT ); Wed, 8 Sep 2021 14:22:11 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XxvISMoPa/yDJtJE0Bl5SbUw2ND+y/UaNzcEdONGMIDXgT9mFlEwV7hO8eY1JoKMTHVDVi2CWxTYM1AW8ExAhcWdc+rqdtzGGG/LmtiaSzjVPTfxlaBydiCQrKfNyuoW6aG6cCfJpZo7Rl0rqrFOgs6Gnipy/0Ht/h3Ov0K0bkdnUcLiAQbxP9/Z7j3Rk9exVpw7u5h1JFO2M81JfCWdY+le1XO1QfHPHZzM0BKlmPbylQ9/Df9P62b0E6By/8ardxrIew/rr89u6rF22ZN9wQcyv6UInks6INxXezmWBkaXxvapBtUxnHMrb0N2sHNRjMWa/EJlRmgQiTR5iPJHOw== 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; bh=ZcJaBEYfCPIioKJYKEYgkbuC6LkyPjeI8YzhvRS79F8=; b=dj/IqescgZeRBuHe9YhtiWh2dON5acrCaWE2aWOwxfMrdx0rjamo8to6vOR6ZzL13MqSoso9+fFtqElogS11Dt4RPYGctBpaUTH472GUK9O0OblyFNRlI7TW5uKdzUSrZCrMsA8jLR1/bbcAsB/Job/IdhoDsMXuTiHXByIZDw91ciqebp7FbyLfct3eu+1XSTEPiKD/gLgOO6NjdGr1Qjik2+Hpo3/FO4mXTVO0aLV4x8IEdrvXU2KWaknW1SmCdnHWczr30VyVHkmF48nqRmkU+zmUcg9nDVB9uGdb1ooUgGPUODrE+eiBDjcAaAwwWTEDD+kcjn1FGpdPvJg5gQ== 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=ZcJaBEYfCPIioKJYKEYgkbuC6LkyPjeI8YzhvRS79F8=; b=E0gzwHS3v84bhT0EF1fH1BLvc2PY72g3Bfvb9hFnlgdIpPeW1DmTBQqC/X4jiUuSy68XIja5wifulGetXfBciNJ1wlbyi32jY5FW2sJ5Lhyqj+bwdAzPSgpF+5j4EqtzapsmBQ8BbYffdUEKiwR9us+QaARJfoev94NfrRXOBAI= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=amd.com; Received: from SN6PR12MB4720.namprd12.prod.outlook.com (2603:10b6:805:e6::31) by SA0PR12MB4576.namprd12.prod.outlook.com (2603:10b6:806:93::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14; Wed, 8 Sep 2021 18:21:02 +0000 Received: from SN6PR12MB4720.namprd12.prod.outlook.com ([fe80::e134:658f:3a82:f750]) by SN6PR12MB4720.namprd12.prod.outlook.com ([fe80::e134:658f:3a82:f750%4]) with mapi id 15.20.4478.026; Wed, 8 Sep 2021 18:21:02 +0000 Subject: Re: [PATCH 11/19] cpufreq: amd: add amd-pstate performance attributes To: Huang Rui , "Rafael J . Wysocki" , Viresh Kumar , Shuah Khan , Borislav Petkov , Ingo Molnar , linux-pm@vger.kernel.org Cc: Deepak Sharma , Alex Deucher , Mario Limonciello , Jinzhou Su , Xiaojian Du , linux-kernel@vger.kernel.org, x86@kernel.org References: <20210908150001.3702552-1-ray.huang@amd.com> <20210908150001.3702552-12-ray.huang@amd.com> From: "Fontenot, Nathan" Message-ID: Date: Wed, 8 Sep 2021 13:20:58 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 In-Reply-To: <20210908150001.3702552-12-ray.huang@amd.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SN4PR0501CA0067.namprd05.prod.outlook.com (2603:10b6:803:41::44) To SN6PR12MB4720.namprd12.prod.outlook.com (2603:10b6:805:e6::31) MIME-Version: 1.0 Received: from [172.31.130.72] (165.204.78.25) by SN4PR0501CA0067.namprd05.prod.outlook.com (2603:10b6:803:41::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.6 via Frontend Transport; Wed, 8 Sep 2021 18:20:59 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 63df8c71-fc92-44a5-58ef-08d972f569ca X-MS-TrafficTypeDiagnostic: SA0PR12MB4576: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1303; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qBj21znrXWYaHIpy1A76994b/MImoUtUwxCzx4TO+e+7+AvWH2WmRO9vWlJ5yRzFA2NaehyTb14zGJ+OgRqzl1j9EphNMaeVeT71sNBTKmHciriB8sDJLgK93Pa8Km1JLc3EeNAXh43U+/dw+3oHlXd2n5qV+HOnEVELRLr/S1G+e2FT4uJGVzaKf6CgiSLiG4bOX26juw7sZIXjMVidmuHchBxcYOP5ZDOmuOX3WQq15S++Wr/jmus6yNtO7LCbCB2noO/ScUQdcQu5678WmvcDZn/WdSxuo3AgQLMSFPSfDDoxyAMC1b4fvU5Kog9Y1A2L33n9KhcOoD8pe7/MhthOHcXqOufYKs/YQFhFtua/RHRrRP4scLuqwcKwi8MqRqu6sxwaf/Ao+WRjRr1cGGPsceiVPl6colzJJosbJ6OOASVL32OLQgKbBkhYzyYHalam/N/IEOMEf/5IcOuvnnqFWdPB2AsPe6IWzjWULiuv5oPKShb2yDf9WWK3vXg0aynxEyHhnQjLDdQ+n/TeT7Juhjtw7+dtbd9tD34emr1vLmiQlrqy6PGVDlsWYAjedD3CJOJsUKMitNnuT3B6HUDzTXOMC5phUM9+u3SWWo8zYQg9RJlh+dhH1dyjjnTevtN75vseAunxa08EYFNZ91cnD1E99jBnLq+w9S4Gua5nn32lfCO6dESo/NJ+GYwfqSZj3OHTp++sC+g0cioAN7Nge0N3xq0VPsZRppoKrc0= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR12MB4720.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(396003)(39860400002)(376002)(346002)(136003)(26005)(4326008)(2616005)(66556008)(66946007)(5660300002)(86362001)(186003)(83380400001)(66476007)(478600001)(2906002)(8936002)(8676002)(110136005)(16576012)(31696002)(54906003)(31686004)(38100700002)(36756003)(6486002)(316002)(956004)(53546011)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?dlFQLzNGVGIvaDNQaUQrT3VZemtUSlhrZEhWVmtQem8xeVdoWTIzS0ZMcGFF?= =?utf-8?B?QmJQME01Q2oxQmRWSmJpbkFyNWxSMGp2MzBobFZmYkNzN0lKM3dZTTN2L3BG?= =?utf-8?B?dCs0ZGZZdjR0TGkyQmpkQ3JEaURXaXZkSkk3aGpLdlhocnpTWDRNNXBaL2xU?= =?utf-8?B?KzNRTlFSMDJpSW1CNE9kczJFaFNOdVJzNlgrOEdySXl2K1UyRkc4VlhQUndX?= =?utf-8?B?ejh0ajlFeUw3TkVOTDlCN1hhYzFLMXRVSXFjZnNtL2dVNEdXeXh0ZGRaQm5y?= =?utf-8?B?UnIwQ1dhaE5Lei9aRmR4WkxYbXlNQ1dKTkdQUkx6L1ZyZ0FjMHZWbFBULzk0?= =?utf-8?B?Y3J5d3BRdHNRZVRvaG5KSnFvMlRyajNSaGcvUUcvV1pzR0JJdHVXTzh0TCtp?= =?utf-8?B?NjlSbVNwU2NjQ2RGTnhPbnNhYnpFcmNBRjB0WnFQVmFLZlZOMmt1MFVVQldE?= =?utf-8?B?a2hJ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bFcvb3gvKzJBcFc1V2UvaWRLZ3R5MExmRjhBdlBaMHRmWHBr?= =?utf-8?B?aWhGa212Wk1Hd1dxcWJtUFltcTFRL1pMY3ZRZkljUVdUVUlxaGw2RnlmU1dC?= =?utf-8?B?TEMrY1p5WTIya1Q4aExjbDBad21XR29CRXZER3RMWkJadjFTSnNrM2NGSHcz?= =?utf-8?B?RVhrZjVZYzJJMmYvOVJ0dDZreTQ4clVQREFRNWNKV3R4bFE0RFp4a0FRK1hn?= =?utf-8?B?UDIyb2JXWVdRa2tpamtaRTV3WkNRYWxEVlUzZlRFRWNETGdlZVliVUhDeGFM?= =?utf-8?B?NmtjbGlaNXFNRWxoSHhsTEc5d1dsMEVYblFocGU5ZG9nL3I3OUFMS3NoZnFG?= =?utf-8?Q?+wDwF+ocOyfn2xyDCd3zkEYPZT5o/6v1tOjPqfM?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 63df8c71-fc92-44a5-58ef-08d972f569ca X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB4720.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2021 18:21:01.8357 (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: 7GJYAhqsSBy2aGYBLa1+8fxrx6EHMhIlU1wZxLG88ITkeLBlFwfAIUFN12e48nVX7jhewo7t+5jFDHUr34FhQg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4576 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/8/2021 9:59 AM, Huang Rui wrote: > Introduce sysfs attributes to get the different level amd-pstate > performances. > > Signed-off-by: Huang Rui > --- > drivers/cpufreq/amd-pstate.c | 66 ++++++++++++++++++++++++++++++++++++ > 1 file changed, 66 insertions(+) > > diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c > index 3c727a22cb69..9c60388d45ed 100644 > --- a/drivers/cpufreq/amd-pstate.c > +++ b/drivers/cpufreq/amd-pstate.c > @@ -647,6 +647,62 @@ static ssize_t show_amd_pstate_min_freq(struct cpufreq_policy *policy, char *buf > return ret; > } > > +static ssize_t > +show_amd_pstate_highest_perf(struct cpufreq_policy *policy, char *buf) Here (and in the other functions) the function return value and name should be on the same line. > +{ > + int ret = 0; > + u32 perf; > + struct amd_cpudata *cpudata = policy->driver_data; > + > + perf = READ_ONCE(cpudata->highest_perf); > + > + ret += sprintf(&buf[ret], "%u\n", perf); > + > + return ret; Same comment as the previous patch here and in the functions below, just do return sprintf(&buf[ret], "%u\n", perf); and get rid of the intermediary 'ret' variable. -Nathan > +} > + > +static ssize_t > +show_amd_pstate_nominal_perf(struct cpufreq_policy *policy, char *buf) > +{ > + int ret = 0; > + u32 perf; > + struct amd_cpudata *cpudata = policy->driver_data; > + > + perf = READ_ONCE(cpudata->nominal_perf); > + > + ret += sprintf(&buf[ret], "%u\n", perf); > + > + return ret; > +} > + > +static ssize_t > +show_amd_pstate_lowest_nonlinear_perf(struct cpufreq_policy *policy, char *buf) > +{ > + int ret = 0; > + u32 perf; > + struct amd_cpudata *cpudata = policy->driver_data; > + > + perf = READ_ONCE(cpudata->lowest_nonlinear_perf); > + > + ret += sprintf(&buf[ret], "%u\n", perf); > + > + return ret; > +} > + > +static ssize_t > +show_amd_pstate_lowest_perf(struct cpufreq_policy *policy, char *buf) > +{ > + int ret = 0; > + u32 perf; > + struct amd_cpudata *cpudata = policy->driver_data; > + > + perf = READ_ONCE(cpudata->lowest_perf); > + > + ret += sprintf(&buf[ret], "%u\n", perf); > + > + return ret; > +} > + > static ssize_t show_is_amd_pstate_enabled(struct cpufreq_policy *policy, > char *buf) > { > @@ -654,17 +710,27 @@ static ssize_t show_is_amd_pstate_enabled(struct cpufreq_policy *policy, > } > > cpufreq_freq_attr_ro(is_amd_pstate_enabled); > + > cpufreq_freq_attr_ro(amd_pstate_max_freq); > cpufreq_freq_attr_ro(amd_pstate_nominal_freq); > cpufreq_freq_attr_ro(amd_pstate_lowest_nonlinear_freq); > cpufreq_freq_attr_ro(amd_pstate_min_freq); > > +cpufreq_freq_attr_ro(amd_pstate_highest_perf); > +cpufreq_freq_attr_ro(amd_pstate_nominal_perf); > +cpufreq_freq_attr_ro(amd_pstate_lowest_nonlinear_perf); > +cpufreq_freq_attr_ro(amd_pstate_lowest_perf); > + > static struct freq_attr *amd_pstate_attr[] = { > &is_amd_pstate_enabled, > &amd_pstate_max_freq, > &amd_pstate_nominal_freq, > &amd_pstate_lowest_nonlinear_freq, > &amd_pstate_min_freq, > + &amd_pstate_highest_perf, > + &amd_pstate_nominal_perf, > + &amd_pstate_lowest_nonlinear_perf, > + &amd_pstate_lowest_perf, > NULL, > }; > > -- > 2.25.1 >