From: Peter Zijlstra <peterz@infradead.org>
To: lenb@kernel.org, rjw@rjwysocki.net, linux-acpi@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: shaohua.li@intel.com
Subject: acpi_pad mwait usage
Date: Tue, 19 Nov 2013 10:00:19 +0100 [thread overview]
Message-ID: <20131119090019.GJ3866@twins.programming.kicks-ass.net> (raw)
Hi Len, Rafeal,
I stumbled over acpi_pad (yuck! ;-), but noticed that you don't set the
task in polling mode while using mwait. This means we'll still happily
send an IPI to wake you up.
A little something like the below should do; you might even be able to
remove the smp_mb() but since it is completely undocumented (another
fail) I couldn't tell if the implied barrier in
current_set_polling_and_test() suffices to replace it, so I left it.
If it compiles and works; change it to a proper SOB:
Maybe-Signed-off-by: Peter Zijlstra <peterz@infradead.org>
---
drivers/acpi/acpi_pad.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c
index fc6008fbce35..e9126efe7786 100644
--- a/drivers/acpi/acpi_pad.c
+++ b/drivers/acpi/acpi_pad.c
@@ -195,8 +195,10 @@ static int power_saving_thread(void *data)
__monitor((void *)¤t_thread_info()->flags, 0, 0);
smp_mb();
- if (!need_resched())
+ if (!current_set_polling_and_test()) {
__mwait(power_saving_mwait_eax, 1);
+ __current_clr_polling();
+ }
start_critical_timings();
if (lapic_marked_unstable)
next reply other threads:[~2013-11-19 9:00 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-19 9:00 Peter Zijlstra [this message]
2013-11-19 9:08 ` acpi_pad mwait usage Peter Zijlstra
2013-11-19 11:31 ` [PATCH] x86, acpi, idle: Restructure the mwait idle routines Peter Zijlstra
2013-11-19 13:06 ` Rafael J. Wysocki
2013-11-19 13:21 ` Mike Galbraith
2013-11-19 14:22 ` Arjan van de Ven
2013-11-19 14:46 ` Peter Zijlstra
2013-11-19 14:51 ` Peter Zijlstra
2013-11-19 15:13 ` Peter Zijlstra
2013-11-19 21:06 ` Jacob Pan
2013-11-20 10:28 ` Peter Zijlstra
2013-11-20 10:58 ` Peter Zijlstra
2013-11-20 16:24 ` Arjan van de Ven
2013-11-20 16:33 ` Peter Zijlstra
2013-11-20 16:38 ` Arjan van de Ven
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=20131119090019.GJ3866@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=shaohua.li@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;
as well as URLs for NNTP newsgroup(s).