Message ID | 20231123082757.3527-1-gautham.shenoy@amd.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp297273vqx; Thu, 23 Nov 2023 00:28:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IGgqPSZj+GHGBQ40TyQtTn3ycJoufhThLc7g7nJO3WLgVi3QZI3lI7lQivSvPTmwguInjtP X-Received: by 2002:a05:6808:1782:b0:3b8:4406:73a with SMTP id bg2-20020a056808178200b003b84406073amr4064486oib.9.1700728132162; Thu, 23 Nov 2023 00:28:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700728132; cv=pass; d=google.com; s=arc-20160816; b=juuNcvFVR5qHkPXW7Re3D5DlM5TMZ71IAzlBnQFLgJZmCyPlDBYYbLqR18414Sn14j o7H9a2aUKIYnqHh55BMXo3skKggrR2I3VUokq5ma3Nj4hN/3mJcXSRKDDfwH7Iwwz31d JwqsjZA7yUDuNYNZtJ52fQCEB5z4nIBl2mKbPBXhV5VmjbGvrcibOrGNhiwxm4nex+qL yGLKEZjjUORenHhXXFduVRjDWdz+qxgXJfKzEY/D1ssETFmnHGdX3xU1byJSM2iBN4DN RxPEszBEQ2L5wUb+fPFF5IBfDRDu/q37xBAIIy1PpR5LUfThPcOSarJgP3HAXYKQ1oR0 fjRA== 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=iA1DghR5CuUIJAL1SUAdXjQCkegyBdqtzc06cDEKgfc=; fh=hOmvbnKHHzRLqMWO4PRq5LtSEtCVQo4fsflzLaj9crk=; b=LCj8HvBSDPeMxF8dazaStv3LGp1wWu/Q38LDdEV6pP+X+XQUv/jRI6qpVQDcxYHgUr WuMTD58PR69dInZ86MP7GnO3xN/mPmBlMhzyVNmOl0XJG4zem1ozbeJmUWAjdmP5AqNs AeEqwF8PBzp9HmYj3DoIj6o+qvkQsjdDXGwke3pMUFQfrN8It1D8pjSQdWCQ1Veywj9w 9LXCYF05JsRug4N5N0/2luU3T+n8zI+1FRaykmZ2wdMj8sYMzHMbRxnNmRHCR0dtfV8b o494imbSaM50gQOtrxnwlSAi3uyqOZarJQSi193YS8aoNnNCk3Nx3q5c3D5zLQd3sZbC 9kvQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=AZr9VCN1; 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.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id s3-20020a656443000000b005b887ff580asi842944pgv.878.2023.11.23.00.28.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 00:28:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=AZr9VCN1; 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.35 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 groat.vger.email (Postfix) with ESMTP id 90C078316EE4; Thu, 23 Nov 2023 00:28:48 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233940AbjKWI2j (ORCPT <rfc822;ouuuleilei@gmail.com> + 99 others); Thu, 23 Nov 2023 03:28:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229714AbjKWI2i (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 23 Nov 2023 03:28:38 -0500 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2067.outbound.protection.outlook.com [40.107.220.67]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7E73BC; Thu, 23 Nov 2023 00:28:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fzqzrojzsTUBmHuW2UDZnJPAqUPkzoHhiBq7RdsPMNbGNTwQNkny3Vv+uprat4G8ahR5nc2D3tQoylfQ751+Qlf8JpSF9N9jDeMuZy29LO1YiijY0hjoVT/eQ10JzdoNMUHIMsM8/EROiPWSrRU0okcqUviOM1/PfTXPGDVE32+IcJc7X+2idazBCkif5yANZAUWYWksVWwdIC3NUsPIAAKS+gU6fUrYo8Gtx0WbzYeJrj9fWbeieJtH9CaKJAHSFt8+GSrJrydX+bpO1Ew9ejdN6d8IqUEIT1TXiTX6TaZT3wijWH9SZc6CmolD0dtx+o4OctmkF4W3P3noqWcQGA== 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=iA1DghR5CuUIJAL1SUAdXjQCkegyBdqtzc06cDEKgfc=; b=S0xERr80/9KoE2lEBDBff1NYF+ExcVmLzztUvjCfhsWIXdyUrQGqZUFQlJ+0oqIWdRIwn46pjSNYVsEIl69S2JOZVsw8E//p+dG0jtAXacr6LuP6z82Q8B+WjMUk09Zx73Sj2CcaAHqZwz89yH+j/NQ+fknQkBcRKnpiYv4de5AHQ+9lkHxows7T4EbnRyzc6CIbm61f0j/1irlxIHisGxZWXShlI01mYSsoEejEGBDcYrT51XR089d3R1VKVgNWivOBGSeDT+g4goNjl77F1KZCHcsj8juGw9pZPSqqdJ2aQ655hDvyCpQ6OKLM/o9bDEkS1ACRWmFLcVGWJlALww== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org 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=iA1DghR5CuUIJAL1SUAdXjQCkegyBdqtzc06cDEKgfc=; b=AZr9VCN1XVGGw/Vw5G4Asz96gVIwIjPoYHaYqG12oHy83bQqTyL707GEC7bRPpzgKfqjiL9BGslQ9YkTQj4g+gRX8DvjwK+6Mb7cMDOnkIvm3JrU6sLL5kLrHmC/jRmkNtxraFCkvkLrdWlAJqooddMcGHsgkroSxd9HSTiE3DA= Received: from MW4PR03CA0122.namprd03.prod.outlook.com (2603:10b6:303:8c::7) by PH7PR12MB9254.namprd12.prod.outlook.com (2603:10b6:510:308::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.26; Thu, 23 Nov 2023 08:28:40 +0000 Received: from CO1PEPF000044F7.namprd21.prod.outlook.com (2603:10b6:303:8c:cafe::3f) by MW4PR03CA0122.outlook.office365.com (2603:10b6:303:8c::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.19 via Frontend Transport; Thu, 23 Nov 2023 08:28:39 +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 CO1PEPF000044F7.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7046.3 via Frontend Transport; Thu, 23 Nov 2023 08:28:39 +0000 Received: from BLR-5CG11610CF.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.34; Thu, 23 Nov 2023 02:28:36 -0600 From: "Gautham R. Shenoy" <gautham.shenoy@amd.com> To: Wyes Karny <wyes.karny@amd.com>, Huang Rui <ray.huang@amd.com>, "Mario Limonciello" <mario.limonciello@amd.com>, Perry Yuan <Perry.Yuan@amd.com>, "Rafael J . Wysocki" <rafael@kernel.org>, Viresh Kumar <viresh.kumar@linaro.org> CC: <linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>, "Gautham R. Shenoy" <gautham.shenoy@amd.com> Subject: [PATCH] cpufreq/amd-pstate: Fix the return value of amd_pstate_fast_switch() Date: Thu, 23 Nov 2023 13:57:57 +0530 Message-ID: <20231123082757.3527-1-gautham.shenoy@amd.com> X-Mailer: git-send-email 2.25.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: CO1PEPF000044F7:EE_|PH7PR12MB9254:EE_ X-MS-Office365-Filtering-Correlation-Id: 5266be46-8a7f-4570-bd1f-08dbebfe320e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: T06tPSAcMb1WSmmJxkRzaYRdzGwG8tKS5aZRAT+t9cGi2cTczzovdIbXDVuZucv/SqgipGwxfHDE+REpTdMWadw2r0EFSiLDBWLjY6egMkg9VqgEoLCFXmzAB9mfyuDHnhFLP3uXVMpiCoXOvaLycn5qcFo19OkfLSwJClfR0wHNVLtVi94W3dzY8I1xvAe0UZVmGg0jelKkAK0ePvHM7M00APIaM1o01NNeCAlSrIDpOzBxFZ55mxCgPTsddO/uyh+mGSRKsWN6gZkQjBctAdehoi1JdrVUU5QndOQsWT3s4tNcHXKuGq1/R/8EeRCuMuciHK99Qm5dH1tU18/lYDVOzsK1D7rNR8ckj27gtw9VJjq0oeElubbgLreTFrCHhd5aFEOJFRLpWyWV1VJi59LS7HHVVHVuI7F0UUmH7jcCuF3N5EHB4KYHPgYKikZpbsxtBqZ7SBafAykN59942zF3R1C1CM/uiIcPvOvZ2PawyJjQQYsTfcPBA1Vi6Jr62nlD5v05aU0+8iaqqveSUAEKbybL/cF4E+lgzC8f/on3jX4MlTUvDrsDwSB1Ef0goutlEPYG/vJBi8MHauXXNk7vekm1mK11YoPKgfM9yqHOXQ+8fa0bKfue6y7SThVzJPzVpC529tabq6ntPBrKHhlJUrxmhaiDD0qpey7083/ZgY5ZlePrAS2YxfzD2UtFN0FukNM/3UnrHvPFhTP+iUjWKwBLAwSGDN1BlY3ht9o= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(346002)(39860400002)(136003)(376002)(396003)(230922051799003)(451199024)(186009)(82310400011)(64100799003)(1800799012)(40470700004)(36840700001)(46966006)(86362001)(5660300002)(2906002)(316002)(70206006)(70586007)(110136005)(40460700003)(4326008)(8936002)(36756003)(8676002)(54906003)(41300700001)(40480700001)(47076005)(478600001)(356005)(81166007)(36860700001)(26005)(426003)(16526019)(336012)(82740400003)(2616005)(83380400001)(7696005)(1076003)(6666004)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Nov 2023 08:28:39.5698 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5266be46-8a7f-4570-bd1f-08dbebfe320e 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: CO1PEPF000044F7.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB9254 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,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 23 Nov 2023 00:28:48 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783342702018276739 X-GMAIL-MSGID: 1783342702018276739 |
Series |
cpufreq/amd-pstate: Fix the return value of amd_pstate_fast_switch()
|
|
Commit Message
Gautham R. Shenoy
Nov. 23, 2023, 8:27 a.m. UTC
cpufreq_driver->fast_switch() callback expects a frequency as a return
value. amd_pstate_fast_switch() was returning the return value of
amd_pstate_update_freq(), which only indicates a success or failure.
Fix this by making amd_pstate_fast_switch() return the target_freq
when the call to amd_pstate_update_freq() is successful, and return
the current frequency from policy->cur when the call to
amd_pstate_update_freq() is unsuccessful.
Fixes: 4badf2eb1e98 ("cpufreq: amd-pstate: Add ->fast_switch() callback")
Signed-off-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
---
drivers/cpufreq/amd-pstate.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Comments
[AMD Official Use Only - General] > -----Original Message----- > From: Shenoy, Gautham Ranjal <gautham.shenoy@amd.com> > Sent: Thursday, November 23, 2023 4:28 PM > To: Karny, Wyes <Wyes.Karny@amd.com>; Huang, Ray > <Ray.Huang@amd.com>; Limonciello, Mario <Mario.Limonciello@amd.com>; > Yuan, Perry <Perry.Yuan@amd.com>; Rafael J . Wysocki <rafael@kernel.org>; > Viresh Kumar <viresh.kumar@linaro.org> > Cc: linux-pm@vger.kernel.org; linux-kernel@vger.kernel.org; Shenoy, Gautham > Ranjal <gautham.shenoy@amd.com> > Subject: [PATCH] cpufreq/amd-pstate: Fix the return value of > amd_pstate_fast_switch() > > cpufreq_driver->fast_switch() callback expects a frequency as a return value. > amd_pstate_fast_switch() was returning the return value of > amd_pstate_update_freq(), which only indicates a success or failure. > > Fix this by making amd_pstate_fast_switch() return the target_freq when the > call to amd_pstate_update_freq() is successful, and return the current > frequency from policy->cur when the call to > amd_pstate_update_freq() is unsuccessful. > > Fixes: 4badf2eb1e98 ("cpufreq: amd-pstate: Add ->fast_switch() callback") > Signed-off-by: Gautham R. Shenoy <gautham.shenoy@amd.com> > --- > drivers/cpufreq/amd-pstate.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c > index 9a1e194d5cf8..300f81d36291 100644 > --- a/drivers/cpufreq/amd-pstate.c > +++ b/drivers/cpufreq/amd-pstate.c > @@ -518,7 +518,9 @@ static int amd_pstate_target(struct cpufreq_policy > *policy, static unsigned int amd_pstate_fast_switch(struct cpufreq_policy > *policy, > unsigned int target_freq) > { > - return amd_pstate_update_freq(policy, target_freq, true); > + if (!amd_pstate_update_freq(policy, target_freq, true)) > + return target_freq; > + return policy->cur; > } > > static void amd_pstate_adjust_perf(unsigned int cpu, > -- > 2.25.1 LGTM Thank you for the fix. Reviewed-by: Perry Yuan <perry.yuan@amd.com>
On 23 Nov 13:57, Gautham R. Shenoy wrote: > cpufreq_driver->fast_switch() callback expects a frequency as a return > value. amd_pstate_fast_switch() was returning the return value of > amd_pstate_update_freq(), which only indicates a success or failure. > > Fix this by making amd_pstate_fast_switch() return the target_freq > when the call to amd_pstate_update_freq() is successful, and return > the current frequency from policy->cur when the call to > amd_pstate_update_freq() is unsuccessful. > > Fixes: 4badf2eb1e98 ("cpufreq: amd-pstate: Add ->fast_switch() callback") Reviewed-by: Wyes Karny <wyes.karny@amd.com> > Signed-off-by: Gautham R. Shenoy <gautham.shenoy@amd.com> > --- > drivers/cpufreq/amd-pstate.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c > index 9a1e194d5cf8..300f81d36291 100644 > --- a/drivers/cpufreq/amd-pstate.c > +++ b/drivers/cpufreq/amd-pstate.c > @@ -518,7 +518,9 @@ static int amd_pstate_target(struct cpufreq_policy *policy, > static unsigned int amd_pstate_fast_switch(struct cpufreq_policy *policy, > unsigned int target_freq) > { > - return amd_pstate_update_freq(policy, target_freq, true); > + if (!amd_pstate_update_freq(policy, target_freq, true)) > + return target_freq; > + return policy->cur; > } > > static void amd_pstate_adjust_perf(unsigned int cpu, > -- > 2.25.1 >
On Fri, Nov 24, 2023 at 12:23:58PM +0800, Karny, Wyes wrote: > On 23 Nov 13:57, Gautham R. Shenoy wrote: > > cpufreq_driver->fast_switch() callback expects a frequency as a return > > value. amd_pstate_fast_switch() was returning the return value of > > amd_pstate_update_freq(), which only indicates a success or failure. > > > > Fix this by making amd_pstate_fast_switch() return the target_freq > > when the call to amd_pstate_update_freq() is successful, and return > > the current frequency from policy->cur when the call to > > amd_pstate_update_freq() is unsuccessful. > > > > Fixes: 4badf2eb1e98 ("cpufreq: amd-pstate: Add ->fast_switch() callback") > > Reviewed-by: Wyes Karny <wyes.karny@amd.com> > Acked-by: Huang Rui <ray.huang@amd.com> Do you want to cc stable mailing list to fix it in stable kernels? Thanks, Ray > > Signed-off-by: Gautham R. Shenoy <gautham.shenoy@amd.com> > > --- > > drivers/cpufreq/amd-pstate.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c > > index 9a1e194d5cf8..300f81d36291 100644 > > --- a/drivers/cpufreq/amd-pstate.c > > +++ b/drivers/cpufreq/amd-pstate.c > > @@ -518,7 +518,9 @@ static int amd_pstate_target(struct cpufreq_policy *policy, > > static unsigned int amd_pstate_fast_switch(struct cpufreq_policy *policy, > > unsigned int target_freq) > > { > > - return amd_pstate_update_freq(policy, target_freq, true); > > + if (!amd_pstate_update_freq(policy, target_freq, true)) > > + return target_freq; > > + return policy->cur; > > } > > > > static void amd_pstate_adjust_perf(unsigned int cpu, > > -- > > 2.25.1 > >
On Fri, Nov 24, 2023 at 03:31:34PM +0800, Huang Rui wrote: > On Fri, Nov 24, 2023 at 12:23:58PM +0800, Karny, Wyes wrote: > > On 23 Nov 13:57, Gautham R. Shenoy wrote: > > > cpufreq_driver->fast_switch() callback expects a frequency as a return > > > value. amd_pstate_fast_switch() was returning the return value of > > > amd_pstate_update_freq(), which only indicates a success or failure. > > > > > > Fix this by making amd_pstate_fast_switch() return the target_freq > > > when the call to amd_pstate_update_freq() is successful, and return > > > the current frequency from policy->cur when the call to > > > amd_pstate_update_freq() is unsuccessful. > > > > > > Fixes: 4badf2eb1e98 ("cpufreq: amd-pstate: Add ->fast_switch() callback") > > > > Reviewed-by: Wyes Karny <wyes.karny@amd.com> > > > > Acked-by: Huang Rui <ray.huang@amd.com> Thanks! > > Do you want to cc stable mailing list to fix it in stable kernels? Yes, I forgot to do that. I will send a v2 having collected your Acked-by and the Reviewed-by's from Perry and Wyes. > > Thanks, > Ray -- Thanks and Regards gautham.
diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 9a1e194d5cf8..300f81d36291 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -518,7 +518,9 @@ static int amd_pstate_target(struct cpufreq_policy *policy, static unsigned int amd_pstate_fast_switch(struct cpufreq_policy *policy, unsigned int target_freq) { - return amd_pstate_update_freq(policy, target_freq, true); + if (!amd_pstate_update_freq(policy, target_freq, true)) + return target_freq; + return policy->cur; } static void amd_pstate_adjust_perf(unsigned int cpu,