All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] __cpuhp_setup_state() returns positive value for dynamic state
@ 2016-12-15 15:00 Boris Ostrovsky
  2016-12-15 15:00 ` [PATCH 1/2] cpu/hotplug: Clarify description of __cpuhp_setup_state() return value Boris Ostrovsky
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Boris Ostrovsky @ 2016-12-15 15:00 UTC (permalink / raw)
  To: tglx, bigeasy, rjw, viresh.kumar
  Cc: linux-pm, linux-kernel, xen-devel, Boris Ostrovsky

The first patch corrects description of __cpuhp_setup_state()'s possible
return values and the second fixes a bug (which causes Xen guests to crash).

As a follow-up question for the first patch --- should we allow calling
__cpuhp_setup_state() with state in [CPUHP_AP_ONLINE_DYN + 1 .. CPUHP_AP_ONLINE_DYN_END]
range?

Boris Ostrovsky (2):
  cpu/hotplug: Clarify description of __cpuhp_setup_state() return
    value
  cpufreq: Remove cpu hotplug callbacks only if they were initialized

 drivers/cpufreq/acpi-cpufreq.c |    2 +-
 kernel/cpu.c                   |    6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] cpu/hotplug: Clarify description of __cpuhp_setup_state() return value
  2016-12-15 15:00 [PATCH 0/2] __cpuhp_setup_state() returns positive value for dynamic state Boris Ostrovsky
  2016-12-15 15:00 ` [PATCH 1/2] cpu/hotplug: Clarify description of __cpuhp_setup_state() return value Boris Ostrovsky
@ 2016-12-15 15:00 ` Boris Ostrovsky
  2016-12-15 16:55   ` [tip:smp/urgent] " tip-bot for Boris Ostrovsky
  2016-12-15 15:00 ` [PATCH 2/2] cpufreq: Remove cpu hotplug callbacks only if they were initialized Boris Ostrovsky
  2016-12-15 15:00 ` Boris Ostrovsky
  3 siblings, 1 reply; 9+ messages in thread
From: Boris Ostrovsky @ 2016-12-15 15:00 UTC (permalink / raw)
  To: tglx, bigeasy, rjw, viresh.kumar
  Cc: linux-pm, linux-kernel, xen-devel, Boris Ostrovsky

When ivoked with CPUHP_AP_ONLINE_DYN state __cpuhp_setup_state()
is expected to return positive value which is the hotplug state that
the routine assigns.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
---

 kernel/cpu.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/kernel/cpu.c b/kernel/cpu.c
index 217fd2e..5339aca 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -1586,7 +1586,11 @@ int __cpuhp_state_add_instance(enum cpuhp_state state, struct hlist_node *node,
  * @startup:	startup callback function
  * @teardown:	teardown callback function
  *
- * Returns 0 if successful, otherwise a proper error code
+ * Returns:
+ *   On success:
+ *      Positive state number if @state is CPUHP_AP_ONLINE_DYN
+ *      0 for all other states
+ *   On failure: proper (negative) error code
  */
 int __cpuhp_setup_state(enum cpuhp_state state,
 			const char *name, bool invoke,
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 1/2] cpu/hotplug: Clarify description of __cpuhp_setup_state() return value
  2016-12-15 15:00 [PATCH 0/2] __cpuhp_setup_state() returns positive value for dynamic state Boris Ostrovsky
@ 2016-12-15 15:00 ` Boris Ostrovsky
  2016-12-15 15:00 ` Boris Ostrovsky
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Boris Ostrovsky @ 2016-12-15 15:00 UTC (permalink / raw)
  To: tglx, bigeasy, rjw, viresh.kumar
  Cc: xen-devel, Boris Ostrovsky, linux-kernel, linux-pm

When ivoked with CPUHP_AP_ONLINE_DYN state __cpuhp_setup_state()
is expected to return positive value which is the hotplug state that
the routine assigns.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
---

 kernel/cpu.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/kernel/cpu.c b/kernel/cpu.c
index 217fd2e..5339aca 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -1586,7 +1586,11 @@ int __cpuhp_state_add_instance(enum cpuhp_state state, struct hlist_node *node,
  * @startup:	startup callback function
  * @teardown:	teardown callback function
  *
- * Returns 0 if successful, otherwise a proper error code
+ * Returns:
+ *   On success:
+ *      Positive state number if @state is CPUHP_AP_ONLINE_DYN
+ *      0 for all other states
+ *   On failure: proper (negative) error code
  */
 int __cpuhp_setup_state(enum cpuhp_state state,
 			const char *name, bool invoke,
-- 
1.7.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/2] cpufreq: Remove cpu hotplug callbacks only if they were initialized
  2016-12-15 15:00 [PATCH 0/2] __cpuhp_setup_state() returns positive value for dynamic state Boris Ostrovsky
                   ` (2 preceding siblings ...)
  2016-12-15 15:00 ` [PATCH 2/2] cpufreq: Remove cpu hotplug callbacks only if they were initialized Boris Ostrovsky
@ 2016-12-15 15:00 ` Boris Ostrovsky
  2016-12-15 16:47   ` Thomas Gleixner
  2016-12-15 16:47   ` Thomas Gleixner
  3 siblings, 2 replies; 9+ messages in thread
From: Boris Ostrovsky @ 2016-12-15 15:00 UTC (permalink / raw)
  To: tglx, bigeasy, rjw, viresh.kumar
  Cc: linux-pm, linux-kernel, xen-devel, Boris Ostrovsky

Since cpu hotplug callbacks are requested for CPUHP_AP_ONLINE_DYN state,
successful callback initialization will result in cpuhp_setup_state()
returning a positive value. Therefore acpi_cpufreq_online being zero
indicates that callbacks have not been installed.

This means that acpi_cpufreq_boost_exit() should only remove them if
acpi_cpufreq_online is positive. Trying to call
cpuhp_remove_state_nocalls(0) will cause a BUG().

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
---
 drivers/cpufreq/acpi-cpufreq.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
index 3a98702..3a2ca0f 100644
--- a/drivers/cpufreq/acpi-cpufreq.c
+++ b/drivers/cpufreq/acpi-cpufreq.c
@@ -930,7 +930,7 @@ static void __init acpi_cpufreq_boost_init(void)
 
 static void acpi_cpufreq_boost_exit(void)
 {
-	if (acpi_cpufreq_online >= 0)
+	if (acpi_cpufreq_online > 0)
 		cpuhp_remove_state_nocalls(acpi_cpufreq_online);
 }
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/2] cpufreq: Remove cpu hotplug callbacks only if they were initialized
  2016-12-15 15:00 [PATCH 0/2] __cpuhp_setup_state() returns positive value for dynamic state Boris Ostrovsky
  2016-12-15 15:00 ` [PATCH 1/2] cpu/hotplug: Clarify description of __cpuhp_setup_state() return value Boris Ostrovsky
  2016-12-15 15:00 ` Boris Ostrovsky
@ 2016-12-15 15:00 ` Boris Ostrovsky
  2016-12-15 15:00 ` Boris Ostrovsky
  3 siblings, 0 replies; 9+ messages in thread
From: Boris Ostrovsky @ 2016-12-15 15:00 UTC (permalink / raw)
  To: tglx, bigeasy, rjw, viresh.kumar
  Cc: xen-devel, Boris Ostrovsky, linux-kernel, linux-pm

Since cpu hotplug callbacks are requested for CPUHP_AP_ONLINE_DYN state,
successful callback initialization will result in cpuhp_setup_state()
returning a positive value. Therefore acpi_cpufreq_online being zero
indicates that callbacks have not been installed.

This means that acpi_cpufreq_boost_exit() should only remove them if
acpi_cpufreq_online is positive. Trying to call
cpuhp_remove_state_nocalls(0) will cause a BUG().

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
---
 drivers/cpufreq/acpi-cpufreq.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
index 3a98702..3a2ca0f 100644
--- a/drivers/cpufreq/acpi-cpufreq.c
+++ b/drivers/cpufreq/acpi-cpufreq.c
@@ -930,7 +930,7 @@ static void __init acpi_cpufreq_boost_init(void)
 
 static void acpi_cpufreq_boost_exit(void)
 {
-	if (acpi_cpufreq_online >= 0)
+	if (acpi_cpufreq_online > 0)
 		cpuhp_remove_state_nocalls(acpi_cpufreq_online);
 }
 
-- 
1.7.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] cpufreq: Remove cpu hotplug callbacks only if they were initialized
  2016-12-15 15:00 ` Boris Ostrovsky
  2016-12-15 16:47   ` Thomas Gleixner
@ 2016-12-15 16:47   ` Thomas Gleixner
  1 sibling, 0 replies; 9+ messages in thread
From: Thomas Gleixner @ 2016-12-15 16:47 UTC (permalink / raw)
  To: Boris Ostrovsky
  Cc: bigeasy, rjw, viresh.kumar, linux-pm, linux-kernel, xen-devel

On Thu, 15 Dec 2016, Boris Ostrovsky wrote:

> Since cpu hotplug callbacks are requested for CPUHP_AP_ONLINE_DYN state,
> successful callback initialization will result in cpuhp_setup_state()
> returning a positive value. Therefore acpi_cpufreq_online being zero
> indicates that callbacks have not been installed.
> 
> This means that acpi_cpufreq_boost_exit() should only remove them if
> acpi_cpufreq_online is positive. Trying to call
> cpuhp_remove_state_nocalls(0) will cause a BUG().
> 
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>

Reviewed-by: Thomas Gleixner <tglx@linutronix.de>

> ---
>  drivers/cpufreq/acpi-cpufreq.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
> index 3a98702..3a2ca0f 100644
> --- a/drivers/cpufreq/acpi-cpufreq.c
> +++ b/drivers/cpufreq/acpi-cpufreq.c
> @@ -930,7 +930,7 @@ static void __init acpi_cpufreq_boost_init(void)
>  
>  static void acpi_cpufreq_boost_exit(void)
>  {
> -	if (acpi_cpufreq_online >= 0)
> +	if (acpi_cpufreq_online > 0)
>  		cpuhp_remove_state_nocalls(acpi_cpufreq_online);
>  }
>  
> -- 
> 1.7.1
> 
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] cpufreq: Remove cpu hotplug callbacks only if they were initialized
  2016-12-15 15:00 ` Boris Ostrovsky
@ 2016-12-15 16:47   ` Thomas Gleixner
  2016-12-15 16:47   ` Thomas Gleixner
  1 sibling, 0 replies; 9+ messages in thread
From: Thomas Gleixner @ 2016-12-15 16:47 UTC (permalink / raw)
  To: Boris Ostrovsky
  Cc: linux-pm, viresh.kumar, bigeasy, rjw, linux-kernel, xen-devel

On Thu, 15 Dec 2016, Boris Ostrovsky wrote:

> Since cpu hotplug callbacks are requested for CPUHP_AP_ONLINE_DYN state,
> successful callback initialization will result in cpuhp_setup_state()
> returning a positive value. Therefore acpi_cpufreq_online being zero
> indicates that callbacks have not been installed.
> 
> This means that acpi_cpufreq_boost_exit() should only remove them if
> acpi_cpufreq_online is positive. Trying to call
> cpuhp_remove_state_nocalls(0) will cause a BUG().
> 
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>

Reviewed-by: Thomas Gleixner <tglx@linutronix.de>

> ---
>  drivers/cpufreq/acpi-cpufreq.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
> index 3a98702..3a2ca0f 100644
> --- a/drivers/cpufreq/acpi-cpufreq.c
> +++ b/drivers/cpufreq/acpi-cpufreq.c
> @@ -930,7 +930,7 @@ static void __init acpi_cpufreq_boost_init(void)
>  
>  static void acpi_cpufreq_boost_exit(void)
>  {
> -	if (acpi_cpufreq_online >= 0)
> +	if (acpi_cpufreq_online > 0)
>  		cpuhp_remove_state_nocalls(acpi_cpufreq_online);
>  }
>  
> -- 
> 1.7.1
> 
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [tip:smp/urgent] cpu/hotplug: Clarify description of __cpuhp_setup_state() return value
  2016-12-15 15:00 ` Boris Ostrovsky
@ 2016-12-15 16:55   ` tip-bot for Boris Ostrovsky
  0 siblings, 0 replies; 9+ messages in thread
From: tip-bot for Boris Ostrovsky @ 2016-12-15 16:55 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: hpa, tglx, mingo, boris.ostrovsky, linux-kernel

Commit-ID:  512f09801b356c54baef62543e51169f03b2e642
Gitweb:     http://git.kernel.org/tip/512f09801b356c54baef62543e51169f03b2e642
Author:     Boris Ostrovsky <boris.ostrovsky@oracle.com>
AuthorDate: Thu, 15 Dec 2016 10:00:57 -0500
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Thu, 15 Dec 2016 17:48:20 +0100

cpu/hotplug: Clarify description of __cpuhp_setup_state() return value

When invoked with CPUHP_AP_ONLINE_DYN state __cpuhp_setup_state()
is expected to return positive value which is the hotplug state that
the routine assigns.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: linux-pm@vger.kernel.org
Cc: viresh.kumar@linaro.org
Cc: bigeasy@linutronix.de
Cc: rjw@rjwysocki.net
Cc: xen-devel@lists.xenproject.org
Link: http://lkml.kernel.org/r/1481814058-4799-2-git-send-email-boris.ostrovsky@oracle.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 kernel/cpu.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/kernel/cpu.c b/kernel/cpu.c
index 217fd2e..5339aca 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -1586,7 +1586,11 @@ EXPORT_SYMBOL_GPL(__cpuhp_state_add_instance);
  * @startup:	startup callback function
  * @teardown:	teardown callback function
  *
- * Returns 0 if successful, otherwise a proper error code
+ * Returns:
+ *   On success:
+ *      Positive state number if @state is CPUHP_AP_ONLINE_DYN
+ *      0 for all other states
+ *   On failure: proper (negative) error code
  */
 int __cpuhp_setup_state(enum cpuhp_state state,
 			const char *name, bool invoke,

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 0/2] __cpuhp_setup_state() returns positive value for dynamic state
@ 2016-12-15 15:00 Boris Ostrovsky
  0 siblings, 0 replies; 9+ messages in thread
From: Boris Ostrovsky @ 2016-12-15 15:00 UTC (permalink / raw)
  To: tglx, bigeasy, rjw, viresh.kumar
  Cc: xen-devel, Boris Ostrovsky, linux-kernel, linux-pm

The first patch corrects description of __cpuhp_setup_state()'s possible
return values and the second fixes a bug (which causes Xen guests to crash).

As a follow-up question for the first patch --- should we allow calling
__cpuhp_setup_state() with state in [CPUHP_AP_ONLINE_DYN + 1 .. CPUHP_AP_ONLINE_DYN_END]
range?

Boris Ostrovsky (2):
  cpu/hotplug: Clarify description of __cpuhp_setup_state() return
    value
  cpufreq: Remove cpu hotplug callbacks only if they were initialized

 drivers/cpufreq/acpi-cpufreq.c |    2 +-
 kernel/cpu.c                   |    6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-12-15 16:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-15 15:00 [PATCH 0/2] __cpuhp_setup_state() returns positive value for dynamic state Boris Ostrovsky
2016-12-15 15:00 ` [PATCH 1/2] cpu/hotplug: Clarify description of __cpuhp_setup_state() return value Boris Ostrovsky
2016-12-15 15:00 ` Boris Ostrovsky
2016-12-15 16:55   ` [tip:smp/urgent] " tip-bot for Boris Ostrovsky
2016-12-15 15:00 ` [PATCH 2/2] cpufreq: Remove cpu hotplug callbacks only if they were initialized Boris Ostrovsky
2016-12-15 15:00 ` Boris Ostrovsky
2016-12-15 16:47   ` Thomas Gleixner
2016-12-15 16:47   ` Thomas Gleixner
2016-12-15 15:00 [PATCH 0/2] __cpuhp_setup_state() returns positive value for dynamic state Boris Ostrovsky

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.