Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp4057389imc; Sun, 24 Feb 2019 20:32:56 -0800 (PST) X-Google-Smtp-Source: AHgI3IbyohXWc6Z/Cvvj0+JOVBPebFeYkqllzE4ZX197hYiHX45m6pbsmxYmLfXC0ASUgo+4ZUtD X-Received: by 2002:a17:902:7e46:: with SMTP id a6mr18340463pln.150.1551069176073; Sun, 24 Feb 2019 20:32:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551069176; cv=none; d=google.com; s=arc-20160816; b=TzkYAceK3r5R/WcWByCVqeW4WdINR7A1jxW6uvK7jGRdlMhqABT6smdH3eaXFmIJ6m j33bxh913HIgSvPBy1N2VpCEkxnrEYQbPta14pOptLyaACR9GX869z9Hvws8H6Mk7yds PY2jrmlsg+XPa2FrZE0HPdVi5AcRki8NP8BkzHNw9g37kgzNUSuoD7YKiQSDrWZ8szBM HpVeBh9/7Xrw/BEhzQpXUThesuX+41GXwXyiW9jl1jOxvaitlbumpfpu9y7lR9Dq8760 Lj/dL27qCaUj8FCx2f+dhMbOXy+5MMk930/lfXYJuYvhGLhsZuBKKFpOkX4Ru2hdmqcK kWjw== 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:dkim-signature; bh=rYf2LhY7n8Vfj8pnEn/byn20/glTL8uacNOUrzp+1js=; b=x/rQQa0BcGeT1YWAx7wRBXS5uMvvDbo5vRi1fh4A38VP3Sdk0GBl12Sc8K7hd8/S+k k4g8+OoItS1b8ts8SHaUn0Yek+7oQx5B7ql4ETF5LSbmW8xzLLKbD09W6bHdmTSo1D4G fVomVBueiZrgRMIO/+ZDed3gCOj3IV+0dHx9vnIlJug3haEdcrWB1I3hisU8R4IAIU3H woPKTSvuuP+0k1rKho9aEkv3Igx1BfkVFJzHsn9aciEwweudbLuEq/37GqmkQ5l5ftd3 B+t+fr+fYiqAEjiLfvDEFM9ixmsC5AduBHDj0dqbqM0hm1Uv/AoCiCkjUzsdjRPBagGV Hmcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=C5vyRBng; 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 a89si8754643pla.362.2019.02.24.20.32.40; Sun, 24 Feb 2019 20:32:56 -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; dkim=pass header.i=@linaro.org header.s=google header.b=C5vyRBng; 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 S1728217AbfBYEbx (ORCPT + 99 others); Sun, 24 Feb 2019 23:31:53 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:38091 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726539AbfBYEbx (ORCPT ); Sun, 24 Feb 2019 23:31:53 -0500 Received: by mail-pg1-f196.google.com with SMTP id m2so3871418pgl.5 for ; Sun, 24 Feb 2019 20:31:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=rYf2LhY7n8Vfj8pnEn/byn20/glTL8uacNOUrzp+1js=; b=C5vyRBngGsD1YNkkMnIJbty0MiFAEOCzzES0BqHIuNeLG/viUNI3E5wkM/5ORBK69b iDTZe+D14k66ap705UQCD85b25/hS4Xks1I4R0ZitDyI9xfi3iLn40RjvWuSzGnmgdxB ZudsoaYjWYJxRSojBNlDpKmmRkoGID8/8eodwoGskOUo7FLKv9MToeeV54Qgyc19jCZ5 oTb63OGHL3HchVlHT0xtOIm6K88Ld0kVc5xPf2aP0bkh1oJhwqqgAJtKTmYENJzIz9gt DRAl9JFEslDMsecfwpPfrJ8toeg4Jc+De+hQ6/9axQYZrRz/YqwalPt/FGZWg7jSIMTY /isg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=rYf2LhY7n8Vfj8pnEn/byn20/glTL8uacNOUrzp+1js=; b=U9PnTpyzbzwWSV5FSSuD/FEtDmZ/fspMWOdrQ5hWgvHHsS86BmdaQnFfA3JeXZIaaZ Jg4dH3FsGXgNAaRADuhpX7jLJIP1xOltULyO1JjKZEZ89a+chN8UNZG/lwe8IZz+mcD2 HUFCTAw39za+Y85q/VwFp4RGvns4g8CKB5VsBx3/+BeZiIjJetBOoKeRqQhftlxtW6DH wMO6spfsjZ4xBUVGUkTLhAnuvmOBxdxXcwqIPwnoBL/CwWVpkAsf5Bo/hFWaKhXT3l73 dQu2r8UwFoXFjo4mCt2kTXISp4rdpq76RcyAHAl7+BN6AK3tjFmob+gMzrJv1SY3RQ97 mrmg== X-Gm-Message-State: AHQUAuYHCSmwH3Cuee16ZEF7e9QWwLsAnoxRNOnWQdz3vuU4luY8R6tR Rs5KmLdrrUp7pB2LAArP11kqoQ== X-Received: by 2002:a63:1266:: with SMTP id 38mr16919043pgs.388.1551069112075; Sun, 24 Feb 2019 20:31:52 -0800 (PST) Received: from localhost ([122.167.168.92]) by smtp.gmail.com with ESMTPSA id 4sm19227580pft.96.2019.02.24.20.31.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 24 Feb 2019 20:31:51 -0800 (PST) Date: Mon, 25 Feb 2019 10:01:49 +0530 From: Viresh Kumar To: Qais Yousef 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: <20190225043149.bfl5vdb57xaaje2w@vireshk-i7> References: <20190222114446.cmwoe7tanxvf2gxh@e107158-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190222114446.cmwoe7tanxvf2gxh@e107158-lin.cambridge.arm.com> User-Agent: NeoMutt/20180323-120-3dd1ac Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 22-02-19, 11:44, Qais Yousef wrote: > 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? Once everything comes via PM QoS, it will remember all the presently available requests and choose a target min/max frequency based on that. But even with this patchset, with half stuff done with PM QoS and half done with cpufreq notifiers, it should still work that way only. -- viresh