From patchwork Fri Feb 9 15:42:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tor Vic X-Patchwork-Id: 198953 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp941254dyd; Fri, 9 Feb 2024 07:45:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IEIWvJOo9DEsMg97td1awirTG9rSgyxI0PYzgt/xH3dxgFlyCvU8+Hg1skiEbconiGrrkri X-Received: by 2002:a05:6e02:2182:b0:363:c576:d6d5 with SMTP id j2-20020a056e02218200b00363c576d6d5mr2843080ila.4.1707493534417; Fri, 09 Feb 2024 07:45:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707493534; cv=pass; d=google.com; s=arc-20160816; b=DpAXL2QfoI3YO7bmj4nC59o77gzppJAufGYvRjriAbHHjtp9En3XXiEYiyj6tRzA2P FNIxRWOJIumDgqHwspsftWxZNx/BeMSZDPtS6dcgQlBll2v/mY/FnfPVUNaTdHSFpY/C j2ZU7epH7svoq976oGSmRiI6MhiwbtMB1oUsC254bg8JCix7CeB20kBQUCVBO9Jbvamt HCwuzuJSESRbNisqhcomCzGSkqBIo+npaIIw2CVHh7M3b88KaMJ1/EtZhkSrlb2tIIpL JCXyv8V0S2/u5jmMm3Ol+dexZn5bUtLAjTt3vhiOwrgbj37Z5T2Baxock4Ay32muCWgR r+7w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=H8PypmVbsnCrC9vOiFkAsVoG/5dR314vcsbeC6i7o88=; fh=zvSMMMzMYIVuuMKhILPA6WL0SJZNnBVyyDY9qqgujc0=; b=h0sGkLB2BjVNNL4jEI254GsmCDqNXD08dyppIxwUbwcs6puq1xzmZW9erF6wg2VuM5 oDHdrFhkipUUDC53L3VJDL6e9Knu8zwwEYFymU8/wTWElfQl04koBDikxyeU4KGDNn/b X7UOV5f90s2z4Wy1/ctIFW+11V/zqbkLgiEw8GdL+uOpIQxbM/+h0kjdqTCY6bUaz4+f 0wLXd0k4zVRRnMSc5HEn741T1/y9pxQNw7SbvbWYmQE8FwYfO8cilYt8I326eUUmsS6y OnW/JZNwZ2NdGcPxcLNOo0Ahd8Uu2uRTwdttfSVMkWDWdcpwU8iGKXXIIO04hS5qqvbg 6faA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mailbox.org header.s=mail20150812 header.b=AaE9aeqK; arc=pass (i=1 spf=pass spfdomain=mailbox.org dkim=pass dkdomain=mailbox.org dmarc=pass fromdomain=mailbox.org); spf=pass (google.com: domain of linux-kernel+bounces-59548-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59548-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=mailbox.org X-Forwarded-Encrypted: i=2; AJvYcCVIckjKOHdPitmtdtE10yWV3I29TPVdBEvH/ftU+TM6sBqvUFQrFtmnIlotrJhhofH2DzvPgofOzP4qwYdpQQ3vKXrlKw== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id i186-20020a6387c3000000b005d91365dee2si1852279pge.646.2024.02.09.07.45.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 07:45:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-59548-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@mailbox.org header.s=mail20150812 header.b=AaE9aeqK; arc=pass (i=1 spf=pass spfdomain=mailbox.org dkim=pass dkdomain=mailbox.org dmarc=pass fromdomain=mailbox.org); spf=pass (google.com: domain of linux-kernel+bounces-59548-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59548-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=mailbox.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A3F9228841B for ; Fri, 9 Feb 2024 15:44:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B947376045; Fri, 9 Feb 2024 15:44:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=mailbox.org header.i=@mailbox.org header.b="AaE9aeqK" Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DFC5671B3A; Fri, 9 Feb 2024 15:44:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707493446; cv=none; b=J3mmZf7WgDtIwCJjIPxdXjhukJuBLAWQ1RitvmQN3l7SQSAzwM41/+3uqu3PePo4zeKLu030prbBkNaTJ5x1HdvtmWaqc40JTODPoYZ8r0Ob+wb+p9pocjpDwQ1R/xEsyLtklYSBaA6ib05DxEWnfRDsnIq8tarNQAL3gqivq8I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707493446; c=relaxed/simple; bh=O4/YM668cDKSHelku3SxggCbwo1G68KwNgmDfW7ur/s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fvW1Pp6bj0/ZTYU1N8ZbmuiAN/BKCLkFhSQ7WHEg3vHMthz/S9XVJtvGo3tMotaFmnRhVrHmUb/1kCLyFYk/LbQ1rpk/2CVA7GHL2e5TdbQWqXRVL4aY105NlfTrzmxZmr2ATYVO07jYp1XoCv1YPyoqxZKEsy09DtSaE637nBc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=mailbox.org; spf=pass smtp.mailfrom=mailbox.org; dkim=pass (2048-bit key) header.d=mailbox.org header.i=@mailbox.org header.b=AaE9aeqK; arc=none smtp.client-ip=80.241.56.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=mailbox.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mailbox.org Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4TWdSH5lyhz9t4t; Fri, 9 Feb 2024 16:43:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1707493439; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=H8PypmVbsnCrC9vOiFkAsVoG/5dR314vcsbeC6i7o88=; b=AaE9aeqK97OIAPqXITM/NCWrmdwiH365Skq0RD5OcfcCktcP1M/IOXjHDTIqFQvBdVnrOO S0wK0iC1MOogj/Kr6nIPoQKmwpBftXxMjooU4nTMYAk5ZfIT1OSocG9ScUBbbFwj0hJgYo +TJnJFaKu9YgrrE7zgiY5LHaF/mWOgdY39PGseDwJzP96caKY6OgaFNB1W8SRjew0N/7/z t6kkzgwP4YSu+hS9X6YkcyPuaFGPq/AA2jZJHXB3z2/Jz0klkA54QNDC8jnokYSE6rxYOD S7QZA8l6XWicO0+qnR265H8Dle6IVq+3VBwVN06OzQ9ZqlCMSPkJJr4QmaFlug== From: Tor Vic To: Perry.Yuan@amd.com, ray.huang@amd.com, gautham.shenoy@amd.com, mario.limonciello@amd.com, rafael.j.wysocki@intel.com Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Oleksandr Natalenko Subject: [PATCH v3] cpufreq: amd-pstate: Fix min_perf assignment in amd_pstate_adjust_perf() Date: Fri, 9 Feb 2024 16:42:26 +0100 Message-ID: <20240209154336.7788-1-torvic9@mailbox.org> In-Reply-To: <8eefeeb7-f8e8-49f4-b83c-e67a9e728f41@mailbox.org> References: <8eefeeb7-f8e8-49f4-b83c-e67a9e728f41@mailbox.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MBO-RS-META: gz74hbj39br16tma89hs5oeudf64gmsk X-MBO-RS-ID: 5d468f1bf389e51a998 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790324829601038092 X-GMAIL-MSGID: 1790436740216201194 In the function amd_pstate_adjust_perf(), the 'min_perf' variable is set to 'highest_perf' instead of 'lowest_perf'. Cc: # 6.1+ Fixes: 1d215f0319c2 ("cpufreq: amd-pstate: Add fast switch function for AMD P-State") Reported-by: Oleksandr Natalenko Reviewed-by: Perry Yuan Signed-off-by: Tor Vic Reviewed-by: Mario Limonciello --- v2->v3: Resend with git, misconfigured mail client borked v2 v1->v2: Add Perry's 'Reviewed-by' and 'Cc: stable' tag --- drivers/cpufreq/amd-pstate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 08e112444c27..aa5e57e27d2b 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -577,7 +577,7 @@ static void amd_pstate_adjust_perf(unsigned int cpu, if (target_perf < capacity) des_perf = DIV_ROUND_UP(cap_perf * target_perf, capacity); - min_perf = READ_ONCE(cpudata->highest_perf); + min_perf = READ_ONCE(cpudata->lowest_perf); if (_min_perf < capacity) min_perf = DIV_ROUND_UP(cap_perf * _min_perf, capacity);