Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1530804 > unrolled thread
| Started by | Sebastian Andrzej Siewior <bigeasy@linutronix.de> |
|---|---|
| First post | 2016-11-27 00:20 +0100 |
| Last post | 2016-12-02 01:20 +0100 |
| Articles | 20 on this page of 33 — 9 participants |
Back to article view | Back to linux.kernel
cpu hotplug: convert more drivers (batch #6 and last) Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-27 00:20 +0100
[PATCH 01/22] cpufreq/acpi-cpufreq: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-27 00:20 +0100
Re: [PATCH 01/22] cpufreq/acpi-cpufreq: Convert to hotplug state machine Viresh Kumar <viresh.kumar@linaro.org> - 2016-11-28 06:20 +0100
Re: [PATCH 01/22] cpufreq/acpi-cpufreq: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-28 10:50 +0100
[PATCH 01/22 v2] cpufreq/acpi-cpufreq: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-28 11:00 +0100
Re: [PATCH 01/22 v2] cpufreq/acpi-cpufreq: Convert to hotplug state machine Viresh Kumar <viresh.kumar@linaro.org> - 2016-11-28 11:00 +0100
Re: [PATCH 01/22 v2] cpufreq/acpi-cpufreq: Convert to hotplug state machine "Rafael J. Wysocki" <rafael@kernel.org> - 2016-11-28 13:50 +0100
[PATCH 13/22] iommu/vt-d: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-27 00:20 +0100
[tip:smp/hotplug] iommu/vt-d: Convert to hotplug state machine tip-bot for Anna-Maria Gleixner <tipbot@zytor.com> - 2016-12-02 01:20 +0100
[PATCH 11/22] mm/zswap: Convert dst-mem to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-27 00:20 +0100
[tip:smp/hotplug] mm/zswap: Convert dst-mem to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-12-02 01:20 +0100
[PATCH 19/22] soc/fsl/qbman: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-27 00:20 +0100
[tip:smp/hotplug] soc/fsl/qbman: Convert to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-12-02 01:20 +0100
[PATCH 04/22] idle/intel: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-27 00:20 +0100
Re: [PATCH 04/22] idle/intel: Convert to hotplug state machine Thomas Gleixner <tglx@linutronix.de> - 2016-11-28 18:40 +0100
Re: [PATCH 04/22] idle/intel: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-29 10:50 +0100
[PATCH 04/22 v2] idle/intel: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-29 11:00 +0100
[PATCH 07/22] mm/vmstat: Drop get_online_cpus() from init_cpu_node_state/vmstat_cpu_dead() Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-27 00:20 +0100
Re: [PATCH 07/22] mm/vmstat: Drop get_online_cpus() from init_cpu_node_state/vmstat_cpu_dead() Michal Hocko <mhocko@kernel.org> - 2016-11-28 10:30 +0100
[tip:smp/hotplug] mm/vmstat: Drop get_online_cpus() from init_cpu_node_state/vmstat_cpu_dead() tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-12-02 01:20 +0100
[PATCH 03/22] idle/intel: Remove superfluous SMP fuction call Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-27 00:20 +0100
[PATCH 06/22] tracing/rb: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-27 00:20 +0100
[tip:smp/hotplug] tracing/rb: Convert to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-12-02 01:20 +0100
[linux-next] tracing/rb: NULL pointer dereference at trace_rb_cpu_prepare() Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2016-12-07 12:20 +0100
[PATCH] tracing/rb: init the CPU mask on allocation Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-12-07 14:40 +0100
[tip:smp/hotplug] tracing/rb: Init the CPU mask on allocation tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-12-07 14:50 +0100
Re: [PATCH] tracing/rb: init the CPU mask on allocation Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2016-12-07 15:40 +0100
[PATCH 16/22] arm64/cpuinfo: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-27 00:20 +0100
Re: [PATCH 16/22] arm64/cpuinfo: Convert to hotplug state machine Suzuki K Poulose <suzuki.poulose@arm.com> - 2016-11-29 18:30 +0100
[tip:smp/hotplug] arm64/cpuinfo: Convert to hotplug state machine tip-bot for Anna-Maria Gleixner <tipbot@zytor.com> - 2016-12-02 01:20 +0100
[PATCH 22/22] Remove obsolete cpu hotplug register / unregister functions Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-27 00:20 +0100
[PATCH 18/22] zram: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-27 00:20 +0100
[tip:smp/hotplug] zram: Convert to hotplug state machine tip-bot for Anna-Maria Gleixner <tipbot@zytor.com> - 2016-12-02 01:20 +0100
Page 1 of 2 [1] 2 Next page →
| From | Sebastian Andrzej Siewior <bigeasy@linutronix.de> |
|---|---|
| Date | 2016-11-27 00:20 +0100 |
| Subject | cpu hotplug: convert more drivers (batch #6 and last) |
| Message-ID | <sHUqd-4EY-3@gated-at.bofh.it> |
Another small batch of drivers converted to the new hotplug state engine. The whole series is also available at git://git.kernel.org/pub/scm/linux/kernel/git/bigeasy/hotplug-staging.git smp/hotplug on top of tip/smp/hotplug (which includes last batch and is still on top of v4.9-rc4). Sebastian
[toc] | [next] | [standalone]
| From | Sebastian Andrzej Siewior <bigeasy@linutronix.de> |
|---|---|
| Date | 2016-11-27 00:20 +0100 |
| Subject | [PATCH 01/22] cpufreq/acpi-cpufreq: Convert to hotplug state machine |
| Message-ID | <sHUqe-4EY-25@gated-at.bofh.it> |
| In reply to | #1530804 |
Install the callbacks via the state machine.
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: linux-pm@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
drivers/cpufreq/acpi-cpufreq.c | 93 ++++++++++++++++++++----------------------
1 file changed, 45 insertions(+), 48 deletions(-)
diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
index 297e9128fe9f..2c29cbaca7b5 100644
--- a/drivers/cpufreq/acpi-cpufreq.c
+++ b/drivers/cpufreq/acpi-cpufreq.c
@@ -536,46 +536,33 @@ static void free_acpi_perf_data(void)
free_percpu(acpi_perf_data);
}
-static int boost_notify(struct notifier_block *nb, unsigned long action,
- void *hcpu)
+static int cpufreq_boost_online(unsigned int cpu)
+{
+ const struct cpumask *cpumask;
+
+ cpumask = get_cpu_mask(cpu);
+ /*
+ * On the CPU_UP path we simply keep the boost-disable flag
+ * in sync with the current global state.
+ */
+ boost_set_msrs(acpi_cpufreq_driver.boost_enabled, cpumask);
+ return 0;
+}
+
+static int cpufreq_boost_down_prep(unsigned int cpu)
{
- unsigned cpu = (long)hcpu;
const struct cpumask *cpumask;
cpumask = get_cpu_mask(cpu);
/*
* Clear the boost-disable bit on the CPU_DOWN path so that
- * this cpu cannot block the remaining ones from boosting. On
- * the CPU_UP path we simply keep the boost-disable flag in
- * sync with the current global state.
+ * this cpu cannot block the remaining ones from boosting.
*/
-
- switch (action) {
- case CPU_DOWN_FAILED:
- case CPU_DOWN_FAILED_FROZEN:
- case CPU_ONLINE:
- case CPU_ONLINE_FROZEN:
- boost_set_msrs(acpi_cpufreq_driver.boost_enabled, cpumask);
- break;
-
- case CPU_DOWN_PREPARE:
- case CPU_DOWN_PREPARE_FROZEN:
- boost_set_msrs(1, cpumask);
- break;
-
- default:
- break;
- }
-
- return NOTIFY_OK;
+ boost_set_msrs(1, cpumask);
+ return 0;
}
-
-static struct notifier_block boost_nb = {
- .notifier_call = boost_notify,
-};
-
/*
* acpi_cpufreq_early_init - initialize ACPI P-States library
*
@@ -922,37 +909,47 @@ static struct cpufreq_driver acpi_cpufreq_driver = {
.attr = acpi_cpufreq_attr,
};
+static enum cpuhp_state acpi_cpufreq_online;
+
static void __init acpi_cpufreq_boost_init(void)
{
- if (boot_cpu_has(X86_FEATURE_CPB) || boot_cpu_has(X86_FEATURE_IDA)) {
- msrs = msrs_alloc();
+ int ret;
- if (!msrs)
- return;
+ if (!(boot_cpu_has(X86_FEATURE_CPB) || boot_cpu_has(X86_FEATURE_IDA)))
+ return;
- acpi_cpufreq_driver.set_boost = set_boost;
- acpi_cpufreq_driver.boost_enabled = boost_state(0);
+ msrs = msrs_alloc();
- cpu_notifier_register_begin();
+ if (!msrs)
+ return;
- /* Force all MSRs to the same value */
- boost_set_msrs(acpi_cpufreq_driver.boost_enabled,
- cpu_online_mask);
+ acpi_cpufreq_driver.set_boost = set_boost;
+ acpi_cpufreq_driver.boost_enabled = boost_state(0);
- __register_cpu_notifier(&boost_nb);
-
- cpu_notifier_register_done();
+ /*
+ * This calls the online callback on all online cpu and forces all
+ * MSRs to the same value.
+ */
+ ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "cpufreq/acpi:online",
+ cpufreq_boost_online, cpufreq_boost_down_prep);
+ if (ret < 0) {
+ pr_err("acpi_cpufreq: failed to register hotplug callbacks\n");
+ msrs_free(msrs);
+ return;
}
+ acpi_cpufreq_online = ret;
}
static void acpi_cpufreq_boost_exit(void)
{
- if (msrs) {
- unregister_cpu_notifier(&boost_nb);
+ if (!msrs)
+ return;
- msrs_free(msrs);
- msrs = NULL;
- }
+ if (acpi_cpufreq_online >= 0)
+ cpuhp_remove_state_nocalls(acpi_cpufreq_online);
+
+ msrs_free(msrs);
+ msrs = NULL;
}
static int __init acpi_cpufreq_init(void)
--
2.10.2
[toc] | [prev] | [next] | [standalone]
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2016-11-28 06:20 +0100 |
| Subject | Re: [PATCH 01/22] cpufreq/acpi-cpufreq: Convert to hotplug state machine |
| Message-ID | <sImwa-66e-11@gated-at.bofh.it> |
| In reply to | #1530805 |
On 27-11-16, 00:13, Sebastian Andrzej Siewior wrote:
> Install the callbacks via the state machine.
>
> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> Cc: Viresh Kumar <viresh.kumar@linaro.org>
> Cc: linux-pm@vger.kernel.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
> drivers/cpufreq/acpi-cpufreq.c | 93 ++++++++++++++++++++----------------------
> 1 file changed, 45 insertions(+), 48 deletions(-)
>
> diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
> index 297e9128fe9f..2c29cbaca7b5 100644
> --- a/drivers/cpufreq/acpi-cpufreq.c
> +++ b/drivers/cpufreq/acpi-cpufreq.c
> @@ -536,46 +536,33 @@ static void free_acpi_perf_data(void)
> free_percpu(acpi_perf_data);
> }
>
> -static int boost_notify(struct notifier_block *nb, unsigned long action,
> - void *hcpu)
> +static int cpufreq_boost_online(unsigned int cpu)
> +{
> + const struct cpumask *cpumask;
> +
> + cpumask = get_cpu_mask(cpu);
> + /*
> + * On the CPU_UP path we simply keep the boost-disable flag
> + * in sync with the current global state.
> + */
> + boost_set_msrs(acpi_cpufreq_driver.boost_enabled, cpumask);
> + return 0;
> +}
> +
> +static int cpufreq_boost_down_prep(unsigned int cpu)
> {
> - unsigned cpu = (long)hcpu;
> const struct cpumask *cpumask;
>
> cpumask = get_cpu_mask(cpu);
>
> /*
> * Clear the boost-disable bit on the CPU_DOWN path so that
> - * this cpu cannot block the remaining ones from boosting. On
> - * the CPU_UP path we simply keep the boost-disable flag in
> - * sync with the current global state.
> + * this cpu cannot block the remaining ones from boosting.
> */
> -
> - switch (action) {
> - case CPU_DOWN_FAILED:
> - case CPU_DOWN_FAILED_FROZEN:
> - case CPU_ONLINE:
> - case CPU_ONLINE_FROZEN:
> - boost_set_msrs(acpi_cpufreq_driver.boost_enabled, cpumask);
> - break;
> -
> - case CPU_DOWN_PREPARE:
> - case CPU_DOWN_PREPARE_FROZEN:
> - boost_set_msrs(1, cpumask);
> - break;
> -
> - default:
> - break;
> - }
> -
> - return NOTIFY_OK;
> + boost_set_msrs(1, cpumask);
> + return 0;
> }
>
> -
> -static struct notifier_block boost_nb = {
> - .notifier_call = boost_notify,
> -};
> -
> /*
> * acpi_cpufreq_early_init - initialize ACPI P-States library
> *
> @@ -922,37 +909,47 @@ static struct cpufreq_driver acpi_cpufreq_driver = {
> .attr = acpi_cpufreq_attr,
> };
>
> +static enum cpuhp_state acpi_cpufreq_online;
> +
> static void __init acpi_cpufreq_boost_init(void)
> {
> - if (boot_cpu_has(X86_FEATURE_CPB) || boot_cpu_has(X86_FEATURE_IDA)) {
> - msrs = msrs_alloc();
> + int ret;
>
> - if (!msrs)
> - return;
> + if (!(boot_cpu_has(X86_FEATURE_CPB) || boot_cpu_has(X86_FEATURE_IDA)))
> + return;
>
> - acpi_cpufreq_driver.set_boost = set_boost;
> - acpi_cpufreq_driver.boost_enabled = boost_state(0);
> + msrs = msrs_alloc();
>
> - cpu_notifier_register_begin();
> + if (!msrs)
> + return;
>
> - /* Force all MSRs to the same value */
> - boost_set_msrs(acpi_cpufreq_driver.boost_enabled,
> - cpu_online_mask);
Why isn't this required anymore ?
> + acpi_cpufreq_driver.set_boost = set_boost;
> + acpi_cpufreq_driver.boost_enabled = boost_state(0);
>
> - __register_cpu_notifier(&boost_nb);
> -
> - cpu_notifier_register_done();
> + /*
> + * This calls the online callback on all online cpu and forces all
> + * MSRs to the same value.
> + */
> + ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "cpufreq/acpi:online",
> + cpufreq_boost_online, cpufreq_boost_down_prep);
> + if (ret < 0) {
> + pr_err("acpi_cpufreq: failed to register hotplug callbacks\n");
> + msrs_free(msrs);
If 'msrs = NULL' is required to be done in the _exit() routine, then it should
be done here as well. Right?
> + return;
> }
> + acpi_cpufreq_online = ret;
> }
>
> static void acpi_cpufreq_boost_exit(void)
> {
> - if (msrs) {
> - unregister_cpu_notifier(&boost_nb);
> + if (!msrs)
> + return;
>
> - msrs_free(msrs);
> - msrs = NULL;
> - }
> + if (acpi_cpufreq_online >= 0)
> + cpuhp_remove_state_nocalls(acpi_cpufreq_online);
> +
> + msrs_free(msrs);
> + msrs = NULL;
> }
>
> static int __init acpi_cpufreq_init(void)
> --
> 2.10.2
--
viresh
[toc] | [prev] | [next] | [standalone]
| From | Sebastian Andrzej Siewior <bigeasy@linutronix.de> |
|---|---|
| Date | 2016-11-28 10:50 +0100 |
| Subject | Re: [PATCH 01/22] cpufreq/acpi-cpufreq: Convert to hotplug state machine |
| Message-ID | <sIqJs-lL-25@gated-at.bofh.it> |
| In reply to | #1531040 |
On 2016-11-28 10:45:20 [+0530], Viresh Kumar wrote:
> > diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
> > index 297e9128fe9f..2c29cbaca7b5 100644
> > --- a/drivers/cpufreq/acpi-cpufreq.c
> > +++ b/drivers/cpufreq/acpi-cpufreq.c
> > @@ -922,37 +909,47 @@ static struct cpufreq_driver acpi_cpufreq_driver = {
> > .attr = acpi_cpufreq_attr,
> > };
> >
> > +static enum cpuhp_state acpi_cpufreq_online;
> > +
> > static void __init acpi_cpufreq_boost_init(void)
> > {
> > - if (boot_cpu_has(X86_FEATURE_CPB) || boot_cpu_has(X86_FEATURE_IDA)) {
> > - msrs = msrs_alloc();
> > + int ret;
> >
> > - if (!msrs)
> > - return;
> > + if (!(boot_cpu_has(X86_FEATURE_CPB) || boot_cpu_has(X86_FEATURE_IDA)))
> > + return;
> >
> > - acpi_cpufreq_driver.set_boost = set_boost;
> > - acpi_cpufreq_driver.boost_enabled = boost_state(0);
> > + msrs = msrs_alloc();
> >
> > - cpu_notifier_register_begin();
> > + if (!msrs)
> > + return;
> >
> > - /* Force all MSRs to the same value */
> > - boost_set_msrs(acpi_cpufreq_driver.boost_enabled,
> > - cpu_online_mask);
>
> Why isn't this required anymore ?
Later there is cpuhp_setup_state() which invokes the online callback
(cpufreq_boost_online) which is doing this.
> > + acpi_cpufreq_driver.set_boost = set_boost;
> > + acpi_cpufreq_driver.boost_enabled = boost_state(0);
> >
> > - __register_cpu_notifier(&boost_nb);
> > -
> > - cpu_notifier_register_done();
> > + /*
> > + * This calls the online callback on all online cpu and forces all
> > + * MSRs to the same value.
> > + */
> > + ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "cpufreq/acpi:online",
> > + cpufreq_boost_online, cpufreq_boost_down_prep);
> > + if (ret < 0) {
> > + pr_err("acpi_cpufreq: failed to register hotplug callbacks\n");
> > + msrs_free(msrs);
>
> If 'msrs = NULL' is required to be done in the _exit() routine, then it should
> be done here as well. Right?
It is not required in the exit path, it is just needed here. It is gone
in the following patch anyway but I will post a fixed version.
> > + return;
> > }
> > + acpi_cpufreq_online = ret;
> > }
> >
> > static void acpi_cpufreq_boost_exit(void)
> > {
> > - if (msrs) {
> > - unregister_cpu_notifier(&boost_nb);
> > + if (!msrs)
> > + return;
> >
> > - msrs_free(msrs);
> > - msrs = NULL;
> > - }
> > + if (acpi_cpufreq_online >= 0)
> > + cpuhp_remove_state_nocalls(acpi_cpufreq_online);
> > +
> > + msrs_free(msrs);
> > + msrs = NULL;
> > }
> >
> > static int __init acpi_cpufreq_init(void)
> > --
> > 2.10.2
Sebastian
[toc] | [prev] | [next] | [standalone]
| From | Sebastian Andrzej Siewior <bigeasy@linutronix.de> |
|---|---|
| Date | 2016-11-28 11:00 +0100 |
| Subject | [PATCH 01/22 v2] cpufreq/acpi-cpufreq: Convert to hotplug state machine |
| Message-ID | <sIqT8-oY-17@gated-at.bofh.it> |
| In reply to | #1531166 |
Install the callbacks via the state machine.
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: linux-pm@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
v1…v2: set msrs to NULL on error during init.
drivers/cpufreq/acpi-cpufreq.c | 92 ++++++++++++++++++++---------------------
1 file changed, 45 insertions(+), 47 deletions(-)
--- a/drivers/cpufreq/acpi-cpufreq.c
+++ b/drivers/cpufreq/acpi-cpufreq.c
@@ -536,46 +536,33 @@ static void free_acpi_perf_data(void)
free_percpu(acpi_perf_data);
}
-static int boost_notify(struct notifier_block *nb, unsigned long action,
- void *hcpu)
+static int cpufreq_boost_online(unsigned int cpu)
{
- unsigned cpu = (long)hcpu;
const struct cpumask *cpumask;
cpumask = get_cpu_mask(cpu);
-
/*
- * Clear the boost-disable bit on the CPU_DOWN path so that
- * this cpu cannot block the remaining ones from boosting. On
- * the CPU_UP path we simply keep the boost-disable flag in
- * sync with the current global state.
+ * On the CPU_UP path we simply keep the boost-disable flag
+ * in sync with the current global state.
*/
+ boost_set_msrs(acpi_cpufreq_driver.boost_enabled, cpumask);
+ return 0;
+}
- switch (action) {
- case CPU_DOWN_FAILED:
- case CPU_DOWN_FAILED_FROZEN:
- case CPU_ONLINE:
- case CPU_ONLINE_FROZEN:
- boost_set_msrs(acpi_cpufreq_driver.boost_enabled, cpumask);
- break;
-
- case CPU_DOWN_PREPARE:
- case CPU_DOWN_PREPARE_FROZEN:
- boost_set_msrs(1, cpumask);
- break;
+static int cpufreq_boost_down_prep(unsigned int cpu)
+{
+ const struct cpumask *cpumask;
- default:
- break;
- }
+ cpumask = get_cpu_mask(cpu);
- return NOTIFY_OK;
+ /*
+ * Clear the boost-disable bit on the CPU_DOWN path so that
+ * this cpu cannot block the remaining ones from boosting.
+ */
+ boost_set_msrs(1, cpumask);
+ return 0;
}
-
-static struct notifier_block boost_nb = {
- .notifier_call = boost_notify,
-};
-
/*
* acpi_cpufreq_early_init - initialize ACPI P-States library
*
@@ -922,37 +909,48 @@ static struct cpufreq_driver acpi_cpufre
.attr = acpi_cpufreq_attr,
};
+static enum cpuhp_state acpi_cpufreq_online;
+
static void __init acpi_cpufreq_boost_init(void)
{
- if (boot_cpu_has(X86_FEATURE_CPB) || boot_cpu_has(X86_FEATURE_IDA)) {
- msrs = msrs_alloc();
+ int ret;
- if (!msrs)
- return;
+ if (!(boot_cpu_has(X86_FEATURE_CPB) || boot_cpu_has(X86_FEATURE_IDA)))
+ return;
- acpi_cpufreq_driver.set_boost = set_boost;
- acpi_cpufreq_driver.boost_enabled = boost_state(0);
+ msrs = msrs_alloc();
- cpu_notifier_register_begin();
+ if (!msrs)
+ return;
- /* Force all MSRs to the same value */
- boost_set_msrs(acpi_cpufreq_driver.boost_enabled,
- cpu_online_mask);
+ acpi_cpufreq_driver.set_boost = set_boost;
+ acpi_cpufreq_driver.boost_enabled = boost_state(0);
- __register_cpu_notifier(&boost_nb);
-
- cpu_notifier_register_done();
+ /*
+ * This calls the online callback on all online cpu and forces all
+ * MSRs to the same value.
+ */
+ ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "cpufreq/acpi:online",
+ cpufreq_boost_online, cpufreq_boost_down_prep);
+ if (ret < 0) {
+ pr_err("acpi_cpufreq: failed to register hotplug callbacks\n");
+ msrs_free(msrs);
+ msrs = NULL;
+ return;
}
+ acpi_cpufreq_online = ret;
}
static void acpi_cpufreq_boost_exit(void)
{
- if (msrs) {
- unregister_cpu_notifier(&boost_nb);
+ if (!msrs)
+ return;
- msrs_free(msrs);
- msrs = NULL;
- }
+ if (acpi_cpufreq_online >= 0)
+ cpuhp_remove_state_nocalls(acpi_cpufreq_online);
+
+ msrs_free(msrs);
+ msrs = NULL;
}
static int __init acpi_cpufreq_init(void)
[toc] | [prev] | [next] | [standalone]
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2016-11-28 11:00 +0100 |
| Subject | Re: [PATCH 01/22 v2] cpufreq/acpi-cpufreq: Convert to hotplug state machine |
| Message-ID | <sIqT8-oY-25@gated-at.bofh.it> |
| In reply to | #1531169 |
On 28-11-16, 10:51, Sebastian Andrzej Siewior wrote: > Install the callbacks via the state machine. > > Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net> > Cc: Viresh Kumar <viresh.kumar@linaro.org> > Cc: linux-pm@vger.kernel.org > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> > --- > v1…v2: set msrs to NULL on error during init. > > drivers/cpufreq/acpi-cpufreq.c | 92 ++++++++++++++++++++--------------------- > 1 file changed, 45 insertions(+), 47 deletions(-) Acked-by: Viresh Kumar <viresh.kumar@linaro.org> -- viresh
[toc] | [prev] | [next] | [standalone]
| From | "Rafael J. Wysocki" <rafael@kernel.org> |
|---|---|
| Date | 2016-11-28 13:50 +0100 |
| Subject | Re: [PATCH 01/22 v2] cpufreq/acpi-cpufreq: Convert to hotplug state machine |
| Message-ID | <sItxD-29e-3@gated-at.bofh.it> |
| In reply to | #1531169 |
On Mon, Nov 28, 2016 at 10:51 AM, Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote: > Install the callbacks via the state machine. > > Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net> > Cc: Viresh Kumar <viresh.kumar@linaro.org> > Cc: linux-pm@vger.kernel.org > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> > --- > v1…v2: set msrs to NULL on error during init. OK Let me route this and the [2/22] through the PM tree (they are first in the series anyway). Thanks, Rafael
[toc] | [prev] | [next] | [standalone]
| From | Sebastian Andrzej Siewior <bigeasy@linutronix.de> |
|---|---|
| Date | 2016-11-27 00:20 +0100 |
| Subject | [PATCH 13/22] iommu/vt-d: Convert to hotplug state machine |
| Message-ID | <sHUqe-4EY-37@gated-at.bofh.it> |
| In reply to | #1530804 |
From: Anna-Maria Gleixner <anna-maria@linutronix.de>
Install the callbacks via the state machine.
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: iommu@lists.linux-foundation.org
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
drivers/iommu/intel-iommu.c | 24 ++++++------------------
include/linux/cpuhotplug.h | 1 +
2 files changed, 7 insertions(+), 18 deletions(-)
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index a4407eabf0e6..fd7962560e56 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -4665,25 +4665,13 @@ static void free_all_cpu_cached_iovas(unsigned int cpu)
}
}
-static int intel_iommu_cpu_notifier(struct notifier_block *nfb,
- unsigned long action, void *v)
+static int intel_iommu_cpu_dead(unsigned int cpu)
{
- unsigned int cpu = (unsigned long)v;
-
- switch (action) {
- case CPU_DEAD:
- case CPU_DEAD_FROZEN:
- free_all_cpu_cached_iovas(cpu);
- flush_unmaps_timeout(cpu);
- break;
- }
- return NOTIFY_OK;
+ free_all_cpu_cached_iovas(cpu);
+ flush_unmaps_timeout(cpu);
+ return 0;
}
-static struct notifier_block intel_iommu_cpu_nb = {
- .notifier_call = intel_iommu_cpu_notifier,
-};
-
static ssize_t intel_iommu_show_version(struct device *dev,
struct device_attribute *attr,
char *buf)
@@ -4832,8 +4820,8 @@ int __init intel_iommu_init(void)
bus_register_notifier(&pci_bus_type, &device_nb);
if (si_domain && !hw_pass_through)
register_memory_notifier(&intel_iommu_memory_nb);
- register_hotcpu_notifier(&intel_iommu_cpu_nb);
-
+ cpuhp_setup_state(CPUHP_IOMMU_INTEL_DEAD, "iommu/intel:dead", NULL,
+ intel_iommu_cpu_dead);
intel_iommu_enabled = 1;
return 0;
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
index c7d0d76ef0ee..853f8176594d 100644
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -40,6 +40,7 @@ enum cpuhp_state {
CPUHP_PAGE_ALLOC_DEAD,
CPUHP_NET_DEV_DEAD,
CPUHP_PCI_XGENE_DEAD,
+ CPUHP_IOMMU_INTEL_DEAD,
CPUHP_WORKQUEUE_PREP,
CPUHP_POWER_NUMA_PREPARE,
CPUHP_HRTIMERS_PREPARE,
--
2.10.2
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Anna-Maria Gleixner <tipbot@zytor.com> |
|---|---|
| Date | 2016-12-02 01:20 +0100 |
| Subject | [tip:smp/hotplug] iommu/vt-d: Convert to hotplug state machine |
| Message-ID | <sJJK2-4sD-39@gated-at.bofh.it> |
| In reply to | #1530806 |
Commit-ID: 21647615db288d9dacad0de6a5df846b39d51bea
Gitweb: http://git.kernel.org/tip/21647615db288d9dacad0de6a5df846b39d51bea
Author: Anna-Maria Gleixner <anna-maria@linutronix.de>
AuthorDate: Sun, 27 Nov 2016 00:13:41 +0100
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 2 Dec 2016 00:52:37 +0100
iommu/vt-d: Convert to hotplug state machine
Install the callbacks via the state machine.
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: iommu@lists.linux-foundation.org
Cc: rt@linutronix.de
Cc: David Woodhouse <dwmw2@infradead.org>
Link: http://lkml.kernel.org/r/20161126231350.10321-14-bigeasy@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
drivers/iommu/intel-iommu.c | 24 ++++++------------------
include/linux/cpuhotplug.h | 1 +
2 files changed, 7 insertions(+), 18 deletions(-)
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index a4407ea..fd79625 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -4665,25 +4665,13 @@ static void free_all_cpu_cached_iovas(unsigned int cpu)
}
}
-static int intel_iommu_cpu_notifier(struct notifier_block *nfb,
- unsigned long action, void *v)
+static int intel_iommu_cpu_dead(unsigned int cpu)
{
- unsigned int cpu = (unsigned long)v;
-
- switch (action) {
- case CPU_DEAD:
- case CPU_DEAD_FROZEN:
- free_all_cpu_cached_iovas(cpu);
- flush_unmaps_timeout(cpu);
- break;
- }
- return NOTIFY_OK;
+ free_all_cpu_cached_iovas(cpu);
+ flush_unmaps_timeout(cpu);
+ return 0;
}
-static struct notifier_block intel_iommu_cpu_nb = {
- .notifier_call = intel_iommu_cpu_notifier,
-};
-
static ssize_t intel_iommu_show_version(struct device *dev,
struct device_attribute *attr,
char *buf)
@@ -4832,8 +4820,8 @@ int __init intel_iommu_init(void)
bus_register_notifier(&pci_bus_type, &device_nb);
if (si_domain && !hw_pass_through)
register_memory_notifier(&intel_iommu_memory_nb);
- register_hotcpu_notifier(&intel_iommu_cpu_nb);
-
+ cpuhp_setup_state(CPUHP_IOMMU_INTEL_DEAD, "iommu/intel:dead", NULL,
+ intel_iommu_cpu_dead);
intel_iommu_enabled = 1;
return 0;
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
index c7d0d76..853f817 100644
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -40,6 +40,7 @@ enum cpuhp_state {
CPUHP_PAGE_ALLOC_DEAD,
CPUHP_NET_DEV_DEAD,
CPUHP_PCI_XGENE_DEAD,
+ CPUHP_IOMMU_INTEL_DEAD,
CPUHP_WORKQUEUE_PREP,
CPUHP_POWER_NUMA_PREPARE,
CPUHP_HRTIMERS_PREPARE,
[toc] | [prev] | [next] | [standalone]
| From | Sebastian Andrzej Siewior <bigeasy@linutronix.de> |
|---|---|
| Date | 2016-11-27 00:20 +0100 |
| Subject | [PATCH 11/22] mm/zswap: Convert dst-mem to hotplug state machine |
| Message-ID | <sHUqe-4EY-23@gated-at.bofh.it> |
| In reply to | #1530804 |
Install the callbacks via the state machine and let the core invoke
the callbacks on the already online CPUs.
Cc: Seth Jennings <sjenning@redhat.com>
Cc: linux-mm@kvack.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
include/linux/cpuhotplug.h | 1 +
mm/zswap.c | 75 +++++++++++-----------------------------------
2 files changed, 19 insertions(+), 57 deletions(-)
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
index 9f29dd996088..62f51a4e8676 100644
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -65,6 +65,7 @@ enum cpuhp_state {
CPUHP_ARM_BL_PREPARE,
CPUHP_TRACE_RB_PREPARE,
CPUHP_MM_ZS_PREPARE,
+ CPUHP_MM_ZSWP_MEM_PREPARE,
CPUHP_TIMERS_DEAD,
CPUHP_NOTF_ERR_INJ_PREPARE,
CPUHP_MIPS_SOC_PREPARE,
diff --git a/mm/zswap.c b/mm/zswap.c
index 275b22cc8df4..b13aa5706348 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -352,70 +352,28 @@ static struct zswap_entry *zswap_entry_find_get(struct rb_root *root,
**********************************/
static DEFINE_PER_CPU(u8 *, zswap_dstmem);
-static int __zswap_cpu_dstmem_notifier(unsigned long action, unsigned long cpu)
+static int zswap_dstmem_prepare(unsigned int cpu)
{
u8 *dst;
- switch (action) {
- case CPU_UP_PREPARE:
- dst = kmalloc_node(PAGE_SIZE * 2, GFP_KERNEL, cpu_to_node(cpu));
- if (!dst) {
- pr_err("can't allocate compressor buffer\n");
- return NOTIFY_BAD;
- }
- per_cpu(zswap_dstmem, cpu) = dst;
- break;
- case CPU_DEAD:
- case CPU_UP_CANCELED:
- dst = per_cpu(zswap_dstmem, cpu);
- kfree(dst);
- per_cpu(zswap_dstmem, cpu) = NULL;
- break;
- default:
- break;
+ dst = kmalloc_node(PAGE_SIZE * 2, GFP_KERNEL, cpu_to_node(cpu));
+ if (!dst) {
+ pr_err("can't allocate compressor buffer\n");
+ return -ENOMEM;
}
- return NOTIFY_OK;
-}
-
-static int zswap_cpu_dstmem_notifier(struct notifier_block *nb,
- unsigned long action, void *pcpu)
-{
- return __zswap_cpu_dstmem_notifier(action, (unsigned long)pcpu);
-}
-
-static struct notifier_block zswap_dstmem_notifier = {
- .notifier_call = zswap_cpu_dstmem_notifier,
-};
-
-static int __init zswap_cpu_dstmem_init(void)
-{
- unsigned long cpu;
-
- cpu_notifier_register_begin();
- for_each_online_cpu(cpu)
- if (__zswap_cpu_dstmem_notifier(CPU_UP_PREPARE, cpu) ==
- NOTIFY_BAD)
- goto cleanup;
- __register_cpu_notifier(&zswap_dstmem_notifier);
- cpu_notifier_register_done();
+ per_cpu(zswap_dstmem, cpu) = dst;
return 0;
-
-cleanup:
- for_each_online_cpu(cpu)
- __zswap_cpu_dstmem_notifier(CPU_UP_CANCELED, cpu);
- cpu_notifier_register_done();
- return -ENOMEM;
}
-static void zswap_cpu_dstmem_destroy(void)
+static int zswap_dstmem_dead(unsigned int cpu)
{
- unsigned long cpu;
+ u8 *dst;
- cpu_notifier_register_begin();
- for_each_online_cpu(cpu)
- __zswap_cpu_dstmem_notifier(CPU_UP_CANCELED, cpu);
- __unregister_cpu_notifier(&zswap_dstmem_notifier);
- cpu_notifier_register_done();
+ dst = per_cpu(zswap_dstmem, cpu);
+ kfree(dst);
+ per_cpu(zswap_dstmem, cpu) = NULL;
+
+ return 0;
}
static int __zswap_cpu_comp_notifier(struct zswap_pool *pool,
@@ -1238,6 +1196,7 @@ static void __exit zswap_debugfs_exit(void) { }
static int __init init_zswap(void)
{
struct zswap_pool *pool;
+ int ret;
zswap_init_started = true;
@@ -1246,7 +1205,9 @@ static int __init init_zswap(void)
goto cache_fail;
}
- if (zswap_cpu_dstmem_init()) {
+ ret = cpuhp_setup_state(CPUHP_MM_ZSWP_MEM_PREPARE, "mm/zswap:prepare",
+ zswap_dstmem_prepare, zswap_dstmem_dead);
+ if (ret) {
pr_err("dstmem alloc failed\n");
goto dstmem_fail;
}
@@ -1267,7 +1228,7 @@ static int __init init_zswap(void)
return 0;
pool_fail:
- zswap_cpu_dstmem_destroy();
+ cpuhp_remove_state(CPUHP_MM_ZSWP_MEM_PREPARE);
dstmem_fail:
zswap_entry_cache_destroy();
cache_fail:
--
2.10.2
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> |
|---|---|
| Date | 2016-12-02 01:20 +0100 |
| Subject | [tip:smp/hotplug] mm/zswap: Convert dst-mem to hotplug state machine |
| Message-ID | <sJJK2-4sD-33@gated-at.bofh.it> |
| In reply to | #1530807 |
Commit-ID: ad7ed7708db9ff388450935645816d44bf08a56d
Gitweb: http://git.kernel.org/tip/ad7ed7708db9ff388450935645816d44bf08a56d
Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate: Sun, 27 Nov 2016 00:13:39 +0100
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 2 Dec 2016 00:52:36 +0100
mm/zswap: Convert dst-mem to hotplug state machine
Install the callbacks via the state machine and let the core invoke
the callbacks on the already online CPUs.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: linux-mm@kvack.org
Cc: Seth Jennings <sjenning@redhat.com>
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/20161126231350.10321-12-bigeasy@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
include/linux/cpuhotplug.h | 1 +
mm/zswap.c | 73 +++++++++++-----------------------------------
2 files changed, 18 insertions(+), 56 deletions(-)
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
index 9f29dd9..62f51a4 100644
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -65,6 +65,7 @@ enum cpuhp_state {
CPUHP_ARM_BL_PREPARE,
CPUHP_TRACE_RB_PREPARE,
CPUHP_MM_ZS_PREPARE,
+ CPUHP_MM_ZSWP_MEM_PREPARE,
CPUHP_TIMERS_DEAD,
CPUHP_NOTF_ERR_INJ_PREPARE,
CPUHP_MIPS_SOC_PREPARE,
diff --git a/mm/zswap.c b/mm/zswap.c
index 275b22c..b13aa57 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -352,70 +352,28 @@ static struct zswap_entry *zswap_entry_find_get(struct rb_root *root,
**********************************/
static DEFINE_PER_CPU(u8 *, zswap_dstmem);
-static int __zswap_cpu_dstmem_notifier(unsigned long action, unsigned long cpu)
+static int zswap_dstmem_prepare(unsigned int cpu)
{
u8 *dst;
- switch (action) {
- case CPU_UP_PREPARE:
- dst = kmalloc_node(PAGE_SIZE * 2, GFP_KERNEL, cpu_to_node(cpu));
- if (!dst) {
- pr_err("can't allocate compressor buffer\n");
- return NOTIFY_BAD;
- }
- per_cpu(zswap_dstmem, cpu) = dst;
- break;
- case CPU_DEAD:
- case CPU_UP_CANCELED:
- dst = per_cpu(zswap_dstmem, cpu);
- kfree(dst);
- per_cpu(zswap_dstmem, cpu) = NULL;
- break;
- default:
- break;
+ dst = kmalloc_node(PAGE_SIZE * 2, GFP_KERNEL, cpu_to_node(cpu));
+ if (!dst) {
+ pr_err("can't allocate compressor buffer\n");
+ return -ENOMEM;
}
- return NOTIFY_OK;
+ per_cpu(zswap_dstmem, cpu) = dst;
+ return 0;
}
-static int zswap_cpu_dstmem_notifier(struct notifier_block *nb,
- unsigned long action, void *pcpu)
+static int zswap_dstmem_dead(unsigned int cpu)
{
- return __zswap_cpu_dstmem_notifier(action, (unsigned long)pcpu);
-}
-
-static struct notifier_block zswap_dstmem_notifier = {
- .notifier_call = zswap_cpu_dstmem_notifier,
-};
+ u8 *dst;
-static int __init zswap_cpu_dstmem_init(void)
-{
- unsigned long cpu;
+ dst = per_cpu(zswap_dstmem, cpu);
+ kfree(dst);
+ per_cpu(zswap_dstmem, cpu) = NULL;
- cpu_notifier_register_begin();
- for_each_online_cpu(cpu)
- if (__zswap_cpu_dstmem_notifier(CPU_UP_PREPARE, cpu) ==
- NOTIFY_BAD)
- goto cleanup;
- __register_cpu_notifier(&zswap_dstmem_notifier);
- cpu_notifier_register_done();
return 0;
-
-cleanup:
- for_each_online_cpu(cpu)
- __zswap_cpu_dstmem_notifier(CPU_UP_CANCELED, cpu);
- cpu_notifier_register_done();
- return -ENOMEM;
-}
-
-static void zswap_cpu_dstmem_destroy(void)
-{
- unsigned long cpu;
-
- cpu_notifier_register_begin();
- for_each_online_cpu(cpu)
- __zswap_cpu_dstmem_notifier(CPU_UP_CANCELED, cpu);
- __unregister_cpu_notifier(&zswap_dstmem_notifier);
- cpu_notifier_register_done();
}
static int __zswap_cpu_comp_notifier(struct zswap_pool *pool,
@@ -1238,6 +1196,7 @@ static void __exit zswap_debugfs_exit(void) { }
static int __init init_zswap(void)
{
struct zswap_pool *pool;
+ int ret;
zswap_init_started = true;
@@ -1246,7 +1205,9 @@ static int __init init_zswap(void)
goto cache_fail;
}
- if (zswap_cpu_dstmem_init()) {
+ ret = cpuhp_setup_state(CPUHP_MM_ZSWP_MEM_PREPARE, "mm/zswap:prepare",
+ zswap_dstmem_prepare, zswap_dstmem_dead);
+ if (ret) {
pr_err("dstmem alloc failed\n");
goto dstmem_fail;
}
@@ -1267,7 +1228,7 @@ static int __init init_zswap(void)
return 0;
pool_fail:
- zswap_cpu_dstmem_destroy();
+ cpuhp_remove_state(CPUHP_MM_ZSWP_MEM_PREPARE);
dstmem_fail:
zswap_entry_cache_destroy();
cache_fail:
[toc] | [prev] | [next] | [standalone]
| From | Sebastian Andrzej Siewior <bigeasy@linutronix.de> |
|---|---|
| Date | 2016-11-27 00:20 +0100 |
| Subject | [PATCH 19/22] soc/fsl/qbman: Convert to hotplug state machine |
| Message-ID | <sHUqe-4EY-33@gated-at.bofh.it> |
| In reply to | #1530804 |
Install the callbacks via the state machine.
Cc: Roy Pledge <roy.pledge@nxp.com>
Cc: Scott Wood <oss@buserror.net>
Cc: Claudiu Manoil <claudiu.manoil@nxp.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
drivers/soc/fsl/qbman/bman_portal.c | 46 +++++++++++++------------------------
1 file changed, 16 insertions(+), 30 deletions(-)
diff --git a/drivers/soc/fsl/qbman/bman_portal.c b/drivers/soc/fsl/qbman/bman_portal.c
index 6579cc18811a..986f64690e6e 100644
--- a/drivers/soc/fsl/qbman/bman_portal.c
+++ b/drivers/soc/fsl/qbman/bman_portal.c
@@ -53,58 +53,38 @@ static struct bman_portal *init_pcfg(struct bm_portal_config *pcfg)
return p;
}
-static void bman_offline_cpu(unsigned int cpu)
+static int bman_offline_cpu(unsigned int cpu)
{
struct bman_portal *p = affine_bportals[cpu];
const struct bm_portal_config *pcfg;
if (!p)
- return;
+ return 0;
pcfg = bman_get_bm_portal_config(p);
if (!pcfg)
- return;
+ return 0;
irq_set_affinity(pcfg->irq, cpumask_of(0));
+ return 0;
}
-static void bman_online_cpu(unsigned int cpu)
+static int bman_online_cpu(unsigned int cpu)
{
struct bman_portal *p = affine_bportals[cpu];
const struct bm_portal_config *pcfg;
if (!p)
- return;
+ return 0;
pcfg = bman_get_bm_portal_config(p);
if (!pcfg)
- return;
+ return 0;
irq_set_affinity(pcfg->irq, cpumask_of(cpu));
+ return 0;
}
-static int bman_hotplug_cpu_callback(struct notifier_block *nfb,
- unsigned long action, void *hcpu)
-{
- unsigned int cpu = (unsigned long)hcpu;
-
- switch (action) {
- case CPU_ONLINE:
- case CPU_ONLINE_FROZEN:
- bman_online_cpu(cpu);
- break;
- case CPU_DOWN_PREPARE:
- case CPU_DOWN_PREPARE_FROZEN:
- bman_offline_cpu(cpu);
- }
-
- return NOTIFY_OK;
-}
-
-static struct notifier_block bman_hotplug_cpu_notifier = {
- .notifier_call = bman_hotplug_cpu_callback,
-};
-
static int bman_portal_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -210,8 +190,14 @@ static int __init bman_portal_driver_register(struct platform_driver *drv)
if (ret < 0)
return ret;
- register_hotcpu_notifier(&bman_hotplug_cpu_notifier);
-
+ ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN,
+ "soc/qbman_portal:online",
+ bman_online_cpu, bman_offline_cpu);
+ if (ret < 0) {
+ pr_err("bman: failed to register hotplug callbacks.\n");
+ platform_driver_unregister(drv);
+ return ret;
+ }
return 0;
}
--
2.10.2
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> |
|---|---|
| Date | 2016-12-02 01:20 +0100 |
| Subject | [tip:smp/hotplug] soc/fsl/qbman: Convert to hotplug state machine |
| Message-ID | <sJJK2-4sD-37@gated-at.bofh.it> |
| In reply to | #1530809 |
Commit-ID: fce77c3562eccdd8002c9c7947f00af70e00a375
Gitweb: http://git.kernel.org/tip/fce77c3562eccdd8002c9c7947f00af70e00a375
Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate: Sun, 27 Nov 2016 00:13:47 +0100
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 2 Dec 2016 00:52:39 +0100
soc/fsl/qbman: Convert to hotplug state machine
Install the callbacks via the state machine.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Scott Wood <oss@buserror.net>
Cc: Claudiu Manoil <claudiu.manoil@nxp.com>
Cc: rt@linutronix.de
Cc: Roy Pledge <roy.pledge@nxp.com>
Link: http://lkml.kernel.org/r/20161126231350.10321-20-bigeasy@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
drivers/soc/fsl/qbman/bman_portal.c | 46 +++++++++++++------------------------
1 file changed, 16 insertions(+), 30 deletions(-)
diff --git a/drivers/soc/fsl/qbman/bman_portal.c b/drivers/soc/fsl/qbman/bman_portal.c
index 6579cc1..986f646 100644
--- a/drivers/soc/fsl/qbman/bman_portal.c
+++ b/drivers/soc/fsl/qbman/bman_portal.c
@@ -53,58 +53,38 @@ static struct bman_portal *init_pcfg(struct bm_portal_config *pcfg)
return p;
}
-static void bman_offline_cpu(unsigned int cpu)
+static int bman_offline_cpu(unsigned int cpu)
{
struct bman_portal *p = affine_bportals[cpu];
const struct bm_portal_config *pcfg;
if (!p)
- return;
+ return 0;
pcfg = bman_get_bm_portal_config(p);
if (!pcfg)
- return;
+ return 0;
irq_set_affinity(pcfg->irq, cpumask_of(0));
+ return 0;
}
-static void bman_online_cpu(unsigned int cpu)
+static int bman_online_cpu(unsigned int cpu)
{
struct bman_portal *p = affine_bportals[cpu];
const struct bm_portal_config *pcfg;
if (!p)
- return;
+ return 0;
pcfg = bman_get_bm_portal_config(p);
if (!pcfg)
- return;
+ return 0;
irq_set_affinity(pcfg->irq, cpumask_of(cpu));
+ return 0;
}
-static int bman_hotplug_cpu_callback(struct notifier_block *nfb,
- unsigned long action, void *hcpu)
-{
- unsigned int cpu = (unsigned long)hcpu;
-
- switch (action) {
- case CPU_ONLINE:
- case CPU_ONLINE_FROZEN:
- bman_online_cpu(cpu);
- break;
- case CPU_DOWN_PREPARE:
- case CPU_DOWN_PREPARE_FROZEN:
- bman_offline_cpu(cpu);
- }
-
- return NOTIFY_OK;
-}
-
-static struct notifier_block bman_hotplug_cpu_notifier = {
- .notifier_call = bman_hotplug_cpu_callback,
-};
-
static int bman_portal_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -210,8 +190,14 @@ static int __init bman_portal_driver_register(struct platform_driver *drv)
if (ret < 0)
return ret;
- register_hotcpu_notifier(&bman_hotplug_cpu_notifier);
-
+ ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN,
+ "soc/qbman_portal:online",
+ bman_online_cpu, bman_offline_cpu);
+ if (ret < 0) {
+ pr_err("bman: failed to register hotplug callbacks.\n");
+ platform_driver_unregister(drv);
+ return ret;
+ }
return 0;
}
[toc] | [prev] | [next] | [standalone]
| From | Sebastian Andrzej Siewior <bigeasy@linutronix.de> |
|---|---|
| Date | 2016-11-27 00:20 +0100 |
| Subject | [PATCH 04/22] idle/intel: Convert to hotplug state machine |
| Message-ID | <sHUqe-4EY-35@gated-at.bofh.it> |
| In reply to | #1530804 |
Install the callbacks via the state machine and let the core invoke the
callbacks on the already online CPUs.
The two smp_call_function_single() invocations in intel_idle_cpu_init() have
been removed because intel_idle_cpu_init() is now invoked via the hotplug
callback which runs on the target CPU. The IRQ-off calling convention for
auto_demotion_disable() and c1e_promotion_disable() has not been preserved
because only those two modify the MSR during CPU intialization.
Cc: Len Brown <lenb@kernel.org>
Cc: linux-pm@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
drivers/idle/intel_idle.c | 106 ++++++++++++++++++----------------------------
1 file changed, 42 insertions(+), 64 deletions(-)
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index f53b42a78186..d9631db1b4f5 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -98,8 +98,6 @@ static int intel_idle(struct cpuidle_device *dev,
struct cpuidle_driver *drv, int index);
static void intel_idle_freeze(struct cpuidle_device *dev,
struct cpuidle_driver *drv, int index);
-static int intel_idle_cpu_init(int cpu);
-
static struct cpuidle_state *cpuidle_state_table;
/*
@@ -907,50 +905,15 @@ static void intel_idle_freeze(struct cpuidle_device *dev,
mwait_idle_with_hints(eax, ecx);
}
-static void __setup_broadcast_timer(void *arg)
+static void __setup_broadcast_timer(bool on)
{
- unsigned long on = (unsigned long)arg;
-
if (on)
tick_broadcast_enable();
else
tick_broadcast_disable();
}
-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 & ~CPU_TASKS_FROZEN) {
- case CPU_ONLINE:
-
- if (lapic_timer_reliable_states != LAPIC_TIMER_ALWAYS_RELIABLE)
- __setup_broadcast_timer((void *)true);
-
- /*
- * Some systems can hotplug a cpu at runtime after
- * the kernel has booted, we have to initialize the
- * driver in this case
- */
- dev = per_cpu_ptr(intel_idle_cpuidle_devices, hotcpu);
- if (dev->registered)
- break;
-
- if (intel_idle_cpu_init(hotcpu))
- return NOTIFY_BAD;
-
- break;
- }
- return NOTIFY_OK;
-}
-
-static struct notifier_block cpu_hotplug_notifier = {
- .notifier_call = cpu_hotplug_notify,
-};
-
-static void auto_demotion_disable(void *dummy)
+static void auto_demotion_disable(void)
{
unsigned long long msr_bits;
@@ -958,7 +921,7 @@ static void auto_demotion_disable(void *dummy)
msr_bits &= ~(icpu->auto_demotion_disable_flags);
wrmsrl(MSR_NHM_SNB_PKG_CST_CFG_CTL, msr_bits);
}
-static void c1e_promotion_disable(void *dummy)
+static void c1e_promotion_disable(void)
{
unsigned long long msr_bits;
@@ -1372,12 +1335,11 @@ static void __init intel_idle_cpuidle_driver_init(void)
* allocate, initialize, register cpuidle_devices
* @cpu: cpu/core to initialize
*/
-static int intel_idle_cpu_init(int cpu)
+static int intel_idle_cpu_init(unsigned int cpu)
{
struct cpuidle_device *dev;
dev = per_cpu_ptr(intel_idle_cpuidle_devices, cpu);
-
dev->cpu = cpu;
if (cpuidle_register_device(dev)) {
@@ -1386,17 +1348,38 @@ static int intel_idle_cpu_init(int cpu)
}
if (icpu->auto_demotion_disable_flags)
- smp_call_function_single(cpu, auto_demotion_disable, NULL, 1);
+ auto_demotion_disable();
if (icpu->disable_promotion_to_c1e)
- smp_call_function_single(cpu, c1e_promotion_disable, NULL, 1);
+ c1e_promotion_disable();
return 0;
}
+static int intel_idle_cpu_online(unsigned int cpu)
+{
+ struct cpuidle_device *dev;
+
+ if (lapic_timer_reliable_states != LAPIC_TIMER_ALWAYS_RELIABLE)
+ __setup_broadcast_timer(true);
+
+ /*
+ * Some systems can hotplug a cpu at runtime after
+ * the kernel has booted, we have to initialize the
+ * driver in this case
+ */
+ dev = per_cpu_ptr(intel_idle_cpuidle_devices, cpu);
+ if (!dev->registered)
+ return intel_idle_cpu_init(cpu);
+
+ return 0;
+}
+
+static enum cpuhp_state hp_online;
+
static int __init intel_idle_init(void)
{
- int retval, i;
+ int retval;
/* Do not load intel_idle at all for now if idle= is passed */
if (boot_option_idle_override != IDLE_NO_OVERRIDE)
@@ -1416,35 +1399,30 @@ static int __init intel_idle_init(void)
struct cpuidle_driver *drv = cpuidle_get_driver();
printk(KERN_DEBUG PREFIX "intel_idle yielding to %s",
drv ? drv->name : "none");
- free_percpu(intel_idle_cpuidle_devices);
- return retval;
+ goto init_driver_fail;
}
- cpu_notifier_register_begin();
-
- for_each_online_cpu(i) {
- retval = intel_idle_cpu_init(i);
- if (retval) {
- intel_idle_cpuidle_devices_uninit();
- cpu_notifier_register_done();
- cpuidle_unregister_driver(&intel_idle_driver);
- free_percpu(intel_idle_cpuidle_devices);
- return retval;
- }
- }
- __register_cpu_notifier(&cpu_hotplug_notifier);
-
if (boot_cpu_has(X86_FEATURE_ARAT)) /* Always Reliable APIC Timer */
lapic_timer_reliable_states = LAPIC_TIMER_ALWAYS_RELIABLE;
- else
- on_each_cpu(__setup_broadcast_timer, (void *)true, 1);
- cpu_notifier_register_done();
+ retval = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "idle/intel:online",
+ intel_idle_cpu_online, NULL);
+ if (retval < 0)
+ goto hp_setup_fail;
+ hp_online = retval;
pr_debug(PREFIX "lapic_timer_reliable_states 0x%x\n",
lapic_timer_reliable_states);
return 0;
+
+hp_setup_fail:
+ intel_idle_cpuidle_devices_uninit();
+ cpuidle_unregister_driver(&intel_idle_driver);
+init_driver_fail:
+ free_percpu(intel_idle_cpuidle_devices);
+ return retval;
+
}
device_initcall(intel_idle_init);
--
2.10.2
[toc] | [prev] | [next] | [standalone]
| From | Thomas Gleixner <tglx@linutronix.de> |
|---|---|
| Date | 2016-11-28 18:40 +0100 |
| Subject | Re: [PATCH 04/22] idle/intel: Convert to hotplug state machine |
| Message-ID | <sIy4i-55G-27@gated-at.bofh.it> |
| In reply to | #1530810 |
On Sun, 27 Nov 2016, Sebastian Andrzej Siewior wrote:
> +static enum cpuhp_state hp_online;
> +
> static int __init intel_idle_init(void)
> {
...
> - cpu_notifier_register_done();
> + retval = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "idle/intel:online",
> + intel_idle_cpu_online, NULL);
> + if (retval < 0)
> + goto hp_setup_fail;
> + hp_online = retval;
Why do you want to store that. There is no exit function AFAICT.
Thanks,
tglx
[toc] | [prev] | [next] | [standalone]
| From | Sebastian Andrzej Siewior <bigeasy@linutronix.de> |
|---|---|
| Date | 2016-11-29 10:50 +0100 |
| Subject | Re: [PATCH 04/22] idle/intel: Convert to hotplug state machine |
| Message-ID | <sINd0-6J1-29@gated-at.bofh.it> |
| In reply to | #1531477 |
On 2016-11-28 18:29:41 [+0100], Thomas Gleixner wrote:
> Why do you want to store that. There is no exit function AFAICT.
There was one until 02c4fae9ea68 ("drivers/idle: make intel_idle.c
driver more explicitly non-modular"). I am going to remove it…
> Thanks,
>
> tglx
Sebastian
[toc] | [prev] | [next] | [standalone]
| From | Sebastian Andrzej Siewior <bigeasy@linutronix.de> |
|---|---|
| Date | 2016-11-29 11:00 +0100 |
| Subject | [PATCH 04/22 v2] idle/intel: Convert to hotplug state machine |
| Message-ID | <sINmF-6Mq-17@gated-at.bofh.it> |
| In reply to | #1532064 |
Install the callbacks via the state machine and let the core invoke the
callbacks on the already online CPUs.
The two smp_call_function_single() invocations in intel_idle_cpu_init() have
been removed because intel_idle_cpu_init() is now invoked via the hotplug
callback which runs on the target CPU. The IRQ-off calling convention for
auto_demotion_disable() and c1e_promotion_disable() has not been preserved
because only those two modify the MSR during CPU intialization.
Cc: Len Brown <lenb@kernel.org>
Cc: linux-pm@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
v1…v2: drop the superfluous saving of the hotplug state (not a module
anymore).
drivers/idle/intel_idle.c | 103 ++++++++++++++++++----------------------------
1 file changed, 39 insertions(+), 64 deletions(-)
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index f53b42a78186..df532c4398e5 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -98,8 +98,6 @@ static int intel_idle(struct cpuidle_device *dev,
struct cpuidle_driver *drv, int index);
static void intel_idle_freeze(struct cpuidle_device *dev,
struct cpuidle_driver *drv, int index);
-static int intel_idle_cpu_init(int cpu);
-
static struct cpuidle_state *cpuidle_state_table;
/*
@@ -907,50 +905,15 @@ static void intel_idle_freeze(struct cpuidle_device *dev,
mwait_idle_with_hints(eax, ecx);
}
-static void __setup_broadcast_timer(void *arg)
+static void __setup_broadcast_timer(bool on)
{
- unsigned long on = (unsigned long)arg;
-
if (on)
tick_broadcast_enable();
else
tick_broadcast_disable();
}
-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 & ~CPU_TASKS_FROZEN) {
- case CPU_ONLINE:
-
- if (lapic_timer_reliable_states != LAPIC_TIMER_ALWAYS_RELIABLE)
- __setup_broadcast_timer((void *)true);
-
- /*
- * Some systems can hotplug a cpu at runtime after
- * the kernel has booted, we have to initialize the
- * driver in this case
- */
- dev = per_cpu_ptr(intel_idle_cpuidle_devices, hotcpu);
- if (dev->registered)
- break;
-
- if (intel_idle_cpu_init(hotcpu))
- return NOTIFY_BAD;
-
- break;
- }
- return NOTIFY_OK;
-}
-
-static struct notifier_block cpu_hotplug_notifier = {
- .notifier_call = cpu_hotplug_notify,
-};
-
-static void auto_demotion_disable(void *dummy)
+static void auto_demotion_disable(void)
{
unsigned long long msr_bits;
@@ -958,7 +921,7 @@ static void auto_demotion_disable(void *dummy)
msr_bits &= ~(icpu->auto_demotion_disable_flags);
wrmsrl(MSR_NHM_SNB_PKG_CST_CFG_CTL, msr_bits);
}
-static void c1e_promotion_disable(void *dummy)
+static void c1e_promotion_disable(void)
{
unsigned long long msr_bits;
@@ -1372,12 +1335,11 @@ static void __init intel_idle_cpuidle_driver_init(void)
* allocate, initialize, register cpuidle_devices
* @cpu: cpu/core to initialize
*/
-static int intel_idle_cpu_init(int cpu)
+static int intel_idle_cpu_init(unsigned int cpu)
{
struct cpuidle_device *dev;
dev = per_cpu_ptr(intel_idle_cpuidle_devices, cpu);
-
dev->cpu = cpu;
if (cpuidle_register_device(dev)) {
@@ -1386,17 +1348,36 @@ static int intel_idle_cpu_init(int cpu)
}
if (icpu->auto_demotion_disable_flags)
- smp_call_function_single(cpu, auto_demotion_disable, NULL, 1);
+ auto_demotion_disable();
if (icpu->disable_promotion_to_c1e)
- smp_call_function_single(cpu, c1e_promotion_disable, NULL, 1);
+ c1e_promotion_disable();
+
+ return 0;
+}
+
+static int intel_idle_cpu_online(unsigned int cpu)
+{
+ struct cpuidle_device *dev;
+
+ if (lapic_timer_reliable_states != LAPIC_TIMER_ALWAYS_RELIABLE)
+ __setup_broadcast_timer(true);
+
+ /*
+ * Some systems can hotplug a cpu at runtime after
+ * the kernel has booted, we have to initialize the
+ * driver in this case
+ */
+ dev = per_cpu_ptr(intel_idle_cpuidle_devices, cpu);
+ if (!dev->registered)
+ return intel_idle_cpu_init(cpu);
return 0;
}
static int __init intel_idle_init(void)
{
- int retval, i;
+ int retval;
/* Do not load intel_idle at all for now if idle= is passed */
if (boot_option_idle_override != IDLE_NO_OVERRIDE)
@@ -1416,35 +1397,29 @@ static int __init intel_idle_init(void)
struct cpuidle_driver *drv = cpuidle_get_driver();
printk(KERN_DEBUG PREFIX "intel_idle yielding to %s",
drv ? drv->name : "none");
- free_percpu(intel_idle_cpuidle_devices);
- return retval;
+ goto init_driver_fail;
}
- cpu_notifier_register_begin();
-
- for_each_online_cpu(i) {
- retval = intel_idle_cpu_init(i);
- if (retval) {
- intel_idle_cpuidle_devices_uninit();
- cpu_notifier_register_done();
- cpuidle_unregister_driver(&intel_idle_driver);
- free_percpu(intel_idle_cpuidle_devices);
- return retval;
- }
- }
- __register_cpu_notifier(&cpu_hotplug_notifier);
-
if (boot_cpu_has(X86_FEATURE_ARAT)) /* Always Reliable APIC Timer */
lapic_timer_reliable_states = LAPIC_TIMER_ALWAYS_RELIABLE;
- else
- on_each_cpu(__setup_broadcast_timer, (void *)true, 1);
- cpu_notifier_register_done();
+ retval = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "idle/intel:online",
+ intel_idle_cpu_online, NULL);
+ if (retval < 0)
+ goto hp_setup_fail;
pr_debug(PREFIX "lapic_timer_reliable_states 0x%x\n",
lapic_timer_reliable_states);
return 0;
+
+hp_setup_fail:
+ intel_idle_cpuidle_devices_uninit();
+ cpuidle_unregister_driver(&intel_idle_driver);
+init_driver_fail:
+ free_percpu(intel_idle_cpuidle_devices);
+ return retval;
+
}
device_initcall(intel_idle_init);
--
2.10.2
[toc] | [prev] | [next] | [standalone]
| From | Sebastian Andrzej Siewior <bigeasy@linutronix.de> |
|---|---|
| Date | 2016-11-27 00:20 +0100 |
| Subject | [PATCH 07/22] mm/vmstat: Drop get_online_cpus() from init_cpu_node_state/vmstat_cpu_dead() |
| Message-ID | <sHUqf-4EY-47@gated-at.bofh.it> |
| In reply to | #1530804 |
Both functions are called with protection against cpu hotplug already so
*_online_cpus() could be dropped.
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: linux-mm@kvack.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
mm/vmstat.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 604f26a4f696..0b63ffb5c407 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1722,24 +1722,19 @@ static void __init init_cpu_node_state(void)
{
int cpu;
- get_online_cpus();
for_each_online_cpu(cpu)
node_set_state(cpu_to_node(cpu), N_CPU);
- put_online_cpus();
}
static void vmstat_cpu_dead(int node)
{
int cpu;
- get_online_cpus();
for_each_online_cpu(cpu)
if (cpu_to_node(cpu) == node)
- goto end;
+ return;
node_clear_state(node, N_CPU);
-end:
- put_online_cpus();
}
/*
--
2.10.2
[toc] | [prev] | [next] | [standalone]
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2016-11-28 10:30 +0100 |
| Subject | Re: [PATCH 07/22] mm/vmstat: Drop get_online_cpus() from init_cpu_node_state/vmstat_cpu_dead() |
| Message-ID | <sIqq6-f5-25@gated-at.bofh.it> |
| In reply to | #1530811 |
On Sun 27-11-16 00:13:35, Sebastian Andrzej Siewior wrote:
> Both functions are called with protection against cpu hotplug already so
> *_online_cpus() could be dropped.
>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Vlastimil Babka <vbabka@suse.cz>
> Cc: Mel Gorman <mgorman@techsingularity.net>
> Cc: Johannes Weiner <hannes@cmpxchg.org>
> Cc: linux-mm@kvack.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Michal Hocko <mhocko@suse.com>
> ---
> mm/vmstat.c | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/mm/vmstat.c b/mm/vmstat.c
> index 604f26a4f696..0b63ffb5c407 100644
> --- a/mm/vmstat.c
> +++ b/mm/vmstat.c
> @@ -1722,24 +1722,19 @@ static void __init init_cpu_node_state(void)
> {
> int cpu;
>
> - get_online_cpus();
> for_each_online_cpu(cpu)
> node_set_state(cpu_to_node(cpu), N_CPU);
> - put_online_cpus();
> }
>
> static void vmstat_cpu_dead(int node)
> {
> int cpu;
>
> - get_online_cpus();
> for_each_online_cpu(cpu)
> if (cpu_to_node(cpu) == node)
> - goto end;
> + return;
>
> node_clear_state(node, N_CPU);
> -end:
> - put_online_cpus();
> }
>
> /*
> --
> 2.10.2
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org. For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
--
Michal Hocko
SUSE Labs
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> |
|---|---|
| Date | 2016-12-02 01:20 +0100 |
| Subject | [tip:smp/hotplug] mm/vmstat: Drop get_online_cpus() from init_cpu_node_state/vmstat_cpu_dead() |
| Message-ID | <sJJK2-4sD-35@gated-at.bofh.it> |
| In reply to | #1530811 |
Commit-ID: 76f290935b1a395ee6c9a14697f16593591d1fe8
Gitweb: http://git.kernel.org/tip/76f290935b1a395ee6c9a14697f16593591d1fe8
Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate: Sun, 27 Nov 2016 00:13:35 +0100
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 2 Dec 2016 00:52:35 +0100
mm/vmstat: Drop get_online_cpus() from init_cpu_node_state/vmstat_cpu_dead()
Both functions are called with protection against cpu hotplug already so
*_online_cpus() could be dropped.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: linux-mm@kvack.org
Cc: rt@linutronix.de
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Vlastimil Babka <vbabka@suse.cz>
Link: http://lkml.kernel.org/r/20161126231350.10321-8-bigeasy@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
mm/vmstat.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 604f26a..0b63ffb 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1722,24 +1722,19 @@ static void __init init_cpu_node_state(void)
{
int cpu;
- get_online_cpus();
for_each_online_cpu(cpu)
node_set_state(cpu_to_node(cpu), N_CPU);
- put_online_cpus();
}
static void vmstat_cpu_dead(int node)
{
int cpu;
- get_online_cpus();
for_each_online_cpu(cpu)
if (cpu_to_node(cpu) == node)
- goto end;
+ return;
node_clear_state(node, N_CPU);
-end:
- put_online_cpus();
}
/*
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | linux.kernel
csiph-web