Received: by 2002:a05:7412:518d:b0:e2:908c:2ebd with SMTP id fn13csp412441rdb; Thu, 5 Oct 2023 09:21:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEi0vrsd3/vDtLiekigsTir0MxJC71xDfgQuqNDJeq3YzPA8RZ2YYU+AZB4HzCDxq7nKkVr X-Received: by 2002:a17:903:32cb:b0:1c3:2ee6:3811 with SMTP id i11-20020a17090332cb00b001c32ee63811mr7085465plr.8.1696522875588; Thu, 05 Oct 2023 09:21:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696522875; cv=none; d=google.com; s=arc-20160816; b=sG4v/ztezrNqE8apjKlB4VHicYBpiFCoz2l1wDQF6duYf03pndHH80HylEaRphP7Zf i8U0TmdHYkE3BwgPH5yRo2QNgnzfeGli5VbLwXk05bfOoWHPE9IQY/jC6niZ1bSENKjM UpJhZa9diz8lo4GdSCWV4dWtx5+gzIfm4lmk6P7kHioxPhVFueg/GfUbn3nPzV5y25G2 vTzJiUeD7YhFWs+BSGa4kMzlSaVnm8tfE56RYtfMvMgMximaPWcqyKdD6a/Y3qTOTdiK ni7nZ0mrNMTME/181+SRbPygszHj0DpdOZUM6Nh+ATep8/btccTj4rfP3Q9XVoB4Qie6 ZuZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=8cDRtKnd/4diHbjlhPc0Xt/Y0fuLcZWAs7MWCmgie4k=; fh=LMimJJHAGJQAxa8ES6PZTGBEDzrZfy9j1/0wCeHmW1k=; b=TjpfYv4gkE/vgbUkM15Eg9GEyUNiNClt+ebPOXs8rYfD6mQHosAe1D04MBijaVf6mq nmnKTIrGe5H4J0zxbd8utKjvYpT31JQJgVwo3+2BFqYme2ztemjTI2Am78pxeksVH+um tSo6PkQwhsyzsgbWb9gRxAb7Lwu2ULXuYLXVzm7F+vUS2A9L2MBWydUArHxRX0kSQ+VW 560QHtcD5Fi4kL4lqkE/M6el4WYzWC6bq+BXVU6rPbN+sY9KG1MSXQopB+ihUEZwCCrs NaRt6vCze5zmrPE09fYrG6IYqWCbm0dhKmUTyv78qXjTEHA8YynKaPeE0tkvC6ahF4QL ynGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=buXhQQ3i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id f11-20020a170902ce8b00b001c5f6203ca8si1893979plg.556.2023.10.05.09.21.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 09:21:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=buXhQQ3i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 0879C80E2264; Thu, 5 Oct 2023 09:21:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241703AbjJEQQU (ORCPT + 99 others); Thu, 5 Oct 2023 12:16:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241104AbjJEQNk (ORCPT ); Thu, 5 Oct 2023 12:13:40 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3758023530 for ; Thu, 5 Oct 2023 03:57:50 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-691c05bc5aaso702505b3a.2 for ; Thu, 05 Oct 2023 03:57:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696503469; x=1697108269; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=8cDRtKnd/4diHbjlhPc0Xt/Y0fuLcZWAs7MWCmgie4k=; b=buXhQQ3idmiv7NOcQMJ1dMF4CYjdrkMg8EyCZX4Yn2X5iPf2ixPllq1z3LM1o3RATe v0pPAc9G4vOvXSe+YGCQ8XfZK5HDbkP0Qmujl5mwTNF7e7aymM88K9qtxYn+BXptC90h ArkS6dkQ7rdgZjEYnzSN7HC+4dVLR5cAbdUT5rfyZqOxVJwM9zFgLAsrxdupMJojkfL1 fNg5nxIjgohW/y9xvXt+MS2/YenX6b6/4TxhNPehHCYpeaEZmYK7UpWfAXUVSAW4vb9L 57nYQjDzukmlTzsv/pYtVItmbWgaYAEaK8AKbk3WqTvh4AkrTnWYw/h8NrJCP2LtkyRx s4MQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696503469; x=1697108269; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=8cDRtKnd/4diHbjlhPc0Xt/Y0fuLcZWAs7MWCmgie4k=; b=CLIkbIjqd24+XxtrVgMegEMM0oKNRodl9smnj6nVtY0JO2e5kBAsEyckG7YhDdRwbt TQMG0nm6Fj4IHU//AnGr0w1ErYrMcqxPkJ5BTNpCQIZAZOQuml6Z6CrKqFiXmAgK7umy i9TWR1yqWcYAmQ+6iI4rF0C7U/sd5oedRIpY73UDzIwlXJ1skwx0XHMKOzy1D9a5q7lB F+txPwLTVcecfhP04KtQ6IVK29i+qjMUzWW7yWN2S6BFa1JCWf1SCk6lYlpAZ6N4GQ5q cyH7W1BelwRjPspOuGtePsQ23oz0nuKEY8DDG+V2OgnLl6bULW/Qb8lz8fO/d0ptMQrp dahA== X-Gm-Message-State: AOJu0Yy64S5vVB9oBR2jquT6I5L4nXF2JHZ146QoVsYos6mpbT3ACtIk Ao0FfDHTPgdrRfd9RXpp3Gtxiw== X-Received: by 2002:a05:6a21:4982:b0:160:7679:90 with SMTP id ax2-20020a056a21498200b0016076790090mr4019045pzc.56.1696503469704; Thu, 05 Oct 2023 03:57:49 -0700 (PDT) Received: from localhost ([122.172.81.92]) by smtp.gmail.com with ESMTPSA id t23-20020aa79397000000b0069348918cfcsm1081690pfe.193.2023.10.05.03.57.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 03:57:49 -0700 (PDT) Date: Thu, 5 Oct 2023 16:27:46 +0530 From: Viresh Kumar To: Liao Chang Cc: rafael@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] cpufreq: conservative: Ensure requested_freq is greater than min frequency Message-ID: <20231005105746.ikezg2buza2qwvig@vireshk-i7> References: <20230912060957.2516790-1-liaochang1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230912060957.2516790-1-liaochang1@huawei.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (howler.vger.email [0.0.0.0]); Thu, 05 Oct 2023 09:21:08 -0700 (PDT) On 12-09-23, 06:09, Liao Chang wrote: > The governor ensures that the requested frequency is greater than the > minimum frequency when the condition for decreasing frequency is > satisfied. This is done by either reducing the frequency step from the > current frequency if the current frequency is greater than the sum of > the frequency step and the minimum frequency, or setting the frequency > to the minimum one otherwise. > > Signed-off-by: Liao Chang > --- > drivers/cpufreq/cpufreq_conservative.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c > index 56500b25d77c..54e09242b2e2 100644 > --- a/drivers/cpufreq/cpufreq_conservative.c > +++ b/drivers/cpufreq/cpufreq_conservative.c > @@ -130,7 +130,7 @@ static unsigned int cs_dbs_update(struct cpufreq_policy *policy) > if (requested_freq == policy->min) > goto out; > > - if (requested_freq > freq_step) > + if (requested_freq > policy->min + freq_step) > requested_freq -= freq_step; > else > requested_freq = policy->min; I think all we want to ensure here is that we don't end up getting a negative number (since requested_freq is unsigned int, it will end up being a very large freq). __cpufreq_driver_target() will eventually set the freq to policy->min only as we are using CPUFREQ_RELATION_LE here. -- viresh