Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp804460rdh; Thu, 23 Nov 2023 20:24:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IHNF+u9FjDdweK0ggXeE7bJ3VdCntAu1wjZu0OT0qjwvt61VuFAkzxoWRWOG5gmUNfYWqH4 X-Received: by 2002:a17:902:7483:b0:1cc:54fb:60f9 with SMTP id h3-20020a170902748300b001cc54fb60f9mr1823778pll.37.1700799866713; Thu, 23 Nov 2023 20:24:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700799866; cv=pass; d=google.com; s=arc-20160816; b=G3Ni7fjrJvmxH0/PrSB5dRBv530Lw68KkV4mniOl+QZJ0t/Ly56lh1dJBLuhhrPWtm MMY8gM0FdjNl/H1fSm6M5jdpRBidRi3b5PmReptcGEBpbONyqiVfoKiy5ASlohqdcy1c 2EV5v8iWJOxx5lm6TjU2lKu2O0uUtQFc6+pRmFnGEO8xeOszWXG+fhAiPCptZkTo9fIV YR2f5rn8yqG8ChMAgb1dOHLsc9iH9SmzlbTTpR+mafYNufWTwDM1++xx3+QbcHzFbjvO ReU9I81+1Vd7ZYnCpKC1MDFeGakw/tNsD0Xm/YSqiSweSRowJ8adn2q3FnQD0k0I3YD7 TXbg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=kVrLmkkNcvB4mm1wmls6Qvhorl8b2IkdmqVcDoI6+24=; fh=YHXEeMqe7/ecC2Rhb+fWnByAS6iwV9h8qslB/pqsZN8=; b=tVixfgXqmr89ZLhE8ctEmEOiOJv2j4j2BEjrSbaf1Sr4ibQygflchEfhrR5tw58GzL 60iANikQafZFyjQCUbkdB3V+GzP/4gp08+w7E/cYLnI1uG8URM9QfqcI1qVwY8rsbng5 eIL1bl8tTqMKPc+ovMD1O1xehzrYLNUIAj0nFwmtUNieyAZuTFWfUml0m+64Sl07Yb7J ZU7rwmpUEPFlFxNV8veMtCCzsYUvsoO2L/O5pXjxkWW3gh/damhoTZ3Jx6N9YXCq1mGb ShAcNAAn3FIl+w5ebG3zolDleXkyloRkPtNP9ZhOcMiggNJXVgiuP1FWA5wHHcBycWK7 xPCg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=1Bp+g8pK; 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::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id e8-20020a17090301c800b001cf6e0c99bbsi2683711plh.137.2023.11.23.20.24.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 20:24:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=1Bp+g8pK; 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::3:1 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 morse.vger.email (Postfix) with ESMTP id 1B16C805DC6B; Thu, 23 Nov 2023 20:24:23 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230372AbjKXEYH (ORCPT + 99 others); Thu, 23 Nov 2023 23:24:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229453AbjKXEYF (ORCPT ); Thu, 23 Nov 2023 23:24:05 -0500 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2083.outbound.protection.outlook.com [40.107.101.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC65511F; Thu, 23 Nov 2023 20:24:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BkuXLfIDZWUh42v5ffp6sTupZjhZimD61vZWmFscZNDLYxRTfasd4Lkom8PsSriUsrV182l6kilg07xMe3AMlotWYFJWjeVEIqjjkA+6rZsd7Wmk/dgRouvyRbejPBCQtadEnELR32HleDFqWi0C6TRVU6c7JwvH+fQdrAhdvHw5Y8HlpADQQXV7MaukmGUuxXIAQcDpnIs60mc6aKZB+7+6jwpKySJX3+Axy35KDKrp1ieES19EirY38wj1xkmUlY3sB7yq/419PGokguzUNzGo/WOzkIaMbq1YBFBbq/qrPscS8zpAy73B+MQ9xO03n6+NigE1AF+6d32Pq4+u4w== 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=kVrLmkkNcvB4mm1wmls6Qvhorl8b2IkdmqVcDoI6+24=; b=fJUvvN0pX7JthIji9Th1WtK3BKOyUUuLNSUH490M31SWwz+vsg8aPshFx6+6b3+ysVXlnlRv/inQku9d8Ei5mWHq0SZBjRCh7w6MG1FXO6wYzRdsy/+nzTxQGBHWMUHw2wWCeOw5HBhkiQpcS5Z+WQ6qJCGlf+4bKuXgxbMsDFvooO1ipZLA+AB9The0qvGUgphzqBRwLoh4GwHWW7E0mDz8w7DuHpYC5/ZOgU5HFj3AbVK8Hifyqx6CXEKXr/4jrrfvsSL/CLqk2qoV0rzWHmY9Ng/6SPvRMb2851TKhKv6XkLtaOqHUsBbs+ALawRkfH2gfNj5OUAnqnXdiz67yA== 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=kVrLmkkNcvB4mm1wmls6Qvhorl8b2IkdmqVcDoI6+24=; b=1Bp+g8pK95uHTTdiKyr850YPlheyrzBOoNE9BQYRT4TqDpkn7SmijnfrqJ0abesqi8pDRSskkjwWRKg7/7CVsgwS4Qp1+701w0446hc6p5tXGJjPhKPlpv10Ey+hHKkzYbYNUDkn5AEwLr+Re0lalpEYK32gi7TlN4DMOBcYNSw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from MN2PR12MB3888.namprd12.prod.outlook.com (2603:10b6:208:162::32) by SJ0PR12MB6941.namprd12.prod.outlook.com (2603:10b6:a03:448::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.20; Fri, 24 Nov 2023 04:24:09 +0000 Received: from MN2PR12MB3888.namprd12.prod.outlook.com ([fe80::6cb9:3a50:957a:f6b6]) by MN2PR12MB3888.namprd12.prod.outlook.com ([fe80::6cb9:3a50:957a:f6b6%2]) with mapi id 15.20.7025.021; Fri, 24 Nov 2023 04:24:09 +0000 Date: Fri, 24 Nov 2023 09:53:58 +0530 From: Wyes Karny To: "Gautham R. Shenoy" Cc: Huang Rui , Mario Limonciello , Perry Yuan , "Rafael J . Wysocki" , Viresh Kumar , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] cpufreq/amd-pstate: Fix the return value of amd_pstate_fast_switch() Message-ID: References: <20231123082757.3527-1-gautham.shenoy@amd.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231123082757.3527-1-gautham.shenoy@amd.com> X-ClientProxiedBy: PN2PR01CA0124.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:6::9) To MN2PR12MB3888.namprd12.prod.outlook.com (2603:10b6:208:162::32) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR12MB3888:EE_|SJ0PR12MB6941:EE_ X-MS-Office365-Filtering-Correlation-Id: 2c47a475-5c08-4732-f88f-08dbeca533f5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9DZ0IERmSGwk3L2i8emXYNJGOAB311V07eq69Uu7B9i0SOL87gb/NEnu7nfT1X7FDiSUQCNd+lvGdXF5KZIJz7fOn+I43KhRb3k6d5BpP1StKgUojvn7sEzzBKMWdEsPbHX/0ZbkUTtDQ5Izaw+tYS5gBUhX1WSJt3BlbMszZJvQBmFLfK90c6Q5aHnwPWANs8ZyHJgl2bQryOpJhvozuP6Z+1XjVKV41PJ28pOsjvH9uWFxtQ2N4IwPNVEJDCdhWEKfCPGQMVAguc3Vx3Xa6cOKgIZxIwraAxS5PfWYmIGR6Tivb3vMbKa6lDeG0aOIOddugrNyapI3o6HSzw/zL8wrUWHPc0agubUhq2/nIvAx1BbSGDJv8zpXpLZ9umlQqO3z5jR+Ndael2j+69G9lnY/owrPG1ASRq5ogAM2N9o8/3S0V2Si1E5TznK0T9Tly6S4YoSWUDJp4Rtnn0Jn+lcoTkV+KbXjce5T6naGfcYEY5y9PIQL4Eb81Q7TTt4H/AZnqSwPT+z8r855IXTY4w/0koEO9SHFoeirM2vONNfmH+9qq/uN5OSWhfF0TrHT X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB3888.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(396003)(376002)(39860400002)(136003)(366004)(230922051799003)(64100799003)(186009)(1800799012)(451199024)(83380400001)(26005)(6666004)(6512007)(66476007)(6506007)(41300700001)(44832011)(6862004)(5660300002)(2906002)(6486002)(316002)(478600001)(8936002)(8676002)(4326008)(6636002)(66556008)(54906003)(66946007)(86362001)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?4iTLR38LZgzGed8tVB67UaEQsqZc0CwYg+nRFlTFfSSXa/civqsX3Y/6LrtZ?= =?us-ascii?Q?32AWYBaJG54LSUMDENvo62pMjFBjYLH1H46IC3AbI0GdFyb8MKayOnRukP0D?= =?us-ascii?Q?TlFQzacjiQAfFN3R9sTK0B7UrHpTgW/8dY+lF0GC/HedsNuqzMkjMSd4hhzM?= =?us-ascii?Q?pZaxGfxEUAaujLCj5ZSD0L2X+3yQu+5636/112LlqOcV/vEtAwvf/L4cMsPv?= =?us-ascii?Q?zoi0WBQnifUXB+pUkgRgzPVeubAQB0Pth+oyA0s4wtp3IDl+vjFnBIv/Lh6R?= =?us-ascii?Q?TzcVg9abRp2NywIEhkslqY03qbqbt71pwHDTX2fRFd3YA5OwUM7GOZNKQj+w?= =?us-ascii?Q?tIRf8sVCFw3aeYpOU2EN0zl1BAuaF944qQGAaP9BdpylCMUT0hFH83iPDLj9?= =?us-ascii?Q?ShBog+2nT/Vhh2EXL2BWlMOOxSASueTgO0orFfKNqje8dgg6yz+l0yHuTivH?= =?us-ascii?Q?579ICEhgEm4DLyLnHwUIH9M8fOGGqVPEYT6ukAElOHWhMOpnvh+CahvJydZ7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b9vCcvRJRXFu1mNMClmWuZRwy1DnXYCYIltj2btB7S5?= =?us-ascii?Q?aoMXOtn3noHuVl54llm1arZ6jEmWy7aNO1u2DOC9DtyBi7naULgj613opCrt?= =?us-ascii?Q?P+MBD4EGav5E1ntZe5Cg3qf0gKoOE642lNaORyaI3RMcLm5ERzEI56uixfgV?= =?us-ascii?Q?7x5nk5kxTaH887A/wzVjVvt2HRBF2SvYfqnsP7aX?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2c47a475-5c08-4732-f88f-08dbeca533f5 X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB3888.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Nov 2023 04:24:09.0595 (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: kUMnbqdMkd3CHig6rvOGB0bgtlLxh2Hpq7sKRCVsmbC958gRHZJCKq/t7g1sBhFbzErcxmnRA8wW3HTYi+ZBmA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6941 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 morse.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 (morse.vger.email [0.0.0.0]); Thu, 23 Nov 2023 20:24:23 -0800 (PST) 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 > Signed-off-by: Gautham R. Shenoy > --- > 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 >