aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
Commit message (Collapse)AuthorAgeFilesLines
* Merge kernel.org linux-3.0.y into HEADKalimochoAz2012-10-311-8/+1
|\
| * cpufreq / powernow-k8: Remove usage of smp_processor_id() in preemptible codeAndreas Herrmann2012-10-311-8/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit e4df1cbcc1f329e53a1fff7450b2229e0addff20 upstream. Commit 6889125b8b4e09c5e53e6ecab3433bed1ce198c9 (cpufreq/powernow-k8: workqueue user shouldn't migrate the kworker to another CPU) causes powernow-k8 to trigger a preempt warning, e.g.: BUG: using smp_processor_id() in preemptible [00000000] code: cpufreq/3776 caller is powernowk8_target+0x20/0x49 Pid: 3776, comm: cpufreq Not tainted 3.6.0 #9 Call Trace: [<ffffffff8125b447>] debug_smp_processor_id+0xc7/0xe0 [<ffffffff814877e7>] powernowk8_target+0x20/0x49 [<ffffffff81482b02>] __cpufreq_driver_target+0x82/0x8a [<ffffffff81484fc6>] cpufreq_governor_performance+0x4e/0x54 [<ffffffff81482c50>] __cpufreq_governor+0x8c/0xc9 [<ffffffff81482e6f>] __cpufreq_set_policy+0x1a9/0x21e [<ffffffff814839af>] store_scaling_governor+0x16f/0x19b [<ffffffff81484f16>] ? cpufreq_update_policy+0x124/0x124 [<ffffffff8162b4a5>] ? _raw_spin_unlock_irqrestore+0x2c/0x49 [<ffffffff81483640>] store+0x60/0x88 [<ffffffff811708c0>] sysfs_write_file+0xf4/0x130 [<ffffffff8111243b>] vfs_write+0xb5/0x151 [<ffffffff811126e0>] sys_write+0x4a/0x71 [<ffffffff816319a9>] system_call_fastpath+0x16/0x1b Fix this by by always using work_on_cpu(). Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | drivers: cpufreq: Send a uevent when governor changesSteve Kondik2012-10-201-0/+10
| | | | | | | | | | | | * Useful so userspace tools can reconfigure. Change-Id: Ib423910b8b9ac791ebe81a75bf399f58272f64f2
* | Merge "cpufreq: interactive: add boostpulse duration" into jbRafael Salas2012-10-191-3/+25
|\ \
| * | cpufreq: interactive: add boostpulse durationNarayanan Gopalakrishnan2012-10-141-3/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | from http://review.cyanogenmod.com/#/c/24324/ by Daniel Bateman <jetison.24@gmail.com> This makes up for the portions missing that would've been written by Narayanan Gopalakrishnan but they were missing (duration, and boost time) and also adds the ability to set duration (which was originally created by cyanogen) Change-Id: I8aadc9a70501862c78e153608f39c6e02746083b
* | | cpufreq: ondemand: add boostpulse interfaceNarayanan Gopalakrishnan2012-10-161-1/+72
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Squashed commit consisting of the following: -------- For applications that require a one-shot increase in frequency, the boostpulse interface would help to scale to max for the time specified in boostime. This helps applications that currently increases scaling_min_freq and resets later after a fixed duration. Instead of changing scaling_min_freq applications can directly write to boostpulse and governer resets during regular timer after the time expires. Signed-off-by: Narayanan Gopalakrishnan <nargop@codeaurora.org> -------- cpufreq: ondemand: Fix the boostpulse interface * Boostpulse was not working because no default frequency was set. * We don't need an input handler to push the freq to max, userspace does a better job with the Power HAL. * Tweak boost time to 500ms cpufreq: ondemand: Add duration for boosting * Keep default behavior of 500ms boost if "1" is given, otherwise use the value (microseconds) as the boost duration. drivers: cpufreq: Add max duration for boosting * Don't allow boosting for more than 5 seconds. From: Steve Kondik<shade@chemlab.org> -------- cpufreq: ondemand: Default to max From: Daniel Bateman<jetison.24@gmail.com> -------- Change-Id: Ib272703616b9dabc9ab54221f6e2c84c9e9c6dda
* | Merge commit 'b9a7985' into HEADKalimochoAz2012-10-141-29/+34
|\ \ | |/ | | | | | | Conflicts: kernel/time/timekeeping.c
| * cpufreq/powernow-k8: workqueue user shouldn't migrate the kworker to another CPUTejun Heo2012-10-021-29/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit 6889125b8b4e09c5e53e6ecab3433bed1ce198c9 upstream. powernowk8_target() runs off a per-cpu work item and if the cpufreq_policy->cpu is different from the current one, it migrates the kworker to the target CPU by manipulating current->cpus_allowed. The function migrates the kworker back to the original CPU but this is still broken. Workqueue concurrency management requires the kworkers to stay on the same CPU and powernowk8_target() ends up triggerring BUG_ON(rq != this_rq()) in try_to_wake_up_local() if it contends on fidvid_mutex and sleeps. It is unclear why this bug is being reported now. Duncan says it appeared to be a regression of 3.6-rc1 and couldn't reproduce it on 3.5. Bisection seemed to point to 63d95a91 "workqueue: use @pool instead of @gcwq or @cpu where applicable" which is an non-functional change. Given that the reproduce case sometimes took upto days to trigger, it's easy to be misled while bisecting. Maybe something made contention on fidvid_mutex more likely? I don't know. This patch fixes the bug by using work_on_cpu() instead if @pol->cpu isn't the same as the current one. The code assumes that cpufreq_policy->cpu is kept online by the caller, which Rafael tells me is the case. stable: ed48ece27c ("workqueue: reimplement work_on_cpu() using system_wq") should be applied before this; otherwise, the behavior could be horrible. Signed-off-by: Tejun Heo <tj@kernel.org> Reported-by: Duncan <1i5t5.duncan@cox.net> Tested-by: Duncan <1i5t5.duncan@cox.net> Cc: Rafael J. Wysocki <rjw@sisk.pl> Cc: Andreas Herrmann <andreas.herrmann3@amd.com> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=47301 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | cpufreq: interactive: restart above_hispeed_delay at each hispeed loadTodd Poynor2012-05-221-1/+8
| | | | | | | | | | Change-Id: I2e5b91d45e8806b0ab94ca2301ed671c9af9ab13 Signed-off-by: Todd Poynor <toddpoynor@google.com>
* | cpufreq: interactive: add boost pulse interfaceTodd Poynor2012-05-221-5/+27
| | | | | | | | | | Change-Id: Icf1e86d2065cc8f0816ba9c6b065eb056d4e8249 Signed-off-by: Todd Poynor <toddpoynor@google.com>
* | cpufreq: interactive: set floor for boosted speedTodd Poynor2012-05-221-11/+14
| | | | | | | | | | | | | | | | Allow speed to drop to flooor frequency but not below, don't pin to speed at last boost. Change-Id: I0147c2b7a2e61ba16820605af6baaf09570be787 Signed-off-by: Todd Poynor <toddpoynor@google.com>
* | cpufreq: interactive: Add sysfs boost interface for hints from userspaceTodd Poynor2012-05-221-4/+44
| | | | | | | | | | | | | | The explicit hint on/off version. Change-Id: Ibf62b6d45bf6fb8c9c055b9bdaf074ce9374c04f Signed-off-by: Todd Poynor <toddpoynor@google.com>
* | cpufreq: interactive: remove unused target_validate_time_in_idleTodd Poynor2012-05-221-6/+1
| | | | | | | | | | Change-Id: I37c5085b91318242612440dfd775ad762996612f Signed-off-by: Todd Poynor <toddpoynor@google.com>
* | cpufreq: interactive: Boost frequency on touchscreen inputTodd Poynor2012-05-221-1/+163
| | | | | | | | | | | | | | | | | | | | | | Based on previous patches by Tero Kristo <tero.kristo@nokia.com>, Brian Steuer <bsteuer@codeaurora.org>, David Ng <dave@codeaurora.org>, Antti P Miettinen <amiettinen@nvidia.com>, and Thomas Renninger <trenn@suse.de> Change-Id: Ic55fedcf6f9310f43a7022fb88e23b0392122769 Signed-off-by: Todd Poynor <toddpoynor@google.com>
* | cpufreq: Separate speed target revalidate time and initial set timeTodd Poynor2012-05-221-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | Allow speed drop after min_sample_time elapses from last time the current speed was last re-validated as appropriate for current load / input boost. Allow speed bump after min_sample_time (or above_hispeed_delay) elapses from the time the current speed was originally set. Change-Id: Ic25687a7a53d25e6544c30c47d7ab6f27a47bee8 Signed-off-by: Todd Poynor <toddpoynor@google.com>
* | cpufreq: interactive: based hispeed bump on target freq, not actualTodd Poynor2012-05-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | For systems that set a common speed for all CPUs, checking current speed here could bypass the intermediate hispeed bump decision for this CPU when another CPU was already at hispeed. This could result in an overly high setting (for all CPUs) in situations where all CPUs were about to drop to load levels that map to hispeed or below. Change-Id: I186f23dcfc5e2b6336cab8b0327f0c8a9a4482bc Signed-off-by: Todd Poynor <toddpoynor@google.com>
* | cpufreq: interactive: adjust code and documentation to matchTodd Poynor2012-05-221-3/+3
| | | | | | | | | | Change-Id: If59c668d514a29febe5c35404fd9d01df8548eb1 Signed-off-by: Todd Poynor <toddpoynor@google.com>
* | cpufreq: interactive: configurable delay before raising above hispeedTodd Poynor2012-05-221-0/+42
| | | | | | | | | | Change-Id: I4d6ac40b23a3790d48e30c37408284e9f955e8fa Signed-off-by: Todd Poynor <toddpoynor@google.com>
* | cpufreq: interactive: don't drop speed if recently at higher loadTodd Poynor2012-05-221-21/+16
| | | | | | | | | | | | | | | | | | | | | | Apply min_sample_time to the last time the current target speed was originally requested or re-validated as appropriate for the current load, not to the time since the current speed was originally set. Avoids periodic dips in speed during bursty loads. Change-Id: I250bda657985de60373f9897cc41f480664d51a1 Signed-off-by: Todd Poynor <toddpoynor@google.com>
* | cpufreq: interactive: set at least hispeed when above hispeed loadTodd Poynor2012-05-221-2/+6
| | | | | | | | | | | | | | | | | | | | If load is above go_hispeed_load, always go to at least hispeed_freq, even when reducing speed from a higher speed, not just when jumping up from minimum speed. Avoids running at a lower than intended speed after a burst of even higher load. Change-Id: I5b9d2a15ba25ce609b21bac7c724265cf6838dee Signed-off-by: Todd Poynor <toddpoynor@google.com>
* | cpufreq: interactive: apply intermediate load to max speed not currentTodd Poynor2012-05-221-1/+1
| | | | | | | | | | | | | | | | | | | | Evaluate spikes in load (below go_hispeed_load) against the maximum speed supported by the device, not the current speed (which tends to make it too difficult to raise speed to intermediate levels until very busy). Change-Id: Ib937006abf8bedb60891a739acd733e89b732ae0 Signed-off-by: Todd Poynor <toddpoynor@google.com>
* | cpufreq interactive governor: event tracingTodd Poynor2012-05-221-1/+18
| | | | | | | | | | Change-Id: Ic13614a3da2faa2d4bd215ca3eb7191614f0cf66 Signed-off-by: Todd Poynor <toddpoynor@google.com>
* | Merge branch 'linux-3.0.y' into cm.ics.newKalimochoAz2012-02-201-11/+19
|\ \ | |/ | | | | | | Conflicts: mm/compaction.c
| * powernow-k8: Fix indexing issueAndreas Herrmann2012-02-131-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit a8eb28480e9b637cc78b9aa5e08612ba97e1317a upstream. The driver uses the pstate number from the status register as index in its table of ACPI pstates (powernow_table). This is wrong as this is not a 1-to-1 mapping. For example we can have _PSS information to just utilize Pstate 0 and Pstate 4, ie. powernow-k8: Core Performance Boosting: on. powernow-k8: 0 : pstate 0 (2200 MHz) powernow-k8: 1 : pstate 4 (1400 MHz) In this example the driver's powernow_table has just 2 entries. Using the pstate number (4) as index into this table is just plain wrong. Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com> Signed-off-by: Dave Jones <davej@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * powernow-k8: Avoid Pstate MSR accesses on systems supporting CPBAndreas Herrmann2012-02-131-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | commit 201bf0f129e1715a33568d1563d9a75b840ab4d3 upstream. Due to CPB we can't directly map SW Pstates to Pstate MSRs. Get rid of the paranoia check. (assuming that the ACPI Pstate information is correct.) Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com> Signed-off-by: Dave Jones <davej@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | cpufreq: interactive governor: default 20ms timerTodd Poynor2011-11-101-2/+3
| | | | | | | | | | Change-Id: Ie9952f07b38667f2932474090044195c57976faa Signed-off-by: Todd Poynor <toddpoynor@google.com>
* | cpufreq: interactive governor: go to intermediate hi speed before maxTodd Poynor2011-11-101-13/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | * Add attribute hispeed_freq, which defaults to max. * Rename go_maxspeed_load to go_hispeed_load. * If hit go_hispeed_load and at min speed, go to hispeed_freq; if hit go_hispeed_load and already above min speed go to max speed. Change-Id: I1050dec5f013fc1177387352ba787a7e1c68703e Signed-off-by: Todd Poynor <toddpoynor@google.com>
* | cpufreq: interactive governor: scale to max only if at min speedTodd Poynor2011-11-091-3/+7
| | | | | | | | | | Change-Id: Ieffb2aa56b5290036285c948718be7be0d3af9e8 Signed-off-by: Todd Poynor <toddpoynor@google.com>
* | cpufreq: interactive governor: apply intermediate load on current speedTodd Poynor2011-11-091-1/+1
| | | | | | | | | | | | | | | | Calculate intermediate speed by applyng CPU load to current speed, not max speed. Change-Id: Idecf598b9a203b07c989c5d9e9c6efc67a1afc2e Signed-off-by: Todd Poynor <toddpoynor@google.com>
* | Merge commit 'v3.0.8' into android-3.0Colin Cross2011-10-271-0/+3
|\ \ | |/
| * drivers/cpufreq/pcc-cpufreq.c: avoid NULL pointer dereferenceNaga Chumbalkar2011-10-031-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit e71f5cc402ecb42b407ae52add7b173bf1c53daa upstream. per_cpu(processors, n) can be NULL, resulting in: Loading CPUFreq modules[ 437.661360] BUG: unable to handle kernel NULL pointer dereference at (null) IP: [<ffffffffa0434314>] pcc_cpufreq_cpu_init+0x74/0x220 [pcc_cpufreq] It's better to avoid the oops by failing the driver, and allowing the system to boot. Signed-off-by: Naga Chumbalkar <nagananda.chumbalkar@hp.com> Cc: Dave Jones <davej@codemonkey.org.uk> Cc: Len Brown <lenb@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* | power: cpufreq interactive governor: use default sample time 20msTodd Poynor2011-10-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | Lower the default time at which a higher speed is allowed to run before lowering based on lower CPU load from 80ms to 20ms. Most Android devices should trade power for performance here, although tablets and non-battery-powered devices may want to override this default. Change-Id: I1a4f7faeca12793c51d5b92db30a63cca8d4f1be Signed-off-by: Todd Poynor <toddpoynor@google.com>
* | cpufreq: interactive governor: default timer 10ms, maxspeed load 95%Todd Poynor2011-10-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Modify default timer from 30ms to 10ms, sampling 2 jiffies after idle exit on ARM as in Honeycomb. Modify default go_maxspeed_load from 85% loaded to 95% loaded, for use in phones where power savings is more important (tablets may be best served overriding this). Change-Id: I3361a6279979bfae1df5262666a2e30ea7a44328 Signed-off-by: Todd Poynor <toddpoynor@google.com>
* | cpufreq: interactive: fix possible Division by zero.Axel Haslam2011-10-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following dump was seen sometimes while resuming, the only division by zero on this function can happen after delta_time is reassigned, since at the start of the function, there is jump that protects against values less than 1000. After that, If delta_time and delta_idle == 0, we will hit a div 0 Division by zero in kernel. Backtrace: [<c0057184>] (dump_backtrace+0x0/0x110) from [<c05d5ecc>] (dump_stack+0x18/0x1c) r6:010f3000 r5:c113dfb0 r4:c004afb0 r3:c6ff0000 [<c05d5eb4>] (dump_stack+0x0/0x1c) from [<c00572cc>] (__div0+0x1c/0x20) [<c00572b0>] (__div0+0x0/0x20) from [<c02195d4>] (Ldiv0+0x8/0x10) [<c03dfd64>] (cpufreq_interactive_timer+0x0/0x2c0) from [<c00a7efc>] (run_timer_softirq+0x154/0x260) [<c00a7da8>] (run_timer_softirq+0x0/0x260) from [<c00a0c8c>] (__do_softirq+0xc8/0x194) [<c00a0bc4>] (__do_softirq+0x0/0x194) from [<c00a1008>] (irq_exit+0xb4/0xb8) [<c00a0f54>] (irq_exit+0x0/0xb8) from [<c00584b4>] (ipi_timer+0x44/0x48) r4:c004a040 r3:00000001 [<c0058470>] (ipi_timer+0x0/0x48) from [<c004c3e4>] (do_local_timer+0x68/0x84) r5:c004ae2c r4:c07991e8 [<c004c37c>] (do_local_timer+0x0/0x84) from [<c0052948>] (__irq_svc+0x48/0xe0) Change-Id: I639882db67b8d711c5710778ebc212f0f6a998e3 Acked-by: Nishanth Menon <nm@ti.com> Signed-off-by: Axel Haslam <axelhaslam@ti.com>
* | cpufreq: interactive: Fix handling of SMP where CPUs must scale in tandemTodd Poynor2011-09-151-9/+40
| | | | | | | | | | | | | | | | | | | | The interactive governor relies on quirks of the Tegra 2 cpufreq implementation for handling SMP systems where the CPUs do not have separate rate controls. It needs to determine the maximum rate for all CPUs covered by the policy and set that speed. Change-Id: I1ed9fa171e5a9c45a1fa5944e3fa823eb157e81f Signed-off-by: Todd Poynor <toddpoynor@google.com>
* | cpufreq: interactive: fix checkpatch warnings on long linesAllen Martin2011-07-191-3/+6
| | | | | | | | | | | | | | | | Fix up checkpatch warning introduced by long lines in timer_rate patch. Change-Id: I22b105dafb1b49390799bb7577464da03f0f8afb Signed-off-by: Allen Martin <amartin@nvidia.com>
* | cpufreq: interactive: cleanup checkpatch warningsAllen Martin2011-07-151-6/+5
| | | | | | | | | | | | | | Cleanup some style warnings reported by checkpatch Change-Id: Ie2e6903d52867fb3347e009d7efa3bc4ca755cea Signed-off-by: Allen Martin <amartin@nvidia.com>
* | cpufreq: Add more verbose description of interactive governorAllen Martin2011-07-151-0/+11
| | | | | | | | | | | | | | | | Update the Kconfig help paragraph to give more detail about interactive governor. Change-Id: I607b817b370accac3a685001649a15e2f7894f59 Signed-off-by: Allen Martin <amartin@nvidia.com>
* | cpufreq: interactive: add sysfs control for timer rateAllen Martin2011-07-151-3/+33
| | | | | | | | | | | | | | | | Add a new sysfs control that tunes the rate of the timer used to increase cpu frequency Change-Id: I1aa13ae54bb43aff5b3688984d2955f56aae1658 Signed-off-by: Allen Martin <amartin@nvidia.com>
* | cpufreq: interactive: Add error checking on sysfs interfacesAllen Martin2011-07-151-2/+16
| | | | | | | | | | | | | | | | | | This adds better error checking on tunable parameters on sysfs interfaces. Also fixes return value from these functions, previously on success they would return 0 which would cause a infinite loop. Change-Id: Ic05038492166f8673d007202092471f98a2f0dfa Signed-off-by: Allen Martin <amartin@nvidia.com>
* | cpufreq: interactive: use idle notifierAllen Martin2011-07-151-7/+30
| | | | | | | | | | | | | | | | Convert interactive governor to use idle notifier instead of hooking pm_idle directly. Change-Id: I47e007f330468ac559240a0ae8a3cb06a89ccb67 Signed-off-by: Allen Martin <amartin@nvidia.com>
* | cpufreq: interactive: remove debug trace codeAllen Martin2011-07-151-158/+6
| | | | | | | | | | | | | | Remove debug trace code in preparation of upstreaming Change-Id: I0905885e75031f5e9d7cb06878fb68c1fd06d4fe Signed-off-by: Allen Martin <amartin@nvidia.com>
* | Merge commit 'v3.0-rc7' into android-3.0Colin Cross2011-07-121-1/+1
|\ \ | |/
| * [CPUFREQ] fix cpumask memory leak in acpi-cpufreq on cpu hotplug.Luming Yu2011-07-101-1/+1
| | | | | | | | | | | | | | | | | | I came across a memory leak during a cyclic cpu-online-offline test. Signed-off-by: Yu Luming <luming.yu@intel.com> Cc: Len Brown <lenb@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Dave Jones <davej@redhat.com>
* | Merge commit 'v3.0-rc5' into android-3.0Colin Cross2011-06-292-4/+11
|\ \ | |/
| * [CPUFREQ] powernow-k8: Don't try to transition if the pstate is incorrectKonrad Rzeszutek Wilk2011-06-161-1/+2
| | | | | | | | | | | | | | | | | | | | | | This patch augments the pstate transition code to error out (instead of returning 0) when an incorrect pstate is provided. Suggested-by: Borislav Petkov <bp@alien8.de> CC: andre.przywara@amd.com CC: Mark.Langsdorf@amd.com Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Dave Jones <davej@redhat.com>
| * [CPUFREQ] powernow-k8: Don't notify of successful transition if we failed ↵Konrad Rzeszutek Wilk2011-06-161-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (vid case). Before this patch if we failed the vid transition would still try to submit the "new" frequencies to cpufreq. That is incorrect - also we could submit a non-existing frequency value which would cause cpufreq to crash. The ultimate fix is in cpufreq to deal with incorrect values, but this patch improves the error recovery in the AMD powernowk8 driver. The failure that was reported was as follows: powernow-k8: Found 1 AMD Athlon(tm) 64 Processor 3700+ (1 cpu cores) (version 2.20.00) powernow-k8: fid 0x2 (1000 MHz), vid 0x12 powernow-k8: fid 0xa (1800 MHz), vid 0xa powernow-k8: fid 0xc (2000 MHz), vid 0x8 powernow-k8: fid 0xe (2200 MHz), vid 0x8 Marking TSC unstable due to cpufreq changes powernow-k8: fid trans failed, fid 0x2, curr 0x0 BUG: unable to handle kernel paging request at ffff880807e07b78 IP: [<ffffffff81479163>] cpufreq_stats_update+0x46/0x5b ... And transition fails and data->currfid ends up with 0. Since the machine does not support 800Mhz value when the calculation is done ('find_khz_freq_from_fid(data->currfid);') it reports the new frequency as 800000 which is bogus. This patch fixes the issue during target setting. The patch however does not fix the issue in 'powernowk8_cpu_init' where the pol->cur can also be set with the 800000 value: pol->cur = find_khz_freq_from_fid(data->currfid); dprintk("policy current frequency %d kHz\n", pol->cur); /* min/max the cpu is capable of */ if (cpufreq_frequency_table_cpuinfo(pol, data->powernow_table)) { The fix for that looks to update cpufreq_frequency_table_cpuinfo to check pol->cur.... but that would cause an regression in how the acpi-cpufreq driver works (it sets cpu->cur after calling cpufreq_frequency_table_cpuinfo). Instead the fix will be to let cpufreq gracefully handle bogus data (another patch). Acked-by: Borislav Petkov <bp@alien8.de> CC: andre.przywara@amd.com CC: Mark.Langsdorf@amd.com Reported-by: Tobias Diedrich <ranma+xen@tdiedrich.de> Tested-by: Tobias Diedrich <ranma+xen@tdiedrich.de> [v1: Rebased on v3.0-rc2, reduced patch to deal with vid case] Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Dave Jones <davej@redhat.com>
| * [CPUFREQ] Don't set stat->last_index to -1 if the pol->cur has incorrect value.Konrad Rzeszutek Wilk2011-06-161-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the driver submitted an non-existing pol>cur value (say it used the default initialized value of zero), when the cpufreq stats tries to setup its initial values it incorrectly sets stat->last_index to -1 (or 0xfffff...). And cpufreq_stats_update tries to update at that index location and fails. This can be caused by: stat->last_index = freq_table_get_index(stat, policy->cur); not finding the appropiate frequency in the table (b/c the policy->cur is wrong) and we end up crashing. The fix however is concentrated in the 'cpufreq_stats_update' as the last_index (and old_index) are updated there. Which means it can reset the last_index to -1 again and on the next iteration cause a crash. Without this patch, the following crash is observed: powernow-k8: Found 1 AMD Athlon(tm) 64 Processor 3700+ (1 cpu cores) (version 2.20.00) powernow-k8: fid 0x2 (1000 MHz), vid 0x12 powernow-k8: fid 0xa (1800 MHz), vid 0xa powernow-k8: fid 0xc (2000 MHz), vid 0x8 powernow-k8: fid 0xe (2200 MHz), vid 0x8 Marking TSC unstable due to cpufreq changes powernow-k8: fid trans failed, fid 0x2, curr 0x0 BUG: unable to handle kernel paging request at ffff880807e07b78 IP: [<ffffffff81479163>] cpufreq_stats_update+0x46/0x5b .. snip.. Pid: 1, comm: swapper Not tainted 3.0.0-rc2 #45 MICRO-STAR INTERNATIONAL CO., LTD MS-7094/MS-7094 ..snip.. Call Trace: [<ffffffff81479248>] cpufreq_stat_notifier_trans+0x48/0x7c [<ffffffff81095d68>] notifier_call_chain+0x32/0x5e [<ffffffff81095e6b>] __srcu_notifier_call_chain+0x47/0x63 [<ffffffff81095e96>] srcu_notifier_call_chain+0xf/0x11 [<ffffffff81477e7a>] cpufreq_notify_transition+0x111/0x134 [<ffffffff8147b0d4>] powernowk8_target+0x53b/0x617 [<ffffffff8147723a>] __cpufreq_driver_target+0x2e/0x30 [<ffffffff8147a127>] cpufreq_governor_dbs+0x339/0x356 [<ffffffff81477394>] __cpufreq_governor+0xa8/0xe9 [<ffffffff81477525>] __cpufreq_set_policy+0x132/0x13e [<ffffffff8147848d>] cpufreq_add_dev_interface+0x272/0x28c Reported-by: Tobias Diedrich <ranma+xen@tdiedrich.de> Tested-by: Tobias Diedrich <ranma+xen@tdiedrich.de> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Signed-off-by: Dave Jones <davej@redhat.com>
| * [CPUFREQ] Remove cpufreq_stats sysfs entries on module unload.Dave Jones2011-06-121-0/+1
| | | | | | | | | | | | | | | | | | cpufreq_stats leaves behind its sysfs entries, which causes a panic when something stumbled across them. (Discovered by unloading cpufreq_stats while powertop was loaded). Signed-off-by: Dave Jones <davej@redhat.com> Cc: stable@kernel.org
* | cpufreq interactive: support shared CPU scalingTodd Poynor2011-06-161-28/+40
| | | | | | | | | | Change-Id: Id5267f04067bf023f6b140b4de2e88ef7287e941 Signed-off-by: Todd Poynor <toddpoynor@google.com>