Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp1446260imp; Fri, 22 Feb 2019 03:45:57 -0800 (PST) X-Google-Smtp-Source: AHgI3IalMmVWdUn4c6tVEgjPBRFZ89inCsKSut3dME1+7OIpXBnneU7xHgK8bLIjgr5eH3HyeJp7 X-Received: by 2002:a17:902:5a42:: with SMTP id f2mr3794488plm.157.1550835957732; Fri, 22 Feb 2019 03:45:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550835957; cv=none; d=google.com; s=arc-20160816; b=QBDxlOPB6x/tBou83dcibfx9WjgX0mFI8OAAxKYyB6Aux8DCGbNnjfHUGKNllpFm52 nCnhYBpRvpasQK08+1ZlItTGT0Ddb7Z7o4bQfS2RyvD4bKjnqdUrpsG8xnLH/jBS/Kju fMB/w3Qx3xBd4Cqao90MyF0qGRR2vpUOY+t3Y+EV7ekBMf4Dc0fgC7ZwlUFoJl3s1/Hb Z3U9ETiWdDQo3Fla8k4UycSsjLVE4lnsJVakcLdW2lXREhHhQgVdLTgK+u+46ROrhBP/ OIWxd5iHTH33D7Wewi8HKMjjQDzjtK1Ql6dBujI7qxZyc7zVYUYxa+w7S/At6FwoPdu8 nD7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Wg33mLCpu74N3PaWb9V6LfBdxmyDHUw8R7YI7c9V+cI=; b=rhTS3e2caLXRcgra+Bku3oj8Bjgh/uRonbtEx4x2pyqMX7dDeWWrFNM8duOMcZP0QV yB2Z4EbV7iypr/9HGuzg7WaWIuVJPsaUKb6X7BmCRQYk4UJH65seQlLHew3bwC7APy2e aFYlCQW76ZdG0PHhCRsSsr40PEcPAEMrLEot2Cdif7FKR6MIhhnYY+LsN9hBRT66aPlz lc7lrJYchehl+t1S5V2febKZHTm/bIK93Yi+JkNXZw8eqADaNx8SLbBe6UYmhl54PVcj ZVyNAnqE3AagFQpzIKxAa42cm8QU8tDwryPP/Su31VtHWIWXI3MEJhNcDFHbfOs7qL4F gm1w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f2si1273625pgc.21.2019.02.22.03.45.42; Fri, 22 Feb 2019 03:45:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727263AbfBVLov (ORCPT + 99 others); Fri, 22 Feb 2019 06:44:51 -0500 Received: from foss.arm.com ([217.140.101.70]:58410 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727026AbfBVLou (ORCPT ); Fri, 22 Feb 2019 06:44:50 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4ACF815AB; Fri, 22 Feb 2019 03:44:50 -0800 (PST) Received: from e107158-lin.cambridge.arm.com (e107158-lin.cambridge.arm.com [10.1.195.17]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E7F7F3F5C1; Fri, 22 Feb 2019 03:44:48 -0800 (PST) Date: Fri, 22 Feb 2019 11:44:46 +0000 From: Qais Yousef To: Viresh Kumar Cc: Rafael Wysocki , linux-pm@vger.kernel.org, Vincent Guittot , mka@chromium.org, juri.lelli@gmail.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH V2 4/5] cpufreq: Register notifiers with the PM QoS framework Message-ID: <20190222114446.cmwoe7tanxvf2gxh@e107158-lin.cambridge.arm.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Verish On 02/21/19 16:59, Viresh Kumar wrote: [...] > @@ -2239,6 +2314,8 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy, > struct cpufreq_policy *new_policy) > { > struct cpufreq_governor *old_gov; > + struct device *cpu_dev = get_cpu_device(policy->cpu); > + unsigned long min, max; > int ret; > > pr_debug("setting new policy for CPU %u: %u - %u kHz\n", > @@ -2253,11 +2330,23 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy, > if (new_policy->min > new_policy->max) > return -EINVAL; > > + min = dev_pm_qos_read_value(cpu_dev, DEV_PM_QOS_MIN_FREQUENCY); > + max = dev_pm_qos_read_value(cpu_dev, DEV_PM_QOS_MAX_FREQUENCY); > + > + if (min > new_policy->min) > + new_policy->min = min; > + if (max < new_policy->max) > + new_policy->max = max; > + Assuming for example min and max range from 1-10, and thermal throttles max to 5 using pm_qos to deal with temporary thermal pressure. But shortly after a driver thinks that max shouldn't be greater than 7 for one reason or another. What will happen after thermal pressure removes its constraint? Will we still remember the driver's request and apply it so max is set to 7 instead of 10? Thanks -- Qais Yousef