From: Len Brown <lenb@kernel.org>
To: linux-acpi@vger.kernel.org
Cc: Zhao Yakui <yakui.zhao@intel.com>, Len Brown <len.brown@intel.com>
Subject: [PATCH 1/2] ACPI: Delete the IRQ operation in throttling controll via PTC
Date: Sun, 2 Dec 2007 14:48:44 -0500 [thread overview]
Message-ID: <1196624925-17220-2-git-send-email-lenb@kernel.org> (raw)
Message-ID: <357dc4c3f13cb5c1e3b40a09cbe6ff1b0df2c7c3.1196624815.git.len.brown@intel.com> (raw)
In-Reply-To: <1196624925-17220-1-git-send-email-lenb@kernel.org>
From: Zhao Yakui <yakui.zhao@intel.com>
The IRQ operation(enable/disable) should be avoided when throttling is
controlled via PTC method. It is replaced by the migration of task.
This fixes an oops on T61 -- a regression due to
f79f06ab9f86 b/c FixedHW support tried to read remote MSR with interrupts disabled.
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
---
drivers/acpi/processor_throttling.c | 36 +++++++++++++++++++++++++++-------
1 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c
index c26c61f..6742d7b 100644
--- a/drivers/acpi/processor_throttling.c
+++ b/drivers/acpi/processor_throttling.c
@@ -29,6 +29,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
+#include <linux/sched.h>
#include <linux/cpufreq.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
@@ -413,7 +414,7 @@ static int acpi_throttling_rdmsr(struct acpi_processor *pr,
} else {
msr_low = 0;
msr_high = 0;
- rdmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL,
+ rdmsr_safe(MSR_IA32_THERM_CONTROL,
(u32 *)&msr_low , (u32 *) &msr_high);
msr = (msr_high << 32) | msr_low;
*value = (acpi_integer) msr;
@@ -438,7 +439,7 @@ static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value)
"HARDWARE addr space,NOT supported yet\n");
} else {
msr = value;
- wrmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL,
+ wrmsr_safe(MSR_IA32_THERM_CONTROL,
msr & 0xffffffff, msr >> 32);
ret = 0;
}
@@ -572,21 +573,32 @@ static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr)
return -ENODEV;
pr->throttling.state = 0;
- local_irq_disable();
+
value = 0;
ret = acpi_read_throttling_status(pr, &value);
if (ret >= 0) {
state = acpi_get_throttling_state(pr, value);
pr->throttling.state = state;
}
- local_irq_enable();
return 0;
}
static int acpi_processor_get_throttling(struct acpi_processor *pr)
{
- return pr->throttling.acpi_processor_get_throttling(pr);
+ cpumask_t saved_mask;
+ int ret;
+
+ /*
+ * Migrate task to the cpu pointed by pr.
+ */
+ saved_mask = current->cpus_allowed;
+ set_cpus_allowed(current, cpumask_of_cpu(pr->id));
+ ret = pr->throttling.acpi_processor_get_throttling(pr);
+ /* restore the previous state */
+ set_cpus_allowed(current, saved_mask);
+
+ return ret;
}
static int acpi_processor_get_fadt_info(struct acpi_processor *pr)
@@ -717,21 +729,29 @@ static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr,
if (state < pr->throttling_platform_limit)
return -EPERM;
- local_irq_disable();
value = 0;
ret = acpi_get_throttling_value(pr, state, &value);
if (ret >= 0) {
acpi_write_throttling_state(pr, value);
pr->throttling.state = state;
}
- local_irq_enable();
return 0;
}
int acpi_processor_set_throttling(struct acpi_processor *pr, int state)
{
- return pr->throttling.acpi_processor_set_throttling(pr, state);
+ cpumask_t saved_mask;
+ int ret;
+ /*
+ * Migrate task to the cpu pointed by pr.
+ */
+ saved_mask = current->cpus_allowed;
+ set_cpus_allowed(current, cpumask_of_cpu(pr->id));
+ ret = pr->throttling.acpi_processor_set_throttling(pr, state);
+ /* restore the previous state */
+ set_cpus_allowed(current, saved_mask);
+ return ret;
}
int acpi_processor_get_throttling_info(struct acpi_processor *pr)
--
1.5.3.7.949.g2221a6
next prev parent reply other threads:[~2007-12-02 19:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-02 19:48 ACPI patches for rc3 - part 2 Len Brown
[not found] ` <357dc4c3f13cb5c1e3b40a09cbe6ff1b0df2c7c3.1196624815.git.len.brown@intel.com>
2007-12-02 19:48 ` Len Brown [this message]
[not found] ` <152c300d007c70c4a1847dad39ecdaba22e7d457.1196624815.git.len.brown@intel.com>
2007-12-02 19:48 ` [PATCH 2/2] ACPICA: fix acpi-cpufreq boot crash due to _PSD return-by-reference Len Brown
2007-12-03 16:55 ` ACPI patches for rc3 - part 2 Rafael J. Wysocki
2007-12-03 17:01 ` [PATCH 1/2] HWMON: coretemp, suspend fix Rafael J. Wysocki
2007-12-04 6:29 ` Len Brown
2007-12-04 19:59 ` Rafael J. Wysocki
2007-12-03 17:03 ` [PATCH 2/2] Freezer: Fix JFFS2 garbage collector freezing issue Rafael J. Wysocki
2007-12-03 23:59 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1196624925-17220-2-git-send-email-lenb@kernel.org \
--to=lenb@kernel.org \
--cc=len.brown@intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=yakui.zhao@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox