diff mbox

[3/4] cpu: export cpu hotplug disable/enable functions as global functions

Message ID 1344329006-10645-3-git-send-email-chenhui.zhao@freescale.com (mailing list archive)
State Superseded
Delegated to: Kumar Gala
Headers show

Commit Message

chenhui zhao Aug. 7, 2012, 8:43 a.m. UTC
The cpufreq driver of mpc85xx will disable/enable cpu hotplug temporarily.
Therefore, the related functions should be exported.

Signed-off-by: Zhao Chenhui <chenhui.zhao@freescale.com>
---
 include/linux/cpu.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

Comments

Kumar Gala Aug. 7, 2012, 5:51 p.m. UTC | #1
On Aug 7, 2012, at 3:43 AM, Zhao Chenhui wrote:

> The cpufreq driver of mpc85xx will disable/enable cpu hotplug temporarily.
> Therefore, the related functions should be exported.
> 
> Signed-off-by: Zhao Chenhui <chenhui.zhao@freescale.com>
> ---
> include/linux/cpu.h |    4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)

Rafael, Srivatsa,

Wanted to get your ack on export these functions for direct calling by arch code.

- k

> 
> diff --git a/include/linux/cpu.h b/include/linux/cpu.h
> index ce7a074..df8f73d 100644
> --- a/include/linux/cpu.h
> +++ b/include/linux/cpu.h
> @@ -146,6 +146,8 @@ void notify_cpu_starting(unsigned int cpu);
> extern void cpu_maps_update_begin(void);
> extern void cpu_maps_update_done(void);
> 
> +extern void cpu_hotplug_disable_before_freeze(void);
> +extern void cpu_hotplug_enable_after_thaw(void);
> #else	/* CONFIG_SMP */
> 
> #define cpu_notifier(fn, pri)	do { (void)(fn); } while (0)
> @@ -167,6 +169,8 @@ static inline void cpu_maps_update_done(void)
> {
> }
> 
> +static inline void cpu_hotplug_disable_before_freeze(void)	{}
> +static inline void cpu_hotplug_enable_after_thaw(void)	{}
> #endif /* CONFIG_SMP */
> extern struct bus_type cpu_subsys;
> 
> -- 
> 1.6.4.1
>
Srivatsa S. Bhat Aug. 8, 2012, 6:13 a.m. UTC | #2
On 08/07/2012 11:21 PM, Kumar Gala wrote:
> 
> On Aug 7, 2012, at 3:43 AM, Zhao Chenhui wrote:
> 
>> The cpufreq driver of mpc85xx will disable/enable cpu hotplug temporarily.
>> Therefore, the related functions should be exported.
>>
>> Signed-off-by: Zhao Chenhui <chenhui.zhao@freescale.com>
>> ---
>> include/linux/cpu.h |    4 ++++
>> 1 files changed, 4 insertions(+), 0 deletions(-)
> 
> Rafael, Srivatsa,
> 
> Wanted to get your ack on export these functions for direct calling by arch code.
>

Why not just use get_online_cpus()/put_online_cpus()?

In the case of suspend/resume/hibernation, we had introduced these CPU hotplug disable
functions because we would end up doing CPU hotplug ourselves, further down the path.
So if we did a get_online_cpus(), we would end up deadlocking ourselves. Whereas, the
patch 4/4 looks like a straightforward case of wanting to simply disable CPU hotplug..
I don't see where you are doing CPU hotplug yourself in the path. So IMO, just
get/put_online_cpus() should do.

Regards,
Srivatsa S. Bhat

> 
>>
>> diff --git a/include/linux/cpu.h b/include/linux/cpu.h
>> index ce7a074..df8f73d 100644
>> --- a/include/linux/cpu.h
>> +++ b/include/linux/cpu.h
>> @@ -146,6 +146,8 @@ void notify_cpu_starting(unsigned int cpu);
>> extern void cpu_maps_update_begin(void);
>> extern void cpu_maps_update_done(void);
>>
>> +extern void cpu_hotplug_disable_before_freeze(void);
>> +extern void cpu_hotplug_enable_after_thaw(void);
>> #else	/* CONFIG_SMP */
>>
>> #define cpu_notifier(fn, pri)	do { (void)(fn); } while (0)
>> @@ -167,6 +169,8 @@ static inline void cpu_maps_update_done(void)
>> {
>> }
>>
>> +static inline void cpu_hotplug_disable_before_freeze(void)	{}
>> +static inline void cpu_hotplug_enable_after_thaw(void)	{}
>> #endif /* CONFIG_SMP */
>> extern struct bus_type cpu_subsys;
>>
>> -- 
>> 1.6.4.1
>>
>
chenhui zhao Aug. 8, 2012, 7:11 a.m. UTC | #3
On Wed, Aug 08, 2012 at 11:43:22AM +0530, Srivatsa S. Bhat wrote:
> On 08/07/2012 11:21 PM, Kumar Gala wrote:
> > 
> > On Aug 7, 2012, at 3:43 AM, Zhao Chenhui wrote:
> > 
> >> The cpufreq driver of mpc85xx will disable/enable cpu hotplug temporarily.
> >> Therefore, the related functions should be exported.
> >>
> >> Signed-off-by: Zhao Chenhui <chenhui.zhao@freescale.com>
> >> ---
> >> include/linux/cpu.h |    4 ++++
> >> 1 files changed, 4 insertions(+), 0 deletions(-)
> > 
> > Rafael, Srivatsa,
> > 
> > Wanted to get your ack on export these functions for direct calling by arch code.
> >
> 
> Why not just use get_online_cpus()/put_online_cpus()?
> 
> In the case of suspend/resume/hibernation, we had introduced these CPU hotplug disable
> functions because we would end up doing CPU hotplug ourselves, further down the path.
> So if we did a get_online_cpus(), we would end up deadlocking ourselves. Whereas, the
> patch 4/4 looks like a straightforward case of wanting to simply disable CPU hotplug..
> I don't see where you are doing CPU hotplug yourself in the path. So IMO, just
> get/put_online_cpus() should do.
> 
> Regards,
> Srivatsa S. Bhat
> 

Thanks for your comment. I will try to use get/put_online_cpus() in my patch.

-Chenhui
chenhui zhao Aug. 10, 2012, 9:41 a.m. UTC | #4
On Tue, Aug 07, 2012 at 04:43:25PM +0800, Zhao Chenhui wrote:
> The cpufreq driver of mpc85xx will disable/enable cpu hotplug temporarily.
> Therefore, the related functions should be exported.
> 
> Signed-off-by: Zhao Chenhui <chenhui.zhao@freescale.com>
> ---
>  include/linux/cpu.h |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/include/linux/cpu.h b/include/linux/cpu.h
> index ce7a074..df8f73d 100644
> --- a/include/linux/cpu.h
> +++ b/include/linux/cpu.h
> @@ -146,6 +146,8 @@ void notify_cpu_starting(unsigned int cpu);
>  extern void cpu_maps_update_begin(void);
>  extern void cpu_maps_update_done(void);
>  
> +extern void cpu_hotplug_disable_before_freeze(void);
> +extern void cpu_hotplug_enable_after_thaw(void);
>  #else	/* CONFIG_SMP */
>  
>  #define cpu_notifier(fn, pri)	do { (void)(fn); } while (0)
> @@ -167,6 +169,8 @@ static inline void cpu_maps_update_done(void)
>  {
>  }
>  
> +static inline void cpu_hotplug_disable_before_freeze(void)	{}
> +static inline void cpu_hotplug_enable_after_thaw(void)	{}
>  #endif /* CONFIG_SMP */
>  extern struct bus_type cpu_subsys;
>  
> -- 
> 1.6.4.1
> 

Hi kumar,

I will not use these API in the 4/4 patch. please ignore this patch.

-Chenhui
diff mbox

Patch

diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index ce7a074..df8f73d 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -146,6 +146,8 @@  void notify_cpu_starting(unsigned int cpu);
 extern void cpu_maps_update_begin(void);
 extern void cpu_maps_update_done(void);
 
+extern void cpu_hotplug_disable_before_freeze(void);
+extern void cpu_hotplug_enable_after_thaw(void);
 #else	/* CONFIG_SMP */
 
 #define cpu_notifier(fn, pri)	do { (void)(fn); } while (0)
@@ -167,6 +169,8 @@  static inline void cpu_maps_update_done(void)
 {
 }
 
+static inline void cpu_hotplug_disable_before_freeze(void)	{}
+static inline void cpu_hotplug_enable_after_thaw(void)	{}
 #endif /* CONFIG_SMP */
 extern struct bus_type cpu_subsys;