Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp399508img; Tue, 26 Feb 2019 02:01:16 -0800 (PST) X-Google-Smtp-Source: AHgI3IZWMtHs23k891giGtC6qNUfVevoV8rWICzJhClHAhRuiEcCnV79OwjShOO+HP8+ktKeFS9s X-Received: by 2002:a63:cf01:: with SMTP id j1mr23532220pgg.342.1551175276017; Tue, 26 Feb 2019 02:01:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551175276; cv=none; d=google.com; s=arc-20160816; b=HkTXFf3akVmb2o/a/zUKQ5hvutRfXVOKgOCUmiHEf/lMjUlaO7Cldx2RPcupaDxsqV NMKHBywfu8crzx4nx9hDRuYqUtEbhsGLjQLW92wzhqzUwL3smtSBBDIhmLA6JXZZUnCn UlP7lvqtraqNNFOxlG5xmdU7TKBC2XzDPtwOgPbdKPYhRJhKaNDRJzFmlehCNOXPVZqb iZp+uqHi0lyLWDpeqNQrscS3wXcR77W4XP37YI9SjCjuADgeN89wPNKcsIDl6XJnJpQG qIVWV8jenqaoBvkbsBh8LTXjcwQ6I2i3sPoQ2yAEaxzVaaiqAoBrJPiVS3sOw1Z4G2k3 5cgQ== 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=aRjiwUWIk/A2gY4gs/VcZH1J515SLtQA1vj0wsGSTpQ=; b=pmkJqEuqLN/cYGziqebgE/pgKCoQZDmvyCYVal0tE64sEaFrhn5ojwjQxYdSzg0msx PG3bi+CvRS1bFItwwA59HUbOz0qDPHcUe5ToKvOgorU60FHOKWM4mTe/8yLKO4mUfcp4 blBPaFQxXsyFQJv8kgGQul0byDeo/OnWyV9RpHaK2xdxMBc3OQWB6mPkiUbM/50mLaCs EoaNOucZji71wOlV70PT2ZWRugLH8XfT3UyiO80KYx5imOtsCfPU4KLPc9G8VSoItz8v N5p64jcLKUxlaaB4UXbu6FGg2xMNFBJgj4vs+7lUC0i/upj7n6hDkKNgMlZSNKgnJ543 ekiA== 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 s20si11891422plr.14.2019.02.26.02.01.00; Tue, 26 Feb 2019 02:01:15 -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 S1727690AbfBZKAe (ORCPT + 99 others); Tue, 26 Feb 2019 05:00:34 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:43938 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727462AbfBZKAe (ORCPT ); Tue, 26 Feb 2019 05:00:34 -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 2952F80D; Tue, 26 Feb 2019 02:00:33 -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 C69AB3F71D; Tue, 26 Feb 2019 02:00:31 -0800 (PST) Date: Tue, 26 Feb 2019 10:00:28 +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: <20190226100028.rfvth7r4j33qljrv@e107158-lin.cambridge.arm.com> References: <20190222114446.cmwoe7tanxvf2gxh@e107158-lin.cambridge.arm.com> <20190225043149.bfl5vdb57xaaje2w@vireshk-i7> <20190225085847.yvrtmxtwvk725b7v@e107158-lin.cambridge.arm.com> <20190225090955.suq4jw26d2brkjha@vireshk-i7> <20190225121458.fvdiiumgyhhdardw@e107158-lin.cambridge.arm.com> <20190226023016.ooyjsiopsyc6vg5s@vireshk-i7> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190226023016.ooyjsiopsyc6vg5s@vireshk-i7> User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/26/19 08:00, Viresh Kumar wrote: > On 25-02-19, 12:14, Qais Yousef wrote: > > On 02/25/19 14:39, Viresh Kumar wrote: > > > On 25-02-19, 08:58, Qais Yousef wrote: > > > > On 02/25/19 10:01, Viresh Kumar wrote: > > > > > > > + 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; > > > > > > > And this is why we need to check here if the PM QoS value doesn't conflict with > > > > the current min/max, right? Until the current notifier code is removed they > > > > could trip over each others. > > > > > > No. The above if/else block is already removed as part of patch 5/5. It was > > > required because of conflict between userspace specific min/max and qos min/max, > > > which are migrated to use qos by patc 5/5. > > > > > > The cpufreq notifier mechanism already lets users play with min/max and that is > > > already safe from conflicts. > > > > > > > > > > It would be nice to add a comment here about PM QoS managing and remembering > > > > values > > > > > > I am not sure if that would add any value. Some documentation update may be > > > useful for people looking for details though, that I shall do after all the > > > changes get in and things become a bit stable. > > > > > > > Up to you. But not everyone is familiar with the code and a one line comment > > that points to where aggregation is happening would be helpful for someone > > scanning this code IMHO. > > Okay, will add something then. > > > > > and that we need to be careful that both mechanisms don't trip over > > > > each others until this transient period is over. > > > > > > The second mechanism will die very very soon once this is merged, migrating them > > > shouldn't be a big challenge AFAICT. I didn't attempt that because I didn't > > > wanted to waste time updating things in case this version also doesn't make > > > sense to others. > > > > > > > I have a nit too. It would be nice to explicitly state this is > > > > CPU_{MIN,MAX}_FREQUENCY. I can see someone else adding {MIN,MAX}_FREQUENCY for > > > > something elsee (memory maybe?) > > > > > > This is not CPU specific, but any device. The same interface shall be used by > > > devfreq as well, who wanted to use freq-constraints initially. > > > > > > > I don't get that to be honest. I probably have to read more. > > > > Is what you're saying that when applying a MIN_FREQUENCY constraint the same > > value will be applied to both cpufreq and devfreq? Isn't this too coarse? > > Oh no. A constraint with QoS is added like this: > > dev_pm_qos_add_request(dev, req, DEV_PM_QOS_MIN_FREQUENCY, min); > > Now dev here can be any device struct, CPU's or GPU's or anything else. All the > MIN freq requests are stored/processed per device and for a CPU in cpufreq all > we will see is MIN requests for the CPUs. And so the macro is required to be a > bit generic and shouldn't have CPU word within it. > > Hope I was able to clarify your doubt a bit. Thanks. Ah I see yes it all makes sense now. Thanks! -- Qais Yousef