From: Daniel Lezcano <daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
To: Thomas Renninger <trenn-l3A5Bk7waGM@public.gmane.org>
Cc: deepthi-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org,
linaro-dev-cunTk1MwBs8s++Sfvej+rw@public.gmane.org,
linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
rjw-KKrjLPT3xs0@public.gmane.org,
linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
srivatsa.bhat-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org,
linux-pm-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
lenb-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Subject: Re: [PATCH] acpi: intel_idle : break dependency between modules
Date: Thu, 28 Jun 2012 10:03:56 +0200 [thread overview]
Message-ID: <4FEC0FEC.5070304@linaro.org> (raw)
In-Reply-To: <201206271506.29034.trenn-l3A5Bk7waGM@public.gmane.org>
On 06/27/2012 03:06 PM, Thomas Renninger wrote:
> Hi,
>
> I agree that such a dependency between 2 modules is not
> nice. But your patch will have bad side-effects (see comments
> embedded below).
>
> On Wednesday, June 27, 2012 11:07:48 AM Daniel Lezcano wrote:
>> When the system is booted with some cpus offline, the idle
>> driver is not initialized. When a cpu is set online, the
>> acpi code call the intel idle init function. Unfortunately
>> this code introduce a dependency between intel_idle and acpi.
>>
>> This patch is intended to remove this dependency by using the
>> notifier of intel_idle. In order to make it work, the notifier
>> must be initialized in the right order, acpi then intel_idle.
>> This is done in the Makefile. This patch has the benefit of
>> encapsulating the intel_idle driver and remove some exported
>> functions.
>>
>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
>> ---
>> drivers/Makefile | 3 ++-
>> drivers/acpi/processor_driver.c | 7 -------
>> drivers/idle/intel_idle.c | 22 ++++++++++++++--------
>> include/linux/cpuidle.h | 7 -------
>> 4 files changed, 16 insertions(+), 23 deletions(-)
>>
>> diff --git a/drivers/Makefile b/drivers/Makefile
>> index 2ba29ff..a2454b8 100644
>> --- a/drivers/Makefile
>> +++ b/drivers/Makefile
>> @@ -12,8 +12,9 @@ obj-$(CONFIG_PCI) += pci/
>> obj-$(CONFIG_PARISC) += parisc/
>> obj-$(CONFIG_RAPIDIO) += rapidio/
>> obj-y += video/
>> -obj-y += idle/
>> +# acpi must come before idle for initialization
>> obj-$(CONFIG_ACPI) += acpi/
>> +obj-y += idle/
> This breaks intel_idle.
> Loading order defines which one comes first and is used: intel_idle
> or ACPI processor cpuidle driver.
> With above, one would get acpi_idle cpuidle driver if both are
> compiled in, instead of the intel_idle one.
>
> Why exactly is this necessary, couldn't it just work?
[...]
I just wanted to keep same order. If it is not necessary, I won't invert
the compilation order in the next patch.
>> -static int setup_broadcast_cpuhp_notify(struct notifier_block *n,
>> - unsigned long action, void *hcpu)
>> +static int cpu_hotplug_notify(struct notifier_block *n,
>> + unsigned long action, void *hcpu)
>> {
>> int hotcpu = (unsigned long)hcpu;
>> + struct cpuidle_device *dev;
>>
>> switch (action & 0xf) {
>> case CPU_ONLINE:
>> smp_call_function_single(hotcpu, __setup_broadcast_timer,
>> (void *)true, 1);
>> +
>> + dev = per_cpu_ptr(intel_idle_cpuidle_devices, hotcpu);
>> + if (!dev->registered)
>> + intel_idle_cpu_init(hotcpu);
>> +
> A small comment why this can happen and needs to be done
> (real hotplugged cpu case) might help here later.
Yes, that makes sense.
[...]
>> static void auto_demotion_disable(void *dummy)
>> @@ -407,7 +414,7 @@ static int intel_idle_probe(void)
>> lapic_timer_reliable_states = LAPIC_TIMER_ALWAYS_RELIABLE;
>> else {
>> on_each_cpu(__setup_broadcast_timer, (void *)true, 1);
>> - register_cpu_notifier(&setup_broadcast_notifier);
>> + register_cpu_notifier(&cpu_hotplug_notifier);
>
> The notifier always has to be registered now, not only in:
> if (boot_cpu_has(X86_FEATURE_ARAT)) /* Always Reliable APIC Timer */
> case.
Oops, right.
>> pr_debug(PREFIX "v" INTEL_IDLE_VERSION
>> @@ -494,7 +501,7 @@ static int intel_idle_cpuidle_driver_init(void)
>> * allocate, initialize, register cpuidle_devices
>> * @cpu: cpu/core to initialize
>> */
>> -int intel_idle_cpu_init(int cpu)
>> +static int intel_idle_cpu_init(int cpu)
>> {
>> int cstate;
>> struct cpuidle_device *dev;
>> @@ -539,7 +546,6 @@ int intel_idle_cpu_init(int cpu)
>>
>> return 0;
>> }
>> -EXPORT_SYMBOL_GPL(intel_idle_cpu_init);
>>
>> static int __init intel_idle_init(void)
>> {
>> @@ -583,7 +589,7 @@ static void __exit intel_idle_exit(void)
>>
>> if (lapic_timer_reliable_states != LAPIC_TIMER_ALWAYS_RELIABLE) {
>> on_each_cpu(__setup_broadcast_timer, (void *)false, 1);
>> - unregister_cpu_notifier(&setup_broadcast_notifier);
>> + unregister_cpu_notifier(&cpu_hotplug_notifier);
> Same.
Thanks for the review !
-- Daniel
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
_______________________________________________
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev
WARNING: multiple messages have this Message-ID (diff)
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Thomas Renninger <trenn@suse.de>
Cc: srivatsa.bhat@linux.vnet.ibm.com, deepthi@linux.vnet.ibm.com,
linux-acpi@vger.kernel.org, linux-pm@lists.linux-foundation.org,
linux-pm@vger.kernel.org, lenb@kernel.org, rjw@sisk.pl,
x86@kernel.org, linux-kernel@vger.kernel.org,
linaro-dev@lists.linaro.org
Subject: Re: [PATCH] acpi: intel_idle : break dependency between modules
Date: Thu, 28 Jun 2012 10:03:56 +0200 [thread overview]
Message-ID: <4FEC0FEC.5070304@linaro.org> (raw)
In-Reply-To: <201206271506.29034.trenn@suse.de>
On 06/27/2012 03:06 PM, Thomas Renninger wrote:
> Hi,
>
> I agree that such a dependency between 2 modules is not
> nice. But your patch will have bad side-effects (see comments
> embedded below).
>
> On Wednesday, June 27, 2012 11:07:48 AM Daniel Lezcano wrote:
>> When the system is booted with some cpus offline, the idle
>> driver is not initialized. When a cpu is set online, the
>> acpi code call the intel idle init function. Unfortunately
>> this code introduce a dependency between intel_idle and acpi.
>>
>> This patch is intended to remove this dependency by using the
>> notifier of intel_idle. In order to make it work, the notifier
>> must be initialized in the right order, acpi then intel_idle.
>> This is done in the Makefile. This patch has the benefit of
>> encapsulating the intel_idle driver and remove some exported
>> functions.
>>
>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
>> ---
>> drivers/Makefile | 3 ++-
>> drivers/acpi/processor_driver.c | 7 -------
>> drivers/idle/intel_idle.c | 22 ++++++++++++++--------
>> include/linux/cpuidle.h | 7 -------
>> 4 files changed, 16 insertions(+), 23 deletions(-)
>>
>> diff --git a/drivers/Makefile b/drivers/Makefile
>> index 2ba29ff..a2454b8 100644
>> --- a/drivers/Makefile
>> +++ b/drivers/Makefile
>> @@ -12,8 +12,9 @@ obj-$(CONFIG_PCI) += pci/
>> obj-$(CONFIG_PARISC) += parisc/
>> obj-$(CONFIG_RAPIDIO) += rapidio/
>> obj-y += video/
>> -obj-y += idle/
>> +# acpi must come before idle for initialization
>> obj-$(CONFIG_ACPI) += acpi/
>> +obj-y += idle/
> This breaks intel_idle.
> Loading order defines which one comes first and is used: intel_idle
> or ACPI processor cpuidle driver.
> With above, one would get acpi_idle cpuidle driver if both are
> compiled in, instead of the intel_idle one.
>
> Why exactly is this necessary, couldn't it just work?
[...]
I just wanted to keep same order. If it is not necessary, I won't invert
the compilation order in the next patch.
>> -static int setup_broadcast_cpuhp_notify(struct notifier_block *n,
>> - unsigned long action, void *hcpu)
>> +static int cpu_hotplug_notify(struct notifier_block *n,
>> + unsigned long action, void *hcpu)
>> {
>> int hotcpu = (unsigned long)hcpu;
>> + struct cpuidle_device *dev;
>>
>> switch (action & 0xf) {
>> case CPU_ONLINE:
>> smp_call_function_single(hotcpu, __setup_broadcast_timer,
>> (void *)true, 1);
>> +
>> + dev = per_cpu_ptr(intel_idle_cpuidle_devices, hotcpu);
>> + if (!dev->registered)
>> + intel_idle_cpu_init(hotcpu);
>> +
> A small comment why this can happen and needs to be done
> (real hotplugged cpu case) might help here later.
Yes, that makes sense.
[...]
>> static void auto_demotion_disable(void *dummy)
>> @@ -407,7 +414,7 @@ static int intel_idle_probe(void)
>> lapic_timer_reliable_states = LAPIC_TIMER_ALWAYS_RELIABLE;
>> else {
>> on_each_cpu(__setup_broadcast_timer, (void *)true, 1);
>> - register_cpu_notifier(&setup_broadcast_notifier);
>> + register_cpu_notifier(&cpu_hotplug_notifier);
>
> The notifier always has to be registered now, not only in:
> if (boot_cpu_has(X86_FEATURE_ARAT)) /* Always Reliable APIC Timer */
> case.
Oops, right.
>> pr_debug(PREFIX "v" INTEL_IDLE_VERSION
>> @@ -494,7 +501,7 @@ static int intel_idle_cpuidle_driver_init(void)
>> * allocate, initialize, register cpuidle_devices
>> * @cpu: cpu/core to initialize
>> */
>> -int intel_idle_cpu_init(int cpu)
>> +static int intel_idle_cpu_init(int cpu)
>> {
>> int cstate;
>> struct cpuidle_device *dev;
>> @@ -539,7 +546,6 @@ int intel_idle_cpu_init(int cpu)
>>
>> return 0;
>> }
>> -EXPORT_SYMBOL_GPL(intel_idle_cpu_init);
>>
>> static int __init intel_idle_init(void)
>> {
>> @@ -583,7 +589,7 @@ static void __exit intel_idle_exit(void)
>>
>> if (lapic_timer_reliable_states != LAPIC_TIMER_ALWAYS_RELIABLE) {
>> on_each_cpu(__setup_broadcast_timer, (void *)false, 1);
>> - unregister_cpu_notifier(&setup_broadcast_notifier);
>> + unregister_cpu_notifier(&cpu_hotplug_notifier);
> Same.
Thanks for the review !
-- Daniel
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
next prev parent reply other threads:[~2012-06-28 8:03 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-15 15:28 acpi_idle and max_cpus Daniel Lezcano
2012-06-17 20:18 ` Daniel Lezcano
2012-06-18 12:25 ` Deepthi Dharwar
2012-06-18 12:54 ` [linux-pm] " Daniel Lezcano
2012-06-19 6:54 ` Deepthi Dharwar
2012-06-19 7:03 ` Srivatsa S. Bhat
2012-06-19 7:18 ` Daniel Lezcano
2012-06-19 15:30 ` Thomas Renninger
2012-06-25 11:25 ` [PATCH] acpi, cpuidle: Register with cpuidle even if cpu is onlined after boot (beyond maxcpus) Srivatsa S. Bhat
2012-06-25 13:53 ` Thomas Renninger
2012-06-25 13:53 ` Thomas Renninger
2012-06-25 16:03 ` Srivatsa S. Bhat
2012-06-25 16:03 ` Srivatsa S. Bhat
2012-06-26 9:29 ` Thomas Renninger
2012-06-26 9:41 ` Daniel Lezcano
2012-06-26 9:41 ` Daniel Lezcano
2012-06-26 9:58 ` Srivatsa S. Bhat
2012-06-26 9:58 ` Srivatsa S. Bhat
2012-06-26 10:42 ` Daniel Lezcano
2012-06-26 10:42 ` Daniel Lezcano
2012-06-26 11:01 ` Thomas Renninger
2012-06-26 11:01 ` Thomas Renninger
2012-06-27 9:07 ` [PATCH] acpi: intel_idle : break dependency between modules Daniel Lezcano
2012-06-27 9:07 ` Daniel Lezcano
2012-06-27 13:06 ` Thomas Renninger
2012-06-27 13:06 ` Thomas Renninger
[not found] ` <201206271506.29034.trenn-l3A5Bk7waGM@public.gmane.org>
2012-06-28 8:03 ` Daniel Lezcano [this message]
2012-06-28 8:03 ` Daniel Lezcano
2012-06-28 8:46 ` [PATCH v2] " Daniel Lezcano
2012-06-28 8:46 ` Daniel Lezcano
2012-06-28 11:24 ` Srivatsa S. Bhat
2012-06-28 11:27 ` Daniel Lezcano
2012-06-28 11:27 ` Daniel Lezcano
2012-06-28 11:56 ` Srivatsa S. Bhat
2012-06-28 11:56 ` Srivatsa S. Bhat
2012-06-28 19:24 ` Rafael J. Wysocki
2012-06-29 8:39 ` Daniel Lezcano
2012-06-29 8:39 ` Daniel Lezcano
2012-06-29 22:27 ` Rafael J. Wysocki
2012-06-29 22:27 ` Rafael J. Wysocki
2012-07-01 19:36 ` Daniel Lezcano
2012-07-01 19:36 ` Daniel Lezcano
2012-06-27 16:16 ` [PATCH] " Srivatsa S. Bhat
2012-06-27 16:16 ` [linux-pm] " Srivatsa S. Bhat
2012-06-28 7:34 ` Thomas Renninger
2012-06-28 11:23 ` Srivatsa S. Bhat
2012-06-28 11:23 ` [linux-pm] " Srivatsa S. Bhat
2012-06-26 11:07 ` [PATCH] acpi, cpuidle: Register with cpuidle even if cpu is onlined after boot (beyond maxcpus) Srivatsa S. Bhat
2012-06-26 11:07 ` [linux-pm] " Srivatsa S. Bhat
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=4FEC0FEC.5070304@linaro.org \
--to=daniel.lezcano-qsej5fyqhm4dnm+yrofe0a@public.gmane.org \
--cc=deepthi-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
--cc=lenb-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=linaro-dev-cunTk1MwBs8s++Sfvej+rw@public.gmane.org \
--cc=linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-pm-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=rjw-KKrjLPT3xs0@public.gmane.org \
--cc=srivatsa.bhat-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
--cc=trenn-l3A5Bk7waGM@public.gmane.org \
--cc=x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.