Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp1276751lqt; Tue, 19 Mar 2024 20:21:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV4kdRbmC7depEvtidjRhYae3WWYkNHZm7hIFVK3zhShLKhwi9Oj6uZTJ8Mm6QjhgxT5nHbYiacQm4tLPBkw+SFAeGCtRJ4IiGGIdzVnA== X-Google-Smtp-Source: AGHT+IEjeKeFqtC0zBcWAqw0r4qbNRJONANH/RflQ01jnXvTGuyJY9jJadNsHYvtBAwh6wtwgqaP X-Received: by 2002:a05:620a:1d84:b0:789:d675:6e36 with SMTP id pj4-20020a05620a1d8400b00789d6756e36mr17589540qkn.60.1710904872710; Tue, 19 Mar 2024 20:21:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710904872; cv=pass; d=google.com; s=arc-20160816; b=ostEjr0vCiwAHDR/FMu17aryXWtX0K5pqg2AriBNW8TnNkViVXPBDDhbarug3K/pyK EbHdpG46R0DmlAMr7zkyicFpq/twAKiNpVYXywa8PVi/KWLn0W6P1HSakv57IRSidr5U I83+/DUV665caV/TRt9Lh+z+1NgVfsT5XJeWoV0Yw2wBHn+ZjgP5lNbW4G/zCB7JyMk4 PnLDrTLdfhNEfUn8FOz85AKiD/Wr7MMN8Mg6IPvSWqHs5VRp75bq5UNDXZUzugg+lblt jkMJ8i2U15c9ScoLLq9xC++rdg64AXU7vZOEbkJ8U34j8M4loJjaB6Nx+LKUbeJHD33U tcoA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=o4P//duYekxql85fsXRWTB88tD2kAUJ1b3yRQNxznTM=; fh=vQDAMWJKKs3uvDp/VjIn9u454tHBQtIsWVHw2nSf8Sk=; b=eFmOBfrhGoRr+hUhw2fPE3GWWqCfx4piCQP8WHtuz3oT+nnAnjuSbZ8eS5AVS9Wba+ lXPFodgL1v1g94Scdwj1xx86u3Urat8mmDLhHhGteW2gkxdGu7CvM7hINDqCFpXARn18 kXG8H1RNfLioA+5E/fWdhNAGLAZD5A09zYOLUmjs3BvrY93VX5GKqZOuPWEZjbJYaiDO 5FpBnthg0BGFrwcLssBZSCbRsSLYdLhKMFMdGFMxJ+5UyQcuV8onVKcSPy58dx1UXhDY iv36Ax6CP6AdhD2b/i9quWshSln8uMzZ4uuQvyvysdeg4ucrT8APCbUeI2PbUDP+Vo2X 8kAw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=G0rDXsb+; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-108406-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108406-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id v28-20020a05620a0a9c00b00789e253e584si11066062qkg.487.2024.03.19.20.21.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 20:21:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-108406-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=G0rDXsb+; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-108406-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-108406-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 43ED11C2202B for ; Wed, 20 Mar 2024 03:21:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9C9D011712; Wed, 20 Mar 2024 03:21:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="G0rDXsb+" Received: from mail-oa1-f41.google.com (mail-oa1-f41.google.com [209.85.160.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 92E7510A16 for ; Wed, 20 Mar 2024 03:21:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710904864; cv=none; b=nCWMAibbIa66g1In8MtEsCeUxE2DO7oqHjsDVz8NVvj+k4lc3k8igjFC8NRWAuuxSmpiX5JEoXIiYDKvPHLrd6VngipZbpnWKgP1TPXWdtAWiOu9dwgF9rXLRsosZlSR4sjR/in2GcrW3xxtre36W5ZCKdFqfWOvMOjyU4rKfUc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710904864; c=relaxed/simple; bh=P+Zkz/NOWOsgVlncUTyNmvXcTlE9NnXrsFiBq9pCUv4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=P6MnSxGSdz417PpEUP2z+G2IYkzQR/axHj1HIhVW1tozhmjqiF7/0aWnfut9zW0Ez9/0FJFuSTDQvrzdXV5AKpCtAQbP2d+kn4dJ7OJD1/KhmVc5LvK8GSGiii6e/Tmf3G8rsWoeGyLWqZ1Wz5u6btHOavmCh/bbziVt1FY1dAQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=G0rDXsb+; arc=none smtp.client-ip=209.85.160.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-oa1-f41.google.com with SMTP id 586e51a60fabf-22215ccbafeso3156320fac.0 for ; Tue, 19 Mar 2024 20:21:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710904860; x=1711509660; 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=o4P//duYekxql85fsXRWTB88tD2kAUJ1b3yRQNxznTM=; b=G0rDXsb+nnyNVMah+5vN0hFi+6hfWke8yQ1q9G5UNpAEAUUhX38zmgYTPxFFhHRpNU ttX5BaihaFfw+rH0NbboHBbWRdmpxO6avCv5o9uBZw79HwXpjdpTA91E+h7nA4IBMggK 76hd7s57uVZLWZYH1tU2t75sgBr/lCFjcsXjM5O2Lw5mSygTpQE6nhqCUSwUP4J5cOWE lRPRPjEofRNgfXKoxzWCIt0oNpxxhAkr6Up5h2UrsQXU1dsg9ZUcD8T8dsKB5EWe64Qg j8B3/gKxVRqYTyvfFXKbfqmEAm3+LVwe0G0kW8hlt4R2PiMXWvPn3Tbl/DdnxduAhhFg jhfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710904860; x=1711509660; 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=o4P//duYekxql85fsXRWTB88tD2kAUJ1b3yRQNxznTM=; b=ubi6OFgDIYcQ3X2ELFe0uIdUEWS87jkuc4yXdwvEZZuz93EM/vCSq3BDY8nbY4CRtW vnbVV86BWz1yD1UKLRN27Uw5cmUOXHUimEWGF1+UjZxRPIfctoH6A0bGomoWb20KTw6H HC3TzxiSP/TIn6tLT8izl7CMgRcuNmq/vwn1CX5vJ1hQplbRFhAPUby4ilcvXi3JMXiW 3fyg2xomKO05iV8dsMprCVpyhH2MgrrE/tdM54FrJPPp5BLfqli+y0j5sKSjQyJU8j+N KFYT1mdajlTqYOHCWwfIw+f8VEjDBnG3GfFQhL5sXp1iGIYDOON2zMUE3rIjSkl/gDO4 GPIA== X-Forwarded-Encrypted: i=1; AJvYcCVk6vbuvybT0v02NS/utfjz4NEm+glDoPmq63MyNLUxIkUYxgddfR5TdCPKYjC3OvSXdevXzQ8VA4kjQEml/5/jYeF6HotSJ2e+2m0o X-Gm-Message-State: AOJu0Yxb2t8lPPiQ+3oLwWCQkxUH1yaMNY6Ndspc0hP+PvR6tFt2Q4Sy hHDu+2tirvlMxKwl9xkjrbS80gKcTTxkMbupad0mExnM/kSqXX2Q9dzuYCqLG9s= X-Received: by 2002:a05:6870:c1d2:b0:220:94b4:2074 with SMTP id i18-20020a056870c1d200b0022094b42074mr19107005oad.37.1710904860544; Tue, 19 Mar 2024 20:21:00 -0700 (PDT) Received: from localhost ([122.172.85.206]) by smtp.gmail.com with ESMTPSA id 4-20020a056a00070400b006e71d70c795sm5416714pfl.96.2024.03.19.20.20.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 20:21:00 -0700 (PDT) Date: Wed, 20 Mar 2024 08:50:56 +0530 From: Viresh Kumar To: Xuewen Yan Cc: rafael@kernel.org, ke.wang@unisoc.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, xuewen.yan94@gmail.com, di.shen@unisoc.com Subject: Re: [PATCH] cpufreq: Use a smaller freq for the policy->max when verify Message-ID: <20240320032056.2noz6lu3k2utcpid@vireshk-i7> References: <20240319080153.3263-1-xuewen.yan@unisoc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240319080153.3263-1-xuewen.yan@unisoc.com> On 19-03-24, 16:01, Xuewen Yan wrote: > When driver use the cpufreq_frequency_table_verify() as the > cpufreq_driver->verify's callback. It may cause the policy->max > bigger than the freq_qos's max freq. > > Just as follow: > > unisoc:/sys/devices/system/cpu/cpufreq/policy0 # cat scaling_available_frequencies > 614400 768000 988000 1228800 1469000 1586000 1690000 1833000 2002000 2093000 > > unisoc:/sys/devices/system/cpu/cpufreq/policy0 # echo 1900000 > scaling_max_freq > unisoc:/sys/devices/system/cpu/cpufreq/policy0 # echo 1900000 > scaling_min_freq > unisoc:/sys/devices/system/cpu/cpufreq/policy0 # cat scaling_max_freq > 2002000 > unisoc:/sys/devices/system/cpu/cpufreq/policy0 # cat scaling_min_freq > 2002000 > > When user set the qos_min and qos_max as the same value, and the value > is not in the freq-table, the above scenario will occur. > > This is because in cpufreq_frequency_table_verify() func, when it can not > find the freq in table, it will change the policy->max to be a bigger freq, > as above, because there is no 1.9G in the freq-table, the policy->max would > be set to 2.002G. As a result, the cpufreq_policy->max is bigger than the > user's qos_max. This is unreasonable. > > So use a smaller freq when can not find the freq in fre-table, to prevent freq-table > the policy->max exceed the qos's max freq. > > Signed-off-by: Xuewen Yan > --- > drivers/cpufreq/freq_table.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) Acked-by: Viresh Kumar -- viresh