ARM: tegra: cpuquiet: Notify the cpuquiet governor when the driver is busy
author	Sai Charan Gurrappadi <sgurrappadi@nvidia.com>
Wed, 11 Jul 2012 00:33:58 +0000 (17:33 -0700)
committer	Lokesh Pathak <lpathak@nvidia.com>
Wed, 25 Jul 2012 11:02:17 +0000 (04:02 -0700)
Added generic busy/free notifiers that the driver can invoke to let the
governor know that it cannot process further core online/offline
requests (invoked in our case whenever we switch to the LP cluster).

Change-Id: I5e3f7f28f38806a7f87050e8d0c8d2f2cf7521aa
Signed-off-by: Sai Charan Gurrappadi <sgurrappadi@nvidia.com>
Reviewed-on: http://git-master/r/114807
Reviewed-by: Lokesh Pathak <lpathak@nvidia.com>
Tested-by: Lokesh Pathak <lpathak@nvidia.com>
ARM: tegra: refactor cpuquiet driver
author	Peter De Schrijver <pdeschrijver@nvidia.com>
Wed, 19 Sep 2012 15:21:17 +0000 (18:21 +0300)
committer	Simone Willett <swillett@nvidia.com>
Fri, 16 Nov 2012 03:25:04 +0000 (19:25 -0800)
Refactor the cpuquiet driver to use 1 workqueue which handles the
clusterswitch and cpu online/offline operations.

Functional changes compared to the previous driver:

+ changing no_lp also triggers a clusterswitch if the current cluster is the
  LP cluster.

+ removing all QoS constraints will return to the configuration as defined by
  the governor.

+ the minimum CPUs online QoS constraint will always prevail above the maximum
  CPUs online constraint. If both constraints are set, the maximum CPUs online
  constraint will be clamped to the minimum constraint.

bug 1047545
bug 1055406

Change-Id: Ib52de2578254c282f23f972484a6532d24fdc0e9
Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Reviewed-on: http://git-master/r/134391
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>
Reviewed-by: Peter Boonstoppel <pboonstoppel@nvidia.com>
Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>
ARM: tegra: cpuquiet: Bring back hotplug stats support
author	Peter Boonstoppel <pboonstoppel@nvidia.com>
Mon, 10 Sep 2012 20:47:29 +0000 (13:47 -0700)
committer	Rohan Somvanshi <rsomvanshi@nvidia.com>
Thu, 13 Sep 2012 09:41:40 +0000 (02:41 -0700)
Hotplug stats are needed for dfs_log and Power Signature. Cpuquiet
provides similar stats in the core layer, but cannot provide stats for
LP cpu, since this is only visible at the driver level.

Bug 1045785

Change-Id: I6c5c26912d1a26637e81c73741637fbd2bee6157
Signed-off-by: Peter Boonstoppel <pboonstoppel@nvidia.com>
Reviewed-on: http://git-master/r/131210
Reviewed-by: Automatic_Commit_Validation_User
Tested-by: Shaoming Feng <shaomingf@nvidia.com>
Reviewed-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>
GVS: Gerrit_Virtual_Submit
ARM: tegra: cpuquiet: Fix compiler warnings
author	Peter Boonstoppel <pboonstoppel@nvidia.com>
Fri, 16 Nov 2012 19:01:51 +0000 (11:01 -0800)
committer	Simone Willett <swillett@nvidia.com>
Tue, 20 Nov 2012 01:33:24 +0000 (17:33 -0800)
Bug 1055406

Change-Id: I5033cc19e170d932c3697821a0f3273957789995
Signed-off-by: Peter Boonstoppel <pboonstoppel@nvidia.com>
Reviewed-on: http://git-master/r/164384
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>
Tested-by: Diwakar Tundlam <dtundlam@nvidia.com>
Reviewed-by: Peter De Schrijver <pdeschrijver@nvidia.com>
ARM: tegra: avoid race condition between cpufreq and clusterswitch
author	Peter De Schrijver <pdeschrijver@nvidia.com>
Wed, 21 Nov 2012 15:39:58 +0000 (17:39 +0200)
committer	Mrutyunjay Sawant <msawant@nvidia.com>
Thu, 6 Dec 2012 10:52:40 +0000 (02:52 -0800)
Avoid a race condition between cpufreq and clusterswitch and also make writes
to no_lp and enable synchronous operations.

bug 1178947

Change-Id: Ib9608f8a0a22be84d3c0916babb7e43c1f6df2e1
Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Reviewed-on: http://git-master/r/165751
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>
Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>
ARM: tegra: Rework timer for clusterswitching
author	Peter De Schrijver <pdeschrijver@nvidia.com>
Wed, 12 Dec 2012 16:44:10 +0000 (18:44 +0200)
committer	Rohan Somvanshi <rsomvanshi@nvidia.com>
Mon, 17 Dec 2012 14:40:35 +0000 (06:40 -0800)
This patch introduces a separate timer for clusterswitching. The timer will
queue the usual workitem on expiry. This allows all other operations to
happen immediately without having to cancel a delayed workitem. It also allows
the timer itself to be canceled when the conditions for a clusterswitch are
no longer fulfilled.

bug 1178947

Change-Id: Ieb63baf5a38ebcca29ad938365e46530f755a105
Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
(cherry picked from commit 1dec3e79989d37f46c585a5265276bc2871c87a7)
Reviewed-on: http://git-master/r/170634
Reviewed-by: Peter Boonstoppel <pboonstoppel@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Tested-by: Peter Boonstoppel <pboonstoppel@nvidia.com>
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>
ARM: tegra: only do clusterswitching in 1 CPU mode
author	Peter De Schrijver <pdeschrijver@nvidia.com>
Tue, 18 Dec 2012 14:04:36 +0000 (16:04 +0200)
committer	Varun Colbert <vcolbert@nvidia.com>
Thu, 27 Dec 2012 04:08:19 +0000 (20:08 -0800)
Only consider clusterswitching when there is a single CPU online.
This is done by ignoring frequency changes when there are more cores
online and registering a notifier to immediately switch to the slow
cluster if there is only 1 CPU online and the frequency is below
idle_bottom_freq.

bug 1178947
bug 1202877

Change-Id: I1244f866de1d32c268d36c835cd90d9c6cba1481
Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Reviewed-on: http://git-master/r/172346
(cherry picked from commit 309a2860fa6784d7e35ee114cf061599b19c4d91)
Reviewed-on: http://git-master/r/173718
Reviewed-by: Peter Boonstoppel <pboonstoppel@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Tested-by: Peter Boonstoppel <pboonstoppel@nvidia.com>
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>
ARM: tegra: Only check for LP switch on CPU_POST_DEAD
author	Peter De Schrijver <pdeschrijver@nvidia.com>
Fri, 4 Jan 2013 12:06:09 +0000 (14:06 +0200)
committer	Simone Willett <swillett@nvidia.com>
Wed, 9 Jan 2013 02:32:20 +0000 (18:32 -0800)
Apparently the cpu hotplug notifier can be called when the kernel can't sleep.
In those cases blocking operations can cause a kernel panic. Solve this by
only doing potentially blocking operations when a CPU has been removed. This
shouldn't cause any power regressions as we can only switch to the slow
cluster when only CPU0 is online.

Bug 1189926
Bug 1211686
Bug 1213817

Change-Id: I54356d2a8a8ae3a5253b9b2c216ada283955e585
Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Reviewed-on: http://git-master/r/189105
Reviewed-by: Automatic_Commit_Validation_User
Tested-by: Ankit Gupta (SW-TEGRA) <ankitgu@nvidia.com>
Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>
ARM: tegra: cpuquiet: fix race condition
author	Sang-Hun Lee <sanlee@nvidia.com>
Tue, 5 Feb 2013 05:02:52 +0000 (21:02 -0800)
committer	Mandar Padmawar <mpadmawar@nvidia.com>
Wed, 6 Feb 2013 13:40:41 +0000 (05:40 -0800)
Remove race conditions around cpq_state access

Bug 1225764

Change-Id: I73f28b81d9488633294eaa04369f15993f742cb0
Signed-off-by: Sang-Hun Lee <sanlee@nvidia.com>
Reviewed-on: http://git-master/r/197265
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Peter Boonstoppel <pboonstoppel@nvidia.com>
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>
arm: mach-tegra: resolve tegra_cpu_lock race condition
author	Sang-Hun Lee <sanlee@nvidia.com>
Mon, 11 Feb 2013 01:48:24 +0000 (17:48 -0800)
committer	Mandar Padmawar <mpadmawar@nvidia.com>
Mon, 18 Feb 2013 14:57:29 +0000 (06:57 -0800)
Problem description:

 - lock used in cpuquiet, cpu-tegra3.c, tegra2-throttle.c, and tegra3_throttle
   originate from cpu-tegra.c, tegra_cpu_lock
 - edp_update_limit and tegra_auto_hotplug_governor need a protection from
   tegra_cpu_lock. These are also called by tegra_cpu_set_speed_cap
 - Some callers of tegra_cpu_set_speed_cap do not acquire tegra_cpu_lock,
   but some do

Fix description:

 - Create a locked variant and unlocked variant of tegra_cpu_set_speed_cap
   to make it explicit that tegra_cpu_lock is needed for tegra_cpu_set_speed_cap
 - Replace existing calls with new variants of tegra_cpu_set_speed_cap appropriately

Bug 1225764

Change-Id: I8aa6356df278375e3a9105023f66c8286e3fdbef
Signed-off-by: Sang-Hun Lee <sanlee@nvidia.com>
Reviewed-on: http://git-master/r/199238
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>
ARM: tegra: cpuquiet: Honor G->LP delay on last core down
author	Peter Boonstoppel <pboonstoppel@nvidia.com>
Thu, 31 Jan 2013 21:22:02 +0000 (13:22 -0800)
committer	Mandar Padmawar <mpadmawar@nvidia.com>
Mon, 18 Feb 2013 15:02:58 +0000 (07:02 -0800)
We cluster switch G->LP when 2 conditions are met:
1) we are in single core mode
2) CPU freq reaches idle_bottom_freq

After these 2 conditions are met, we wait for down_delay ms before
cluster switching. This patch ensures the timeout is also honored when
the first condition is met last.

Bug 1226607

Change-Id: Ic36f9cab09a5967b71409e44dbe89290f39cb26b
Signed-off-by: Peter Boonstoppel <pboonstoppel@nvidia.com>
Reviewed-on: http://git-master/r/200537
Reviewed-by: Mandar Padmawar <mpadmawar@nvidia.com>
Tested-by: Mandar Padmawar <mpadmawar@nvidia.com>
ARM: tegra: cpuquiet: make userspace governor actions synchronous
author	Peter De Schrijver <pdeschrijver@nvidia.com>
Tue, 12 Feb 2013 15:51:26 +0000 (17:51 +0200)
committer	Simone Willett <swillett@nvidia.com>
Sat, 13 Apr 2013 01:09:45 +0000 (18:09 -0700)
Userspace expects changes to happen synchronously. Implement this by waiting
with a (configureable) timeout for the action to happen.

Bug 1220065

Change-Id: I81301719707e4baf2b3aea62c38fc771ffe1205d
Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com>
(cherry picked from commit 9de8f56142e64ebf388b5427ef7fd142078dfa87)
Reviewed-on: http://git-master/r/#change,200013
Reviewed-on: http://git-master/r/215934
GVS: Gerrit_Virtual_Submit
Reviewed-by: Matt Wagner <mwagner@nvidia.com>
Tested-by: Matt Wagner <mwagner@nvidia.com>
ARM: tegra: cpuquiet: augment no_lp to force both LP and G
author	Simo Melenius <smelenius@nvidia.com>
Fri, 8 Mar 2013 09:24:12 +0000 (11:24 +0200)
committer	Simone Willett <swillett@nvidia.com>
Sat, 13 Apr 2013 01:09:49 +0000 (18:09 -0700)
- tegra_cpuquiet 'no_lp' node now accepts '-1' to force LP cluster on
- when a cluster is forced the switches take place immediately without
  any delay

Bug 1247636

Reviewed-on: http://git-master/r/208772
(cherry picked from commit ab16bbb6f581da538448d2a64e03dd272b8fb985)
Change-Id: I1ec07acc3cf51419a4770542c6a1c90b92e0bf66
Signed-off-by: Simo Melenius <smelenius@nvidia.com>
Reviewed-on: http://git-master/r/215935
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Matt Wagner <mwagner@nvidia.com>
Tested-by: Matt Wagner <mwagner@nvidia.com>
ARM: tegra: cpuquiet: make no_lp = -1 always force cluster switch
author	Peter Boonstoppel <pboonstoppel@nvidia.com>
Fri, 5 Apr 2013 23:38:37 +0000 (16:38 -0700)
committer	Simone Willett <swillett@nvidia.com>
Sat, 13 Apr 2013 01:09:58 +0000 (18:09 -0700)
When setting the no_lp sysfs node to -1 the system would attempt to
switch to the LP cluster. This can fail if the frequency or the number
of online cores are too high.

This change ensure the frequency and number of online cores are first
brought down, such that a cluster switch on no_lp = -1 always
succeeds.

Bug 1247636
Bug 1253920

Change-Id: If6af671e8defdfc8172e8d9356ddf03d54bae98d
Signed-off-by: Peter Boonstoppel <pboonstoppel@nvidia.com>
Reviewed-on: http://git-master/r/218464
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Matt Wagner <mwagner@nvidia.com>
Tested-by: Matt Wagner <mwagner@nvidia.com>
ARM: tegra: cpuquiet: Add Margin to Clock Calculation
author	Matt Wagner <mwagner@nvidia.com>
Thu, 11 Apr 2013 23:57:36 +0000 (16:57 -0700)
committer	Simone Willett <swillett@nvidia.com>
Sat, 13 Apr 2013 01:10:25 +0000 (18:10 -0700)
Added 30Mhz offset when using the maximum clock on LP
due to a rounding issue that causes us to fail entry to LP on high load.

Bug 1253920

Change-Id: Ibca5451d426d8e3458a9ad0a91b720238567a752
Signed-off-by: Matt Wagner <mwagner@nvidia.com>
Reviewed-on: http://git-master/r/218998
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Peter Boonstoppel <pboonstoppel@nvidia.com>
GVS: Gerrit_Virtual_Submit