Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp316124lqp; Wed, 12 Jun 2024 02:27:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUahyUko/8H+P8C42f7JTS+fq0V+Coj2ZiX1HWHETOoIzT5a4K2XAF6o/nV71KHjgEqhb9/tQVJVdhiD+S1/wHW33QxjbTLUjbUX1YYNQ== X-Google-Smtp-Source: AGHT+IFW+lgK9zbCAUldkZMAFaXDbQL022Fn+aZJGauvYDmOH5wMGDiJT1ReHFZh17mr5Im/OPDM X-Received: by 2002:a05:6870:b624:b0:24f:cff2:5097 with SMTP id 586e51a60fabf-25514b72af8mr1305704fac.14.1718184451409; Wed, 12 Jun 2024 02:27:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718184451; cv=pass; d=google.com; s=arc-20160816; b=aKKJLriM0GT01+ydIX/uGzRUMy7yh46F2iy2xP/ybmnFuZAY+g6jZGiAyaO8ctdGww ZvSCU8tk70kebLLj/jkOira8fI9duRkxa6gIWm6a7ErT8hSaZzPVp5Lus0ow16jiGR0X UlWIUTvvG5ZYZ07hFvQf+6rdiQwBU1TVVJznzzlloIPmfPYOERJ1U8VwF+Bh0OZOvyUy FowxOrIfyTTwE8j/EbHlsofBC8Um34fG/wEOS0L5wuQlHKfAqgRjcvmTt46VI92X/Jog yNSYrPZpdnvMBsUtZVNnHqLfCYk1rZCb403/LH7xjPAqejfuBL4hHkyvczX6bl9jASHg PlGw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=Rw6X/PQOeHoVTdBZfJFouE4DgUxqVmcsYzc/DbGxNWo=; fh=nUFsAgPYFY6muzcMlVR5uUvlo+uV/XnjBQbWDRSP3PA=; b=FV/68H/cCjqrZad2akXSsL2wwzUxUzM2p0q5MbRdW8/XWD8cabjahyERSmrFmhltSR VLFdoTkYi3ub5Qk5/16fu7+SqX7im57qdzXy2uzod9ShyHfFqj5zxn2/PGzfMqF23z9v +rnzS0tC1bQo7EiyB2qNcv+L57ElieKjcrwKQHKkHy9rHN2tkO+7rz7M67wPEAwNNVEn Jm/YPPM22qqhHQFnE21IMkM73HaNAxuXtsdEtySmsv0oo57qACje0qIjgzh+5wCceqIE Yv96jEHUh5guFSY0hhT+sd4KMqfmjVL1uQdhMaOugHjaDbQgEk5wkPnfLVZuApmAW5Z8 rVZA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-211233-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211233-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6e7dfc62f25si7603675a12.849.2024.06.12.02.27.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 02:27:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-211233-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-211233-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211233-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id B1362B232C3 for ; Wed, 12 Jun 2024 09:09:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D554F16D9A7; Wed, 12 Jun 2024 09:09:06 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AF17B33D0; Wed, 12 Jun 2024 09:09:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718183346; cv=none; b=FDuIFdVUJOI2KjNY3D272A2JVwkvmom1EydRcTHwfzjcpx7OGCgFI3lMZkOUVaDlFrIhnQdbg3fr6fiRHlvpVgaDE5stR3dbLrfLFVnRcKsE2ZmFBxPNA0s0hKmVDqOSBOBVs0GZBSRBeEzm4EfLMxu0AB2/Jhx07pOVzFLza+g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718183346; c=relaxed/simple; bh=ekVvXOtgEWGc5upJE6j41XAzTm9If7AcFpwlPUsRGRQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=EYBNn/t6D/fLOmZevU5yBZqYjkJxisLr9YqUGXXI/70NIOZLBCzhaKw950hWb8FVhVC/5GBimitdtHMQ+tcbCFmLvc1araGAvE9rmlqkbsPXhgctGJYESNuuQ58jK0aqgWkJXL4ORU5+kIznATSCK7NFHZyn47OISFQNEWxrZQc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 479401595; Wed, 12 Jun 2024 02:09:27 -0700 (PDT) Received: from [10.57.69.241] (unknown [10.57.69.241]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AC5043F64C; Wed, 12 Jun 2024 02:09:00 -0700 (PDT) Message-ID: Date: Wed, 12 Jun 2024 11:08:54 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3] cpufreq/cppc: Remove the desired_perf compare when set target To: Riwen Lu Cc: linux-pm@vger.kernel.org, viresh.kumar@linaro.org, rafael@kernel.org, linux-kernel@vger.kernel.org, ionela.voinescu@arm.com, beata.michalska@arm.com, hotran@apm.com, Riwen Lu References: <20240530061621.36byo5a2iqc6o2az@vireshk-i7> Content-Language: en-US From: Pierre Gondois In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hello Riwen, This function seems to be the only cpufreq function saving and comparing the requested frequency with the last requested frequency. This seems to be more the task of the cpufreq framework than the cpufreq driver. So FYIW, the patch looks good to me. On 5/30/24 13:08, Riwen Lu wrote: > From: Riwen Lu > > There is a case that desired_perf is exactly the same with the old perf, > but the actual current freq is not. > > This happened in S3 while the cpufreq governor is set to powersave. > During cpufreq resume process, the booting CPU's new_freq obtained via > .get() is the highest frequency, while the policy->cur and > cpu->perf_ctrls.desired_perf are in the lowest level(powersave > governor). Causing the warning: "CPU frequency out of sync:", and set > policy->cur to new_freq. (new paragraph) Then the governor->limits() calls > cppc_cpufreq_set_target() to configures the CPU frequency and returns > directly because the desired_perf converted from target_freq is the > same with cpu->perf_ctrls.desired_perf and both are the lowest_perf. (new paragraph) > Since target_freq and policy->cur have been compared in > __cpufreq_driver_target(), there's no need to compare desired_perf > and cpu->perf_ctrls.desired_perf again in cppc_cpufreq_set_target() > to ensure that the CPU frequency is properly configured. NIT: Would it be possible to make distinct paragraphs ? > > Signed-off-by: Riwen Lu > > --- > v1 -> v2: > - Update commit message and email. > v2 -> v3: > - Update patch subject and commit message. > - Remove the desired_perf compare logic. > --- > drivers/cpufreq/cppc_cpufreq.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c > index 15f1d41920a3..337cece61ab5 100644 > --- a/drivers/cpufreq/cppc_cpufreq.c > +++ b/drivers/cpufreq/cppc_cpufreq.c > @@ -295,9 +295,6 @@ static int cppc_cpufreq_set_target(struct cpufreq_policy *policy, > int ret = 0; > > desired_perf = cppc_khz_to_perf(&cpu_data->perf_caps, target_freq); > - /* Return if it is exactly the same perf */ > - if (desired_perf == cpu_data->perf_ctrls.desired_perf) > - return ret; > > cpu_data->perf_ctrls.desired_perf = desired_perf; > freqs.old = policy->cur;