.. | .. |
---|
57 | 57 | |
---|
58 | 58 | static unsigned int target_mwait; |
---|
59 | 59 | static struct dentry *debug_dir; |
---|
| 60 | +static bool poll_pkg_cstate_enable; |
---|
60 | 61 | |
---|
61 | 62 | /* user selected target */ |
---|
62 | 63 | static unsigned int set_target_ratio; |
---|
.. | .. |
---|
261 | 262 | static unsigned int get_compensation(int ratio) |
---|
262 | 263 | { |
---|
263 | 264 | unsigned int comp = 0; |
---|
| 265 | + |
---|
| 266 | + if (!poll_pkg_cstate_enable) |
---|
| 267 | + return 0; |
---|
264 | 268 | |
---|
265 | 269 | /* we only use compensation if all adjacent ones are good */ |
---|
266 | 270 | if (ratio == 1 && |
---|
.. | .. |
---|
534 | 538 | control_cpu = cpumask_first(cpu_online_mask); |
---|
535 | 539 | |
---|
536 | 540 | clamping = true; |
---|
537 | | - schedule_delayed_work(&poll_pkg_cstate_work, 0); |
---|
| 541 | + if (poll_pkg_cstate_enable) |
---|
| 542 | + schedule_delayed_work(&poll_pkg_cstate_work, 0); |
---|
538 | 543 | |
---|
539 | 544 | /* start one kthread worker per online cpu */ |
---|
540 | 545 | for_each_online_cpu(cpu) { |
---|
.. | .. |
---|
603 | 608 | static int powerclamp_get_cur_state(struct thermal_cooling_device *cdev, |
---|
604 | 609 | unsigned long *state) |
---|
605 | 610 | { |
---|
606 | | - if (true == clamping) |
---|
607 | | - *state = pkg_cstate_ratio_cur; |
---|
608 | | - else |
---|
| 611 | + if (clamping) { |
---|
| 612 | + if (poll_pkg_cstate_enable) |
---|
| 613 | + *state = pkg_cstate_ratio_cur; |
---|
| 614 | + else |
---|
| 615 | + *state = set_target_ratio; |
---|
| 616 | + } else { |
---|
609 | 617 | /* to save power, do not poll idle ratio while not clamping */ |
---|
610 | 618 | *state = -1; /* indicates invalid state */ |
---|
| 619 | + } |
---|
611 | 620 | |
---|
612 | 621 | return 0; |
---|
613 | 622 | } |
---|
.. | .. |
---|
732 | 741 | goto exit_unregister; |
---|
733 | 742 | } |
---|
734 | 743 | |
---|
| 744 | + if (topology_max_packages() == 1 && topology_max_die_per_package() == 1) |
---|
| 745 | + poll_pkg_cstate_enable = true; |
---|
| 746 | + |
---|
735 | 747 | cooling_dev = thermal_cooling_device_register("intel_powerclamp", NULL, |
---|
736 | 748 | &powerclamp_cooling_ops); |
---|
737 | 749 | if (IS_ERR(cooling_dev)) { |
---|