Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1486823 > unrolled thread
| Started by | tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> |
|---|---|
| First post | 2016-09-19 22:00 +0200 |
| Last post | 2016-09-20 18:20 +0200 |
| Articles | 5 — 4 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[tip:smp/hotplug] cpufreq: Convert to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-09-19 22:00 +0200
[PATCH] cpufreq: fix up conversion to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-09-20 17:00 +0200
[tip:smp/hotplug] cpufreq: Fix up conversion to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-09-20 17:10 +0200
Re: [tip:smp/hotplug] cpufreq: Fix up conversion to hotplug state machine Borislav Petkov <bp@alien8.de> - 2016-09-20 18:10 +0200
Re: [PATCH] cpufreq: fix up conversion to hotplug state machine "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-09-20 18:20 +0200
| From | tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> |
|---|---|
| Date | 2016-09-19 22:00 +0200 |
| Subject | [tip:smp/hotplug] cpufreq: Convert to hotplug state machine |
| Message-ID | <sjcTp-1ej-63@gated-at.bofh.it> |
Commit-ID: 27622b061eb4bb4d16b5d61219ac10a792010321
Gitweb: http://git.kernel.org/tip/27622b061eb4bb4d16b5d61219ac10a792010321
Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate: Tue, 6 Sep 2016 19:04:48 +0200
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 19 Sep 2016 21:44:29 +0200
cpufreq: Convert to hotplug state machine
Install the callbacks via the state machine.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: linux-pm@vger.kernel.org
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Viresh Kumar <viresh.kumar@linaro.or
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/20160906170457.32393-13-bigeasy@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
drivers/cpufreq/cpufreq.c | 38 ++++++++++++--------------------------
1 file changed, 12 insertions(+), 26 deletions(-)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 3dd4884..e0bc632 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1358,7 +1358,7 @@ static int cpufreq_add_dev(struct device *dev, struct subsys_interface *sif)
return add_cpu_dev_symlink(policy, cpu);
}
-static void cpufreq_offline(unsigned int cpu)
+static int cpufreq_offline(unsigned int cpu)
{
struct cpufreq_policy *policy;
int ret;
@@ -1368,7 +1368,7 @@ static void cpufreq_offline(unsigned int cpu)
policy = cpufreq_cpu_get_raw(cpu);
if (!policy) {
pr_debug("%s: No cpu_data found\n", __func__);
- return;
+ return 0;
}
down_write(&policy->rwsem);
@@ -1417,6 +1417,7 @@ static void cpufreq_offline(unsigned int cpu)
unlock:
up_write(&policy->rwsem);
+ return 0;
}
/**
@@ -2332,28 +2333,6 @@ unlock:
}
EXPORT_SYMBOL(cpufreq_update_policy);
-static int cpufreq_cpu_callback(struct notifier_block *nfb,
- unsigned long action, void *hcpu)
-{
- unsigned int cpu = (unsigned long)hcpu;
-
- switch (action & ~CPU_TASKS_FROZEN) {
- case CPU_ONLINE:
- case CPU_DOWN_FAILED:
- cpufreq_online(cpu);
- break;
-
- case CPU_DOWN_PREPARE:
- cpufreq_offline(cpu);
- break;
- }
- return NOTIFY_OK;
-}
-
-static struct notifier_block __refdata cpufreq_cpu_notifier = {
- .notifier_call = cpufreq_cpu_callback,
-};
-
/*********************************************************************
* BOOST *
*********************************************************************/
@@ -2455,6 +2434,7 @@ EXPORT_SYMBOL_GPL(cpufreq_boost_enabled);
/*********************************************************************
* REGISTER / UNREGISTER CPUFREQ DRIVER *
*********************************************************************/
+static enum cpuhp_state hp_online;
/**
* cpufreq_register_driver - register a CPU Frequency driver
@@ -2517,7 +2497,13 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)
goto err_if_unreg;
}
- register_hotcpu_notifier(&cpufreq_cpu_notifier);
+ ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "cpufreq:online",
+ cpufreq_online,
+ cpufreq_offline);
+ if (ret < 0)
+ goto err_if_unreg;
+ hp_online = ret;
+
pr_debug("driver %s up and running\n", driver_data->name);
goto out;
@@ -2556,7 +2542,7 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver)
get_online_cpus();
subsys_interface_unregister(&cpufreq_interface);
remove_boost_sysfs_file();
- unregister_hotcpu_notifier(&cpufreq_cpu_notifier);
+ cpuhp_remove_state_nocalls(hp_online);
write_lock_irqsave(&cpufreq_driver_lock, flags);
[toc] | [next] | [standalone]
| From | Sebastian Andrzej Siewior <bigeasy@linutronix.de> |
|---|---|
| Date | 2016-09-20 17:00 +0200 |
| Subject | [PATCH] cpufreq: fix up conversion to hotplug state machine |
| Message-ID | <sjuGC-4nM-25@gated-at.bofh.it> |
| In reply to | #1486823 |
The function cpufreq_register_driver() returns zero on success and since
commit 27622b061eb4 ("cpufreq: Convert to hotplug state machine")
erroneously a positive number. Due to the "if (x) assume_error" construct
all callers assumed an error and things went south.
This patch resets the return value back to zero in the success case.
Fixes: 27622b061eb4 ("cpufreq: Convert to hotplug state machine")
Reported-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
drivers/cpufreq/cpufreq.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index e0bc632a259e..8b44de4d7438 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -2503,6 +2503,7 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)
if (ret < 0)
goto err_if_unreg;
hp_online = ret;
+ ret = 0;
pr_debug("driver %s up and running\n", driver_data->name);
goto out;
--
2.9.3
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> |
|---|---|
| Date | 2016-09-20 17:10 +0200 |
| Subject | [tip:smp/hotplug] cpufreq: Fix up conversion to hotplug state machine |
| Message-ID | <sjuQi-4Gm-17@gated-at.bofh.it> |
| In reply to | #1487407 |
Commit-ID: 5372e054a1928fe704cf0a5e2e139645a777b50a
Gitweb: http://git.kernel.org/tip/5372e054a1928fe704cf0a5e2e139645a777b50a
Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate: Tue, 20 Sep 2016 16:56:28 +0200
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 20 Sep 2016 16:59:21 +0200
cpufreq: Fix up conversion to hotplug state machine
The function cpufreq_register_driver() returns zero on success and since
commit 27622b061eb4 ("cpufreq: Convert to hotplug state machine")
erroneously a positive number. Due to the "if (x) assume_error" construct
all callers assumed an error and as a consequence the cpu freq kworker
crashes with a NULL pointer dereference.
Reset the return value back to zero in the success case.
Fixes: 27622b061eb4 ("cpufreq: Convert to hotplug state machine")
Reported-by: Borislav Petkov <bp@alien8.de>
Reported-and-tested-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: peterz@infradead.org
Cc: rjw@rjwysocki.net
Link: http://lkml.kernel.org/r/20160920145628.lp2bmq72ip3oiash@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
drivers/cpufreq/cpufreq.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index e0bc632..8b44de4 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -2503,6 +2503,7 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)
if (ret < 0)
goto err_if_unreg;
hp_online = ret;
+ ret = 0;
pr_debug("driver %s up and running\n", driver_data->name);
goto out;
[toc] | [prev] | [next] | [standalone]
| From | Borislav Petkov <bp@alien8.de> |
|---|---|
| Date | 2016-09-20 18:10 +0200 |
| Subject | Re: [tip:smp/hotplug] cpufreq: Fix up conversion to hotplug state machine |
| Message-ID | <sjvMm-5fH-45@gated-at.bofh.it> |
| In reply to | #1487418 |
On Tue, Sep 20, 2016 at 08:07:08AM -0700, tip-bot for Sebastian Andrzej Siewior wrote:
> Commit-ID: 5372e054a1928fe704cf0a5e2e139645a777b50a
> Gitweb: http://git.kernel.org/tip/5372e054a1928fe704cf0a5e2e139645a777b50a
> Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> AuthorDate: Tue, 20 Sep 2016 16:56:28 +0200
> Committer: Thomas Gleixner <tglx@linutronix.de>
> CommitDate: Tue, 20 Sep 2016 16:59:21 +0200
>
> cpufreq: Fix up conversion to hotplug state machine
>
> The function cpufreq_register_driver() returns zero on success and since
> commit 27622b061eb4 ("cpufreq: Convert to hotplug state machine")
> erroneously a positive number. Due to the "if (x) assume_error" construct
> all callers assumed an error and as a consequence the cpu freq kworker
> crashes with a NULL pointer dereference.
>
> Reset the return value back to zero in the success case.
>
> Fixes: 27622b061eb4 ("cpufreq: Convert to hotplug state machine")
> Reported-by: Borislav Petkov <bp@alien8.de>
-and-tested-by: me.
Thanks!
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
[toc] | [prev] | [next] | [standalone]
| From | "Rafael J. Wysocki" <rjw@rjwysocki.net> |
|---|---|
| Date | 2016-09-20 18:20 +0200 |
| Subject | Re: [PATCH] cpufreq: fix up conversion to hotplug state machine |
| Message-ID | <sjvW2-5lT-43@gated-at.bofh.it> |
| In reply to | #1487407 |
On Tuesday, September 20, 2016 04:56:28 PM Sebastian Andrzej Siewior wrote:
> The function cpufreq_register_driver() returns zero on success and since
> commit 27622b061eb4 ("cpufreq: Convert to hotplug state machine")
> erroneously a positive number. Due to the "if (x) assume_error" construct
> all callers assumed an error and things went south.
> This patch resets the return value back to zero in the success case.
>
> Fixes: 27622b061eb4 ("cpufreq: Convert to hotplug state machine")
> Reported-by: Borislav Petkov <bp@alien8.de>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
ACK
> ---
> drivers/cpufreq/cpufreq.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index e0bc632a259e..8b44de4d7438 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -2503,6 +2503,7 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)
> if (ret < 0)
> goto err_if_unreg;
> hp_online = ret;
> + ret = 0;
>
> pr_debug("driver %s up and running\n", driver_data->name);
> goto out;
>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web