Commit 7ac3ae32d170cea8cb8e7822acc29ed8f1b1018d
Pull thermal into release branch
Showing 1 changed file Side-by-side Diff
drivers/acpi/processor_throttling.c
... | ... | @@ -29,6 +29,7 @@ |
29 | 29 | #include <linux/kernel.h> |
30 | 30 | #include <linux/module.h> |
31 | 31 | #include <linux/init.h> |
32 | +#include <linux/sched.h> | |
32 | 33 | #include <linux/cpufreq.h> |
33 | 34 | #include <linux/proc_fs.h> |
34 | 35 | #include <linux/seq_file.h> |
... | ... | @@ -413,7 +414,7 @@ |
413 | 414 | } else { |
414 | 415 | msr_low = 0; |
415 | 416 | msr_high = 0; |
416 | - rdmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL, | |
417 | + rdmsr_safe(MSR_IA32_THERM_CONTROL, | |
417 | 418 | (u32 *)&msr_low , (u32 *) &msr_high); |
418 | 419 | msr = (msr_high << 32) | msr_low; |
419 | 420 | *value = (acpi_integer) msr; |
... | ... | @@ -438,7 +439,7 @@ |
438 | 439 | "HARDWARE addr space,NOT supported yet\n"); |
439 | 440 | } else { |
440 | 441 | msr = value; |
441 | - wrmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL, | |
442 | + wrmsr_safe(MSR_IA32_THERM_CONTROL, | |
442 | 443 | msr & 0xffffffff, msr >> 32); |
443 | 444 | ret = 0; |
444 | 445 | } |
445 | 446 | |
446 | 447 | |
... | ... | @@ -572,21 +573,32 @@ |
572 | 573 | return -ENODEV; |
573 | 574 | |
574 | 575 | pr->throttling.state = 0; |
575 | - local_irq_disable(); | |
576 | + | |
576 | 577 | value = 0; |
577 | 578 | ret = acpi_read_throttling_status(pr, &value); |
578 | 579 | if (ret >= 0) { |
579 | 580 | state = acpi_get_throttling_state(pr, value); |
580 | 581 | pr->throttling.state = state; |
581 | 582 | } |
582 | - local_irq_enable(); | |
583 | 583 | |
584 | 584 | return 0; |
585 | 585 | } |
586 | 586 | |
587 | 587 | static int acpi_processor_get_throttling(struct acpi_processor *pr) |
588 | 588 | { |
589 | - return pr->throttling.acpi_processor_get_throttling(pr); | |
589 | + cpumask_t saved_mask; | |
590 | + int ret; | |
591 | + | |
592 | + /* | |
593 | + * Migrate task to the cpu pointed by pr. | |
594 | + */ | |
595 | + saved_mask = current->cpus_allowed; | |
596 | + set_cpus_allowed(current, cpumask_of_cpu(pr->id)); | |
597 | + ret = pr->throttling.acpi_processor_get_throttling(pr); | |
598 | + /* restore the previous state */ | |
599 | + set_cpus_allowed(current, saved_mask); | |
600 | + | |
601 | + return ret; | |
590 | 602 | } |
591 | 603 | |
592 | 604 | static int acpi_processor_get_fadt_info(struct acpi_processor *pr) |
593 | 605 | |
594 | 606 | |
... | ... | @@ -717,21 +729,29 @@ |
717 | 729 | if (state < pr->throttling_platform_limit) |
718 | 730 | return -EPERM; |
719 | 731 | |
720 | - local_irq_disable(); | |
721 | 732 | value = 0; |
722 | 733 | ret = acpi_get_throttling_value(pr, state, &value); |
723 | 734 | if (ret >= 0) { |
724 | 735 | acpi_write_throttling_state(pr, value); |
725 | 736 | pr->throttling.state = state; |
726 | 737 | } |
727 | - local_irq_enable(); | |
728 | 738 | |
729 | 739 | return 0; |
730 | 740 | } |
731 | 741 | |
732 | 742 | int acpi_processor_set_throttling(struct acpi_processor *pr, int state) |
733 | 743 | { |
734 | - return pr->throttling.acpi_processor_set_throttling(pr, state); | |
744 | + cpumask_t saved_mask; | |
745 | + int ret; | |
746 | + /* | |
747 | + * Migrate task to the cpu pointed by pr. | |
748 | + */ | |
749 | + saved_mask = current->cpus_allowed; | |
750 | + set_cpus_allowed(current, cpumask_of_cpu(pr->id)); | |
751 | + ret = pr->throttling.acpi_processor_set_throttling(pr, state); | |
752 | + /* restore the previous state */ | |
753 | + set_cpus_allowed(current, saved_mask); | |
754 | + return ret; | |
735 | 755 | } |
736 | 756 | |
737 | 757 | int acpi_processor_get_throttling_info(struct acpi_processor *pr) |