* [patch 2/3] intel_idle: disable auto_demotion for hotplugged CPUs
@ 2012-01-10 23:48 akpm
2012-01-17 10:56 ` Thomas Renninger
0 siblings, 1 reply; 3+ messages in thread
From: akpm @ 2012-01-10 23:48 UTC (permalink / raw)
To: lenb; +Cc: len.brown, linux-acpi, akpm, shaohua.li
From: Shaohua Li <shaohua.li@intel.com>
Subject: intel_idle: disable auto_demotion for hotplugged CPUs
auto_demotion_disable is called only for online CPUs. For hotplugged
CPUs, we should disable it too.
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Cc: Len Brown <lenb@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
drivers/idle/intel_idle.c | 53 ++++++++++++++++++++++--------------
1 file changed, 33 insertions(+), 20 deletions(-)
diff -puN drivers/idle/intel_idle.c~intel_idle-disable-auto_demotion-for-hotplugged-cpus drivers/idle/intel_idle.c
--- a/drivers/idle/intel_idle.c~intel_idle-disable-auto_demotion-for-hotplugged-cpus
+++ a/drivers/idle/intel_idle.c
@@ -297,33 +297,42 @@ static void __setup_broadcast_timer(void
clockevents_notify(reason, &cpu);
}
-static int setup_broadcast_cpuhp_notify(struct notifier_block *n,
+static void auto_demotion_disable(void *dummy)
+{
+ unsigned long long msr_bits;
+
+ rdmsrl(MSR_NHM_SNB_PKG_CST_CFG_CTL, msr_bits);
+ msr_bits &= ~auto_demotion_disable_flags;
+ wrmsrl(MSR_NHM_SNB_PKG_CST_CFG_CTL, msr_bits);
+}
+
+static void __intel_idle_notify_handler(void *arg)
+{
+ if (auto_demotion_disable_flags)
+ auto_demotion_disable(NULL);
+
+ if (lapic_timer_reliable_states != LAPIC_TIMER_ALWAYS_RELIABLE)
+ __setup_broadcast_timer((void *)true);
+}
+
+static int setup_intelidle_cpuhp_notify(struct notifier_block *n,
unsigned long action, void *hcpu)
{
int hotcpu = (unsigned long)hcpu;
switch (action & 0xf) {
case CPU_ONLINE:
- smp_call_function_single(hotcpu, __setup_broadcast_timer,
- (void *)true, 1);
+ smp_call_function_single(hotcpu, __intel_idle_notify_handler,
+ NULL, 1);
break;
}
return NOTIFY_OK;
}
-static struct notifier_block setup_broadcast_notifier = {
- .notifier_call = setup_broadcast_cpuhp_notify,
+static struct notifier_block setup_intelidle_notifier = {
+ .notifier_call = setup_intelidle_cpuhp_notify,
};
-static void auto_demotion_disable(void *dummy)
-{
- unsigned long long msr_bits;
-
- rdmsrl(MSR_NHM_SNB_PKG_CST_CFG_CTL, msr_bits);
- msr_bits &= ~auto_demotion_disable_flags;
- wrmsrl(MSR_NHM_SNB_PKG_CST_CFG_CTL, msr_bits);
-}
-
/*
* intel_idle_probe()
*/
@@ -393,10 +402,8 @@ static int intel_idle_probe(void)
if (boot_cpu_has(X86_FEATURE_ARAT)) /* Always Reliable APIC Timer */
lapic_timer_reliable_states = LAPIC_TIMER_ALWAYS_RELIABLE;
- else {
+ else
on_each_cpu(__setup_broadcast_timer, (void *)true, 1);
- register_cpu_notifier(&setup_broadcast_notifier);
- }
pr_debug(PREFIX "v" INTEL_IDLE_VERSION
" model 0x%X\n", boot_cpu_data.x86_model);
@@ -559,6 +566,10 @@ static int __init intel_idle_init(void)
return retval;
}
+ if (auto_demotion_disable_flags || lapic_timer_reliable_states !=
+ LAPIC_TIMER_ALWAYS_RELIABLE)
+ register_cpu_notifier(&setup_intelidle_notifier);
+
return 0;
}
@@ -567,10 +578,12 @@ static void __exit intel_idle_exit(void)
intel_idle_cpuidle_devices_uninit();
cpuidle_unregister_driver(&intel_idle_driver);
- if (lapic_timer_reliable_states != LAPIC_TIMER_ALWAYS_RELIABLE) {
+ if (lapic_timer_reliable_states != LAPIC_TIMER_ALWAYS_RELIABLE)
on_each_cpu(__setup_broadcast_timer, (void *)false, 1);
- unregister_cpu_notifier(&setup_broadcast_notifier);
- }
+
+ if (auto_demotion_disable_flags || lapic_timer_reliable_states !=
+ LAPIC_TIMER_ALWAYS_RELIABLE)
+ unregister_cpu_notifier(&setup_intelidle_notifier);
return;
}
_
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [patch 2/3] intel_idle: disable auto_demotion for hotplugged CPUs
2012-01-10 23:48 [patch 2/3] intel_idle: disable auto_demotion for hotplugged CPUs akpm
@ 2012-01-17 10:56 ` Thomas Renninger
2012-01-17 19:22 ` Len Brown
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Renninger @ 2012-01-17 10:56 UTC (permalink / raw)
To: akpm; +Cc: lenb, len.brown, linux-acpi, shaohua.li
On Wednesday, January 11, 2012 12:48:20 AM akpm@linux-foundation.org wrote:
> From: Shaohua Li <shaohua.li@intel.com>
> Subject: intel_idle: disable auto_demotion for hotplugged CPUs
This one should not be necessary anymore with my intel_idle
patch series I have to rebase and resend (will do that after lunch).
It provides a per cpu intel_idle init function which is called
from processor.ko in physical cpu hotplug case.
>From what I can see this patch does not change anything/much, because:
- CPUs onlined at bootup are initialized correctly already
- Soft offlining/onlining shouldn't matter in auto_demotion_disable
case as it's a HW MSR write and the CPU should still be in the
same state after off- and onlined again.
- Physically hotplugged/added CPUs are not registered with cpuidle
at all (this is what my patch series fixes), because intel_idle
does not offer any per cpu init() entry function.
With this patch they might be set into auto_demotion_disable now,
but no idle driver gets active for them.
I'll pick up patch 1/3 and 3/3, base my patches on top and resend
everything, that should be easiest for everybody?
Thomas
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [patch 2/3] intel_idle: disable auto_demotion for hotplugged CPUs
2012-01-17 10:56 ` Thomas Renninger
@ 2012-01-17 19:22 ` Len Brown
0 siblings, 0 replies; 3+ messages in thread
From: Len Brown @ 2012-01-17 19:22 UTC (permalink / raw)
To: akpm; +Cc: Thomas Renninger, linux-acpi, shaohua.li
Andrew,
Per reasoning from Thomas below, please drop this one.
thanks,
-Len
On 01/17/2012 05:56 AM, Thomas Renninger wrote:
> On Wednesday, January 11, 2012 12:48:20 AM akpm@linux-foundation.org wrote:
>> From: Shaohua Li <shaohua.li@intel.com>
>> Subject: intel_idle: disable auto_demotion for hotplugged CPUs
>
> This one should not be necessary anymore with my intel_idle
> patch series I have to rebase and resend (will do that after lunch).
>
> It provides a per cpu intel_idle init function which is called
> from processor.ko in physical cpu hotplug case.
>
> From what I can see this patch does not change anything/much, because:
> - CPUs onlined at bootup are initialized correctly already
> - Soft offlining/onlining shouldn't matter in auto_demotion_disable
> case as it's a HW MSR write and the CPU should still be in the
> same state after off- and onlined again.
> - Physically hotplugged/added CPUs are not registered with cpuidle
> at all (this is what my patch series fixes), because intel_idle
> does not offer any per cpu init() entry function.
> With this patch they might be set into auto_demotion_disable now,
> but no idle driver gets active for them.
>
> I'll pick up patch 1/3 and 3/3, base my patches on top and resend
> everything, that should be easiest for everybody?
>
> Thomas
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-01-17 19:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-10 23:48 [patch 2/3] intel_idle: disable auto_demotion for hotplugged CPUs akpm
2012-01-17 10:56 ` Thomas Renninger
2012-01-17 19:22 ` Len Brown
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).