Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3390169pxb; Mon, 17 Jan 2022 19:24:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJwP6uWSm8fqJuyyk8ZTZlLGpo3XHrmipVv3mYEn7WucvJPHsd1lpVw21ZOcDSTlfqVBSJC6 X-Received: by 2002:a17:90b:4c89:: with SMTP id my9mr9517041pjb.74.1642476266201; Mon, 17 Jan 2022 19:24:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642476266; cv=none; d=google.com; s=arc-20160816; b=nwXPkhrWn9Mt53CKFI91DPpoDtvBRdQ2/GXBkva4uAxxPQFF/J23RkNF7hAsxU2yBd p4HqX885uVoBDTNvlOwGoTv4NqO2tKEmWzbuoJ1M8K1OyS+A6xwHUDoSnoAx9jfDR8xt 4CNyU3xJhNweFelu+ZPI0qWD832YkFWR4X3vJ+E9wEaHSjZRu4bVlHmS/jrLCvkhdpg4 p8Z77xlY71Fte5O4w47jBMelN9vQOaCSmWoT0AMNExH+Z/Fzqt41u1tJrWKzNumgp001 y6H6KRDnVvNat9NM9YyOpU7IHUSOoQeOQbMA76NTPcRqNDMt0QuqghAjD5CSF6ump/zM 4+SA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=a7hEwrKHgZhu95NoQoyKZbcGl0umdyRKzcepZdLReB0=; b=eoRyFSlZQJKtxT4WYW7Qc++IhsV3H84HTCoPMvJgMGfudpxq1Y1bdrHZY4y5t2e242 Y5ECmgezGgkOT8zioa/MXyj85/YOMCkKigknDn2ElJK/RkocJjMbnQDnUjqaoT9Qw2Ri FCF1uv11faVLT5zQxdKqEBDwDJ9H3/RzHp951fANDgk75DuD/8uJSx+bWdwuMYKLvfZq n0JsPimF3UxzaqLRt06C6hqZny6BzVKf+MviAgKyB/xhDG2UnLNy4I/xsrpNefP23M8Q 6K0UVRvwmbEomsxBvZ0dNWY4MgH+3mve61oLk0kDAWaWE44VCzldnGanzrNRVDq/rSgX oSLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DCA08F2F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o6si19868383pgu.725.2022.01.17.19.24.14; Mon, 17 Jan 2022 19:24:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DCA08F2F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344496AbiARCet (ORCPT + 99 others); Mon, 17 Jan 2022 21:34:49 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:37908 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245038AbiARC1T (ORCPT ); Mon, 17 Jan 2022 21:27:19 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 792B7B81258; Tue, 18 Jan 2022 02:27:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 973B5C36AF2; Tue, 18 Jan 2022 02:27:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642472835; bh=vSKcjvq/Z801tcIbfVH/qsw6/1cZTbZfIZH7fbF8u1s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DCA08F2FzL0bfMGKB6ZYPoKBdJg9K0hLq0F+jYGQlVyVCPy15LDNAjLmuLaMVOM/A YYzsCLGhnZ6aHSKwLzhHbiSkmA6mK53xaAcXSc2yjBwTWvrOmsySWYee7NBPdK7HLH BKS3sZ0PqYuR+X0AVuGTBibO7ZvOdgVaRPaRw9JvPfka4OVYCj5iC7x/lTEasco3B5 WfsGWI7VbSBzro7aLib++TGEhpWe+ut7MsIkYeQfkK1FAi+XAeI/Oib4Y7S6bTQVLQ 6NG8+qZx2S1Q0g21stpE6VIli26acAamk1VF1h3iOmtzaHsuSyH5p4kM0nfTFb/1rC esEqGWVPOSYAA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: "Rafael J. Wysocki" , Srinivas Pandruvada , Sasha Levin , rafael@kernel.org, linux-pm@vger.kernel.org Subject: [PATCH AUTOSEL 5.16 150/217] cpufreq: Fix initialization of min and max frequency QoS requests Date: Mon, 17 Jan 2022 21:18:33 -0500 Message-Id: <20220118021940.1942199-150-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220118021940.1942199-1-sashal@kernel.org> References: <20220118021940.1942199-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Rafael J. Wysocki" [ Upstream commit 521223d8b3ec078f670c7c35a1a04b1b2af07966 ] The min and max frequency QoS requests in the cpufreq core are initialized to whatever the current min and max frequency values are at the init time, but if any of these values change later (for example, cpuinfo.max_freq is updated by the driver), these initial request values will be limiting the CPU frequency unnecessarily unless they are changed by user space via sysfs. To address this, initialize min_freq_req and max_freq_req to FREQ_QOS_MIN_DEFAULT_VALUE and FREQ_QOS_MAX_DEFAULT_VALUE, respectively, so they don't really limit anything until user space updates them. Reported-by: Srinivas Pandruvada Tested-by: Srinivas Pandruvada Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/cpufreq/cpufreq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 096c3848fa415..76ffdaf8c8b5e 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1403,7 +1403,7 @@ static int cpufreq_online(unsigned int cpu) ret = freq_qos_add_request(&policy->constraints, policy->min_freq_req, FREQ_QOS_MIN, - policy->min); + FREQ_QOS_MIN_DEFAULT_VALUE); if (ret < 0) { /* * So we don't call freq_qos_remove_request() for an @@ -1423,7 +1423,7 @@ static int cpufreq_online(unsigned int cpu) ret = freq_qos_add_request(&policy->constraints, policy->max_freq_req, FREQ_QOS_MAX, - policy->max); + FREQ_QOS_MAX_DEFAULT_VALUE); if (ret < 0) { policy->max_freq_req = NULL; goto out_destroy_policy; -- 2.34.1