cpu hotplug: convert more drivers (batch #6 and last)
Subsystems (58)
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
PATCH 1/22 cpufreq/acpi-cpufreq: Convert to hotplug state machine
Install the callbacks via the state machine.
--- drivers/cpufreq/acpi-cpufreq.c | 93 ++++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 48 deletions(-)
drivers/cpufreq/acpi-cpufreq.c +45 -48
@@ -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 )
Signature · 1 line
2.10.2
Viresh Kumar
maintainerRe: [PATCH 01/22] cpufreq/acpi-cpufreq: Convert to hotplug state machine
Quoted 96 lines · Sebastian Andrzej Siewior
Install the callbacks via the state machine.
Cc "Rafael J. Wysocki" <[email protected]>Cc Viresh Kumar <[email protected]>Signed-off-by Sebastian Andrzej Siewior <[email protected]>--- drivers/cpufreq/acpi-cpufreq.c | 93 ++++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 48 deletions(-)drivers/cpufreq/acpi-cpufreq.c +22
-35@@ -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;
drivers/cpufreq/acpi-cpufreq.c static struct cpufreq_driver acpi_cpufreq_driver = { · line 940
Quoted 10 lines
drivers/cpufreq/acpi-cpufreq.c +3
-5- 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 ?
Quoted 5 lines
drivers/cpufreq/acpi-cpufreq.c +2
-2+ acpi_cpufreq_driver.set_boost = set_boost; + acpi_cpufreq_driver.boost_enabled =boost_state (0 ); -__register_cpu_notifier (&boost_nb); -
drivers/cpufreq/acpi-cpufreq.c static struct cpufreq_driver acpi_cpufreq_driver = { · line 937
Quoted 10 lines
drivers/cpufreq/acpi-cpufreq.c +9
-1-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?
Quoted 25 lines
drivers/cpufreq/acpi-cpufreq.c +9
-5+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 )Signature · 1 line
2.10.2
Signature · 1 line
viresh
Re: [PATCH 01/22] cpufreq/acpi-cpufreq: Convert to hotplug state machine
Quoted 29 lines · Viresh Kumar
Quoted 29 lines
drivers/cpufreq/acpi-cpufreq.c +8
-7@@ -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 ;
Quoted 5 lines
drivers/cpufreq/acpi-cpufreq.c static struct cpufreq_driver acpi_cpufreq_driver = { · line 940
Quoted 3 lines
drivers/cpufreq/acpi-cpufreq.c +0
-3-/* 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.
Quoted 18 lines
Quoted 5 lines
drivers/cpufreq/acpi-cpufreq.c +2
-2+ acpi_cpufreq_driver.set_boost = set_boost; + acpi_cpufreq_driver.boost_enabled =boost_state (0 ); -__register_cpu_notifier (&boost_nb); -drivers/cpufreq/acpi-cpufreq.c static struct cpufreq_driver acpi_cpufreq_driver = { · line 937
Quoted 10 lines
drivers/cpufreq/acpi-cpufreq.c +9
-1-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.
Quoted 22 lines
Quoted 22 lines
drivers/cpufreq/acpi-cpufreq.c +9
-5+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 ; }
Quoted 3 lines
Quoted 3 lines
drivers/cpufreq/acpi-cpufreq.c +0
-0static int __init acpi_cpufreq_init (void )Signature · 1 line
2.10.2
Sebastian
PATCH v2 1/22 cpufreq/acpi-cpufreq: Convert to hotplug state machine
Install the callbacks via the state machine.
---
v1…v2: set msrs to NULL on error during init.
drivers/cpufreq/acpi-cpufreq.c | 92 ++++++++++++++++++++--------------------- 1 file changed, 45 insertions(+), 47 deletions(-)
drivers/cpufreq/acpi-cpufreq.c +45 -47
@@ -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 )
Re: [PATCH 01/22 v2] cpufreq/acpi-cpufreq: Convert to hotplug state machine
Quoted 11 lines · Sebastian Andrzej Siewior
Install the callbacks via the state machine.
Cc "Rafael J. Wysocki" <[email protected]>Cc Viresh Kumar <[email protected]>Signed-off-by Sebastian Andrzej Siewior <[email protected]>---
v1…v2: set msrs to NULL on error during init.drivers/cpufreq/acpi-cpufreq.c | 92 ++++++++++++++++++++--------------------- 1 file changed, 45 insertions(+), 47 deletions(-)
Signature · 1 line
viresh
Rafael J. Wysocki
maintainerRe: [PATCH 01/22 v2] cpufreq/acpi-cpufreq: Convert to hotplug state machine
In reply to Sebastian Andrzej SiewiorQuoted 8 lines · Sebastian Andrzej Siewior
Install the callbacks via the state machine.
Cc "Rafael J. Wysocki" <[email protected]>Cc Viresh Kumar <[email protected]>Signed-off-by Sebastian Andrzej Siewior <[email protected]>---
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
PATCH 2/22 cpufreq/acpi-cpufreq: drop rdmsr_on_cpus() usage
In reply to Sebastian Andrzej SiewiorThe online / pre_down callback is invoked on the target CPU since commit 1cf4f629d9d2 ("cpu/hotplug: Move online calls to hotplugged cpu") which means for the hotplug callback we can use rmdsrl() instead of rdmsr_on_cpus().
This leaves us with set_boost() as the only user which still needs to read/write the MSR on different CPUs. There is no point in doing that update on all cpus with the read modify write magic via per cpu data. We simply can issue a function call on all online CPUs which also means that we need half that many IPIs.
--- drivers/cpufreq/acpi-cpufreq.c | 58 +++++++++++++++--------------------------- 1 file changed, 20 insertions(+), 38 deletions(-)
drivers/cpufreq/acpi-cpufreq.c +20 -38
@@ -84,7 +84,6 @@ static inline struct acpi_processor_performance *to_perf_data(struct acpi_cpufrestatic struct cpufreq_driver acpi_cpufreq_driver;static unsigned int acpi_pstate_strict; -static struct msr __percpu *msrs;static bool boost_state (unsigned int cpu) {
@@ -104,11 +103,10 @@ static bool boost_state(unsigned int cpu)return false; } -static void boost_set_msrs (bool enable,const struct cpumask *cpumask) +static int boost_set_msr (bool enable) { -u32 cpu;u32 msr_addr; -u64 msr_mask; +u64 msr_mask, val;switch (boot_cpu_data.x86_vendor) {case X86_VENDOR_INTEL :
@@ -120,26 +118,31 @@ static void boost_set_msrs(bool enable, const struct cpumask *cpumask) msr_mask =MSR_K7_HWCR_CPB_DIS ;break ;default : -return ; +return -EINVAL ; } -rdmsr_on_cpus (cpumask, msr_addr, msrs); +rdmsrl (msr_addr, val); -for_each_cpu (cpu, cpumask) { -struct msr *reg =per_cpu_ptr (msrs, cpu); -if (enable) - reg->q &= ~msr_mask; -else - reg->q |= msr_mask; - } +if (enable) + val &= ~msr_mask; +else + val |= msr_mask; -wrmsr_on_cpus (cpumask, msr_addr, msrs); +wrmsrl (msr_addr, val); +return 0 ; +} + +static void boost_set_msr_each (void *p_en) +{ +bool enable = (bool ) p_en; + +boost_set_msr (enable); }static int set_boost (int val) {get_online_cpus (); -boost_set_msrs (val, cpu_online_mask); +on_each_cpu (boost_set_msr_each, (void *)(long )val,1 );put_online_cpus ();pr_debug ("Core Boosting %sabled.\n" , val ?"en" :"dis" );
@@ -538,29 +541,20 @@ static void free_acpi_perf_data(void)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 ; +return boost_set_msr (acpi_cpufreq_driver.boost_enabled); }static int cpufreq_boost_down_prep (unsigned int cpu) { -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. */ -boost_set_msrs (1 , cpumask); -return 0 ; +return boost_set_msr (1 ); }/*
@@ -918,11 +912,6 @@ static void __init acpi_cpufreq_boost_init(void)if (!(boot_cpu_has (X86_FEATURE_CPB ) ||boot_cpu_has (X86_FEATURE_IDA )))return ; - msrs =msrs_alloc (); - -if (!msrs) -return ; - acpi_cpufreq_driver.set_boost = set_boost; acpi_cpufreq_driver.boost_enabled =boost_state (0 );
@@ -934,7 +923,6 @@ static void __init acpi_cpufreq_boost_init(void) 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;
@@ -942,14 +930,8 @@ static void __init acpi_cpufreq_boost_init(void)static void acpi_cpufreq_boost_exit (void ) { -if (!msrs) -return ; -if (acpi_cpufreq_online >=0 )cpuhp_remove_state_nocalls (acpi_cpufreq_online); - -msrs_free (msrs); - msrs =NULL ; }static int __init acpi_cpufreq_init (void )
Signature · 1 line
2.10.2
PATCH v2 2/22 cpufreq/acpi-cpufreq: drop rdmsr_on_cpus() usage
The online / pre_down callback is invoked on the target CPU since commit 1cf4f629d9d2 ("cpu/hotplug: Move online calls to hotplugged cpu") which means for the hotplug callback we can use rmdsrl() instead of rdmsr_on_cpus().
This leaves us with set_boost() as the only user which still needs to read/write the MSR on different CPUs. There is no point in doing that update on all cpus with the read modify write magic via per cpu data. We simply can issue a function call on all online CPUs which also means that we need half that many IPIs.
---
v1…v2: rebase ontop of the previous patch.
drivers/cpufreq/acpi-cpufreq.c | 59 +++++++++++++---------------------------- 1 file changed, 20 insertions(+), 39 deletions(-)
drivers/cpufreq/acpi-cpufreq.c +20 -39
@@ -84,7 +84,6 @@ static inline struct acpi_processor_perfstatic struct cpufreq_driver acpi_cpufreq_driver;static unsigned int acpi_pstate_strict; -static struct msr __percpu *msrs;static bool boost_state (unsigned int cpu) {
@@ -104,11 +103,10 @@ static bool boost_state(unsigned int cpureturn false; } -static void boost_set_msrs (bool enable,const struct cpumask *cpumask) +static int boost_set_msr (bool enable) { -u32 cpu;u32 msr_addr; -u64 msr_mask; +u64 msr_mask, val;switch (boot_cpu_data.x86_vendor) {case X86_VENDOR_INTEL :
@@ -120,26 +118,31 @@ static void boost_set_msrs(bool enable, msr_mask =MSR_K7_HWCR_CPB_DIS ;break ;default : -return ; +return -EINVAL ; } -rdmsr_on_cpus (cpumask, msr_addr, msrs); +rdmsrl (msr_addr, val); -for_each_cpu (cpu, cpumask) { -struct msr *reg =per_cpu_ptr (msrs, cpu); -if (enable) - reg->q &= ~msr_mask; -else - reg->q |= msr_mask; - } +if (enable) + val &= ~msr_mask; +else + val |= msr_mask; -wrmsr_on_cpus (cpumask, msr_addr, msrs); +wrmsrl (msr_addr, val); +return 0 ; +} + +static void boost_set_msr_each (void *p_en) +{ +bool enable = (bool ) p_en; + +boost_set_msr (enable); }static int set_boost (int val) {get_online_cpus (); -boost_set_msrs (val, cpu_online_mask); +on_each_cpu (boost_set_msr_each, (void *)(long )val,1 );put_online_cpus ();pr_debug ("Core Boosting %sabled.\n" , val ?"en" :"dis" );
@@ -538,29 +541,20 @@ static void free_acpi_perf_data(void)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 ; +return boost_set_msr (acpi_cpufreq_driver.boost_enabled); }static int cpufreq_boost_down_prep (unsigned int cpu) { -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. */ -boost_set_msrs (1 , cpumask); -return 0 ; +return boost_set_msr (1 ); }/*
@@ -918,11 +912,6 @@ static void __init acpi_cpufreq_boost_inif (!(boot_cpu_has (X86_FEATURE_CPB ) ||boot_cpu_has (X86_FEATURE_IDA )))return ; - msrs =msrs_alloc (); - -if (!msrs) -return ; - acpi_cpufreq_driver.set_boost = set_boost; acpi_cpufreq_driver.boost_enabled =boost_state (0 );
@@ -934,8 +923,6 @@ static void __init acpi_cpufreq_boost_in 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;
@@ -943,14 +930,8 @@ static void __init acpi_cpufreq_boost_instatic void acpi_cpufreq_boost_exit (void ) { -if (!msrs) -return ; -if (acpi_cpufreq_online >=0 )cpuhp_remove_state_nocalls (acpi_cpufreq_online); - -msrs_free (msrs); - msrs =NULL ; }static int __init acpi_cpufreq_init (void )
Re: [PATCH 02/22 v2] cpufreq/acpi-cpufreq: drop rdmsr_on_cpus() usage
Quoted 10 lines · Sebastian Andrzej Siewior
The online /
pre_downcallback is invoked on the target CPU since commit1cf4f629d9d2("cpu/hotplug: Move online calls to hotplugged cpu") which means for the hotplug callback we can usermdsrl()instead ofrdmsr_on_cpus().This leaves us with
set_boost()as the only user which still needs to read/write the MSR on different CPUs. There is no point in doing that update on all cpus with the read modify write magic via per cpu data. We simply can issue a function call on all online CPUs which also means that we need half that many IPIs.
Quoted 6 lines
Cc "Rafael J. Wysocki" <[email protected]>Cc Viresh Kumar <[email protected]>Signed-off-by Sebastian Andrzej Siewior <[email protected]>---
v1…v2: rebase ontop of the previous patch.
Signature · 1 line
viresh
PATCH 3/22 idle/intel: Remove superfluous SMP fuction call
In reply to Sebastian Andrzej SiewiorFrom: Anna-Maria Gleixner <[email protected]>
Since commit 1cf4f629d9d2 ("cpu/hotplug: Move online calls to hotplugged cpu") the CPU_ONLINE and CPU_DOWN_PREPARE notifiers are always run on the hot plugged CPU, and as of commit 3b9d6da67e11 ("cpu/hotplug: Fix rollback during error-out in __cpu_disable()") the CPU_DOWN_FAILED notifier also runs on the hot plugged CPU. This patch converts the SMP functional calls into direct calls.
smp_function_call_single() executes the function with interrupts disabled. This calling convention is not preserved, because tick_broadcast_enable() and tick_braodcast_disable() handle interrupts themselves.
--- drivers/idle/intel_idle.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/idle/intel_idle.c +1 -2
@@ -927,8 +927,7 @@ static int cpu_hotplug_notify(struct notifier_block *n,case CPU_ONLINE :if (lapic_timer_reliable_states !=LAPIC_TIMER_ALWAYS_RELIABLE ) -smp_call_function_single (hotcpu, __setup_broadcast_timer, - (void *)true,1 ); +__setup_broadcast_timer ((void *)true);/* * Some systems can hotplug a cpu at runtime after
Signature · 1 line
2.10.2
PATCH 4/22 idle/intel: Convert to hotplug state machine
In reply to Sebastian Andrzej SiewiorInstall 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.
--- drivers/idle/intel_idle.c | 106 ++++++++++++++++++---------------------------- 1 file changed, 42 insertions(+), 64 deletions(-)
drivers/idle/intel_idle.c +42 -64
@@ -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);
Signature · 1 line
2.10.2
Re: [PATCH 04/22] idle/intel: Convert to hotplug state machine
Quoted 4 lines · Sebastian Andrzej Siewior
drivers/idle/intel_idle.c +2
-0+static enum cpuhp_state hp_online; +static int __init intel_idle_init (void ) {
...
drivers/idle/intel_idle.c static int __init intel_idle_init(void) · line 1412
Quoted 6 lines
drivers/idle/intel_idle.c +5
-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;
Why do you want to store that. There is no exit function AFAICT.
Thanks,
tglx
Re: [PATCH 04/22] idle/intel: Convert to hotplug state machine
Quoted 1 line · Thomas Gleixner
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…
Quoted 3 lines
Thanks,
tglx
Sebastian
PATCH v2 4/22 idle/intel: Convert to hotplug state machine
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.
---
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(-)
drivers/idle/intel_idle.c +39 -64
@@ -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);
Signature · 1 line
2.10.2
PATCH 5/22 oprofile/nmi timer: Convert to hotplug state machine
In reply to Sebastian Andrzej SiewiorInstall the callbacks via the state machine and let the core invoke the callbacks on the already online CPUs.
--- drivers/oprofile/nmi_timer_int.c | 58 +++++++++++++--------------------------- 1 file changed, 19 insertions(+), 39 deletions(-)
drivers/oprofile/nmi_timer_int.c +19 -39
@@ -59,25 +59,16 @@ static void nmi_timer_stop_cpu(int cpu)perf_event_disable (event); } -static int nmi_timer_cpu_notifier (struct notifier_block *b,unsigned long action, -void *data) +static int nmi_timer_cpu_online (unsigned int cpu) { -int cpu = (unsigned long )data; -switch (action) { -case CPU_DOWN_FAILED : -case CPU_ONLINE : -nmi_timer_start_cpu (cpu); -break ; -case CPU_DOWN_PREPARE : -nmi_timer_stop_cpu (cpu); -break ; - } -return NOTIFY_DONE ; +nmi_timer_start_cpu (cpu); +return 0 ; +} +static int nmi_timer_cpu_predown (unsigned int cpu) +{ +nmi_timer_stop_cpu (cpu); +return 0 ; } - -static struct notifier_block nmi_timer_cpu_nb = { - .notifier_call = nmi_timer_cpu_notifier -};static int nmi_timer_start (void ) {
@@ -103,13 +94,14 @@ static void nmi_timer_stop(void)put_online_cpus (); } +static enum cpuhp_state hp_online; +static void nmi_timer_shutdown (void ) {struct perf_event *event;int cpu; -cpu_notifier_register_begin (); -__unregister_cpu_notifier (&nmi_timer_cpu_nb); +cpuhp_remove_state (hp_online);for_each_possible_cpu (cpu) { event =per_cpu (nmi_timer_events, cpu);if (!event)
@@ -118,13 +110,11 @@ static void nmi_timer_shutdown(void)per_cpu (nmi_timer_events, cpu) =NULL ;perf_event_release_kernel (event); } - -cpu_notifier_register_done (); }static int nmi_timer_setup (void ) { -int cpu, err; +int err;u64 period;/* clock cycles per tick: */
@@ -132,24 +122,14 @@ static int nmi_timer_setup(void)do_div (period,HZ ); nmi_timer_attr.sample_period = period; -cpu_notifier_register_begin (); - err =__register_cpu_notifier (&nmi_timer_cpu_nb); -if (err) - goto out; - -/* can't attach events to offline cpus: */ -for_each_online_cpu (cpu) { - err =nmi_timer_start_cpu (cpu); -if (err) { -cpu_notifier_register_done (); -nmi_timer_shutdown (); -return err; - } + err =cpuhp_setup_state (CPUHP_AP_ONLINE_DYN ,"oprofile/nmi:online" , + nmi_timer_cpu_online, nmi_timer_cpu_predown); +if (err <0 ) { +nmi_timer_shutdown (); +return err; } - -out: -cpu_notifier_register_done (); -return err; + hp_online = err; +return 0 ; }int __init op_nmi_timer_init (struct oprofile_operations *ops)
Signature · 1 line
2.10.2
tip-bot for Sebastian Andrzej Siewior
merge bot[tip:smp/hotplug] oprofile/nmi timer: Convert to hotplug state machine
oprofile/nmi timer: Convert to hotplug state machine
Commit-ID: 14660b7ea3ca628410bb999d53926ca77973892b Gitweb: http://git.kernel.org/tip/14660b7ea3ca628410bb999d53926ca77973892b Author: Sebastian Andrzej Siewior <[email protected]> AuthorDate: Sun, 27 Nov 2016 00:13:33 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Fri, 2 Dec 2016 00:52:34 +0100
oprofile/nmi timer: Convert to hotplug state machine
Install the callbacks via the state machine and let the core invoke the callbacks on the already online CPUs.
--- drivers/oprofile/nmi_timer_int.c | 58 +++++++++++++--------------------------- 1 file changed, 19 insertions(+), 39 deletions(-)
drivers/oprofile/nmi_timer_int.c +19 -39
@@ -59,25 +59,16 @@ static void nmi_timer_stop_cpu(int cpu)perf_event_disable (event); } -static int nmi_timer_cpu_notifier (struct notifier_block *b,unsigned long action, -void *data) +static int nmi_timer_cpu_online (unsigned int cpu) { -int cpu = (unsigned long )data; -switch (action) { -case CPU_DOWN_FAILED : -case CPU_ONLINE : -nmi_timer_start_cpu (cpu); -break ; -case CPU_DOWN_PREPARE : -nmi_timer_stop_cpu (cpu); -break ; - } -return NOTIFY_DONE ; +nmi_timer_start_cpu (cpu); +return 0 ; +} +static int nmi_timer_cpu_predown (unsigned int cpu) +{ +nmi_timer_stop_cpu (cpu); +return 0 ; } - -static struct notifier_block nmi_timer_cpu_nb = { - .notifier_call = nmi_timer_cpu_notifier -};static int nmi_timer_start (void ) {
@@ -103,13 +94,14 @@ static void nmi_timer_stop(void)put_online_cpus (); } +static enum cpuhp_state hp_online; +static void nmi_timer_shutdown (void ) {struct perf_event *event;int cpu; -cpu_notifier_register_begin (); -__unregister_cpu_notifier (&nmi_timer_cpu_nb); +cpuhp_remove_state (hp_online);for_each_possible_cpu (cpu) { event =per_cpu (nmi_timer_events, cpu);if (!event)
@@ -118,13 +110,11 @@ static void nmi_timer_shutdown(void)per_cpu (nmi_timer_events, cpu) =NULL ;perf_event_release_kernel (event); } - -cpu_notifier_register_done (); }static int nmi_timer_setup (void ) { -int cpu, err; +int err;u64 period;/* clock cycles per tick: */
@@ -132,24 +122,14 @@ static int nmi_timer_setup(void)do_div (period,HZ ); nmi_timer_attr.sample_period = period; -cpu_notifier_register_begin (); - err =__register_cpu_notifier (&nmi_timer_cpu_nb); -if (err) - goto out; - -/* can't attach events to offline cpus: */ -for_each_online_cpu (cpu) { - err =nmi_timer_start_cpu (cpu); -if (err) { -cpu_notifier_register_done (); -nmi_timer_shutdown (); -return err; - } + err =cpuhp_setup_state (CPUHP_AP_ONLINE_DYN ,"oprofile/nmi:online" , + nmi_timer_cpu_online, nmi_timer_cpu_predown); +if (err <0 ) { +nmi_timer_shutdown (); +return err; } - -out: -cpu_notifier_register_done (); -return err; + hp_online = err; +return 0 ; }int __init op_nmi_timer_init (struct oprofile_operations *ops)
PATCH 6/22 tracing/rb: Convert to hotplug state machine
In reply to Sebastian Andrzej SiewiorInstall the callbacks via the state machine. The notifier in struct ring_buffer is replaced by the multi instance interface. Upon __ring_buffer_alloc() invocation, cpuhp_state_add_instance() will invoke the trace_rb_cpu_prepare() on each CPU.
This callback may now fail. This means __ring_buffer_alloc() will fail and cleanup (like previously) and during a CPU up event this failure will not allow the CPU to come up.
--- include/linux/cpuhotplug.h | 1 + include/linux/ring_buffer.h | 6 ++ kernel/trace/ring_buffer.c | 133 +++++++++++++++----------------------------- kernel/trace/trace.c | 15 ++++- 4 files changed, 65 insertions(+), 90 deletions(-)
include/linux/cpuhotplug.h +1 -0
@@ -62,6 +62,7 @@ enum cpuhp_state {CPUHP_TOPOLOGY_PREPARE ,CPUHP_NET_IUCV_PREPARE ,CPUHP_ARM_BL_PREPARE , +CPUHP_TRACE_RB_PREPARE ,CPUHP_TIMERS_DEAD ,CPUHP_NOTF_ERR_INJ_PREPARE , CPUHP_MIPS_SOC_PREPARE,
include/linux/ring_buffer.h +6 -0
@@ -198,4 +198,10 @@ enum ring_buffer_flags { RB_FL_OVERWRITE = 1 << 0, }; +#ifdef CONFIG_RING_BUFFER +int trace_rb_cpu_prepare (unsigned int cpu,struct hlist_node *node); +#else +#define trace_rb_cpu_prepare NULL +#endif +#endif /* _LINUX_RING_BUFFER_H */
kernel/trace/ring_buffer.c +44 -89
195 lines not on this page · raw message
kernel/trace/trace.c +14 -1
@@ -7659,10 +7659,21 @@ __init static int tracer_alloc_buffers(void)raw_spin_lock_init (&global_trace.start_lock); +/* +* The prepare callbacks allocates some memory for the ring buffer. We +* don't free the buffer if the if the CPU goes down. If we were to free +* the buffer, then the user would lose any trace that was in the +* buffer. The memory will be removed once the "instance" is removed. +*/ + ret =cpuhp_setup_state_multi (CPUHP_TRACE_RB_PREPARE , +"trace/RB:preapre" , trace_rb_cpu_prepare, +NULL ); +if (ret <0 ) + goto out_free_cpumask;/* Used for event triggers */ temp_buffer =ring_buffer_alloc (PAGE_SIZE ,RB_FL_OVERWRITE );if (!temp_buffer) - goto out_free_cpumask; + goto out_rm_hp_state;if (trace_create_savedcmd () <0 ) goto out_free_temp_buffer;
@@ -7723,6 +7734,8 @@ __init static int tracer_alloc_buffers(void)free_saved_cmdlines_buffer (savedcmd); out_free_temp_buffer:ring_buffer_free (temp_buffer); +out_rm_hp_state: +cpuhp_remove_multi_state (CPUHP_TRACE_RB_PREPARE ); out_free_cpumask:free_cpumask_var (global_trace.tracing_cpumask); out_free_buffer_mask:
Signature · 1 line
2.10.2
tip-bot for Sebastian Andrzej Siewior
merge bot[tip:smp/hotplug] tracing/rb: Convert to hotplug state machine
tracing/rb: Convert to hotplug state machine
Commit-ID: b32614c03413f8a6025d8677c2b7c0ee976e63d4 Gitweb: http://git.kernel.org/tip/b32614c03413f8a6025d8677c2b7c0ee976e63d4 Author: Sebastian Andrzej Siewior <[email protected]> AuthorDate: Sun, 27 Nov 2016 00:13:34 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Fri, 2 Dec 2016 00:52:34 +0100
tracing/rb: Convert to hotplug state machine
Install the callbacks via the state machine. The notifier in struct ring_buffer is replaced by the multi instance interface. Upon __ring_buffer_alloc() invocation, cpuhp_state_add_instance() will invoke the trace_rb_cpu_prepare() on each CPU.
This callback may now fail. This means __ring_buffer_alloc() will fail and cleanup (like previously) and during a CPU up event this failure will not allow the CPU to come up.
--- include/linux/cpuhotplug.h | 1 + include/linux/ring_buffer.h | 6 ++ kernel/trace/ring_buffer.c | 135 +++++++++++++++----------------------------- kernel/trace/trace.c | 15 ++++- 4 files changed, 66 insertions(+), 91 deletions(-)
include/linux/cpuhotplug.h +1 -0
@@ -62,6 +62,7 @@ enum cpuhp_state {CPUHP_TOPOLOGY_PREPARE ,CPUHP_NET_IUCV_PREPARE ,CPUHP_ARM_BL_PREPARE , +CPUHP_TRACE_RB_PREPARE ,CPUHP_TIMERS_DEAD ,CPUHP_NOTF_ERR_INJ_PREPARE , CPUHP_MIPS_SOC_PREPARE,
include/linux/ring_buffer.h +6 -0
@@ -198,4 +198,10 @@ enum ring_buffer_flags { RB_FL_OVERWRITE = 1 << 0, }; +#ifdef CONFIG_RING_BUFFER +int trace_rb_cpu_prepare (unsigned int cpu,struct hlist_node *node); +#else +#define trace_rb_cpu_prepare NULL +#endif +#endif /* _LINUX_RING_BUFFER_H */
kernel/trace/ring_buffer.c +45 -90
196 lines not on this page · raw message
kernel/trace/trace.c +14 -1
@@ -7659,10 +7659,21 @@ __init static int tracer_alloc_buffers(void)raw_spin_lock_init (&global_trace.start_lock); +/* +* The prepare callbacks allocates some memory for the ring buffer. We +* don't free the buffer if the if the CPU goes down. If we were to free +* the buffer, then the user would lose any trace that was in the +* buffer. The memory will be removed once the "instance" is removed. +*/ + ret =cpuhp_setup_state_multi (CPUHP_TRACE_RB_PREPARE , +"trace/RB:preapre" , trace_rb_cpu_prepare, +NULL ); +if (ret <0 ) + goto out_free_cpumask;/* Used for event triggers */ temp_buffer =ring_buffer_alloc (PAGE_SIZE ,RB_FL_OVERWRITE );if (!temp_buffer) - goto out_free_cpumask; + goto out_rm_hp_state;if (trace_create_savedcmd () <0 ) goto out_free_temp_buffer;
@@ -7723,6 +7734,8 @@ out_free_savedcmd:free_saved_cmdlines_buffer (savedcmd); out_free_temp_buffer:ring_buffer_free (temp_buffer); +out_rm_hp_state: +cpuhp_remove_multi_state (CPUHP_TRACE_RB_PREPARE ); out_free_cpumask:free_cpumask_var (global_trace.tracing_cpumask); out_free_buffer_mask:
[linux-next] tracing/rb: NULL pointer dereference at trace_rb_cpu_prepare()
Hello.
----------
[ 1.909018] NMI watchdog: disabled (cpu0): hardware events not enabled [ 1.911813] smp: Bringing up secondary CPUs ... [ 1.913965] NMI watchdog: Shutting down hard lockup detector on all cpus [ 1.917208] x86: Booting SMP configuration: [ 1.919148] .... node #0, CPUs: #1[ 1.921275] Disabled fast string operations [ 1.922792] mce: CPU supports 0 MCE banks [ 1.925033] BUG: unable to handle kernel NULL pointer dereference at 0000000000000068 [ 1.928636] IP: trace_rb_cpu_prepare+0xc5/0x170 [ 1.930601] PGD 0 [ 1.931313] [ 1.932289] Oops: 0000 [#1] SMP DEBUG_PAGEALLOC [ 1.934234] Modules linked in: [ 1.935721] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.9.0-rc8-next-20161207 #5 [ 1.939107] Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 07/31/2013 [ 1.943443] task: ffff88022cff8040 task.stack: ffffc9000000c000 [ 1.945860] RIP: 0010:trace_rb_cpu_prepare+0xc5/0x170 [ 1.947991] RSP: 0000:ffffc9000000fd20 EFLAGS: 00010202 [ 1.950246] RAX: 0000000000000001 RBX: 0000000000000002 RCX: ffff88022e019738 [ 1.953094] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff88022e077dd8 [ 1.955911] RBP: ffffc9000000fd50 R08: 0000000000000040 R09: 0000000000000000 [ 1.958711] R10: 0000000000000001 R11: 0000000000000001 R12: 0000000000000002 [ 1.961586] R13: ffff88022e01ead0 R14: 0000000000000002 R15: 0000000000000001 [ 1.964426] FS: 0000000000000000(0000) GS:ffff88022e600000(0000) knlGS:0000000000000000 [ 1.967988] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 1.970350] CR2: 0000000000000068 CR3: 0000000001c0c000 CR4: 00000000001406f0 [ 1.973206] Call Trace: [ 1.974461] cpuhp_invoke_callback+0x45f/0x9e0 [ 1.976422] ? ring_buffer_record_is_on+0x20/0x20 [ 1.978424] cpuhp_up_callbacks+0x37/0xb0 [ 1.980239] _cpu_up+0x89/0xf0 [ 1.981705] do_cpu_up+0x85/0xb0 [ 1.983230] cpu_up+0x13/0x20 [ 1.984645] smp_init+0x6b/0xcc [ 1.986157] kernel_init_freeable+0x17d/0x2b1 [ 1.988065] ? kernel_init+0xe/0x110 [ 1.989687] ? _raw_spin_unlock_irq+0x2c/0x40 [ 1.991578] ? rest_init+0x140/0x140 [ 1.993215] kernel_init+0xe/0x110 [ 1.994815] ret_from_fork+0x2a/0x40 [ 1.996482] Code: b9 80 3d 20 7d b2 00 00 75 b0 48 89 7d d0 e8 ec 7e 04 00 44 8b 05 30 76 c1 00 48 8b 7d d0 eb 9a 49 8b 4d f8 48 63 f0 48 8b 34 f1 <4c> 39 76 68 74 bf be 02 00 00 00 4e 8d 3c e1 49 8d bd 38 ff ff [ 2.006837] RIP: trace_rb_cpu_prepare+0xc5/0x170 RSP: ffffc9000000fd20 [ 2.009441] CR2: 0000000000000068 [ 2.011025] ---[ end trace 7da8119e80594e4e ]--- [ 2.013058] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009 [ 2.013058] [ 2.027641] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009 [ 2.027641]
----------
----------
4db8: eb 9a jmp 4d54 <trace_rb_cpu_prepare+0x54>
/* fill in the size from first enabled cpu */
if (nr_pages == 0)
nr_pages = buffer->buffers[cpu_i]->nr_pages;
if (nr_pages != buffer->buffers[cpu_i]->nr_pages) {
4dba: 49 8b 4d f8 mov -0x8(%r13),%rcx
4dbe: 48 63 f0 movslq %eax,%rsi
4dc1: 48 8b 34 f1 mov (%rcx,%rsi,8),%rsi
4dc5: 4c 39 76 68 cmp %r14,0x68(%rsi) // trace_rb_cpu_prepare+0xc5 is here.
4dc9: 74 bf je 4d8a <trace_rb_cpu_prepare+0x8a>
4dcb: be 02 00 00 00 mov $0x2,%esi
}
}
/* allocate minimum pages, user can later expand it */----------
Kernel config is at http://I-love.SAKURA.ne.jp/tmp/config-4.9-rc8-next-20161207
and console log is at http://I-love.SAKURA.ne.jp/tmp/serial-20161207.txt.xz .
Regards.
PATCH 1/1 tracing/rb: init the CPU mask on allocation
Before commit b32614c03413 ("tracing/rb: Convert to hotplug state machine") the allocated cpumask was initialized to the mask of ONLINE or POSSIBLE CPUs. After the CPU hotplug changes the buffer initialisation moved to trace_rb_cpu_prepare() but I forgot to initially set the cpumask to zero. This is done now.
--- kernel/trace/ring_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/ring_buffer.c +1 -1
@@ -1297,7 +1297,7 @@ struct ring_buffer *__ring_buffer_alloc(unsigned long size, unsigned flags,if (!buffer)return NULL ; -if (!alloc_cpumask_var (&buffer->cpumask,GFP_KERNEL )) +if (!zalloc_cpumask_var (&buffer->cpumask,GFP_KERNEL )) goto fail_free_buffer; nr_pages =DIV_ROUND_UP (size,BUF_PAGE_SIZE );
Signature · 1 line
2.11.0
tip-bot for Sebastian Andrzej Siewior
merge bot[tip:smp/hotplug] tracing/rb: Init the CPU mask on allocation
tracing/rb: Init the CPU mask on allocation
Commit-ID: b18cc3de00ec3442cf40ac60787dbe0703b99e24 Gitweb: http://git.kernel.org/tip/b18cc3de00ec3442cf40ac60787dbe0703b99e24 Author: Sebastian Andrzej Siewior <[email protected]> AuthorDate: Wed, 7 Dec 2016 14:31:33 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Wed, 7 Dec 2016 14:36:21 +0100
tracing/rb: Init the CPU mask on allocation
Before commit b32614c03413 ("tracing/rb: Convert to hotplug state machine") the allocated cpumask was initialized to the mask of online or possible CPUs. After the CPU hotplug changes the buffer initialization moved to trace_rb_cpu_prepare() but the cpumask is allocated with alloc_cpumask() and therefor has random content. As a consequence the cpu buffers are not initialized and a later access dereferences a NULL pointer.
Use zalloc_cpumask() instead so trace_rb_cpu_prepare() initializes the buffers properly.
--- kernel/trace/ring_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/ring_buffer.c +1 -1
@@ -1297,7 +1297,7 @@ struct ring_buffer *__ring_buffer_alloc(unsigned long size, unsigned flags,if (!buffer)return NULL ; -if (!alloc_cpumask_var (&buffer->cpumask,GFP_KERNEL )) +if (!zalloc_cpumask_var (&buffer->cpumask,GFP_KERNEL )) goto fail_free_buffer; nr_pages =DIV_ROUND_UP (size,BUF_PAGE_SIZE );
Re: [PATCH] tracing/rb: init the CPU mask on allocation
In reply to Sebastian Andrzej SiewiorQuoted 9 lines · Sebastian Andrzej Siewior
Before commit
b32614c03413("tracing/rb: Convert to hotplug state machine") the allocated cpumask was initialized to the mask of ONLINE or POSSIBLE CPUs. After the CPU hotplug changes the buffer initialisation moved totrace_rb_cpu_prepare()but I forgot to initially set the cpumask to zero. This is done now.Fixes b32614c03413 ("tracing/rb: Convert to hotplug state machine")Reported-by Tetsuo Handa <[email protected]>Signed-off-by Sebastian Andrzej Siewior <[email protected]>
The system can boot now. Thank you.
Quoted 19 lines
--- kernel/trace/ring_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/trace/ring_buffer.c +1
-1@@ -1297,7 +1297,7 @@ struct ring_buffer *__ring_buffer_alloc(unsigned long size, unsigned flags,if (!buffer)return NULL ; -if (!alloc_cpumask_var (&buffer->cpumask,GFP_KERNEL )) +if (!zalloc_cpumask_var (&buffer->cpumask,GFP_KERNEL )) goto fail_free_buffer; nr_pages =DIV_ROUND_UP (size,BUF_PAGE_SIZE );Signature · 1 line
2.11.0
PATCH 7/22 mm/vmstat: Drop get_online_cpus() from init_cpu_node_state/vmstat_cpu_dead()
In reply to Sebastian Andrzej SiewiorBoth functions are called with protection against cpu hotplug already so *_online_cpus() could be dropped.
--- mm/vmstat.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
mm/vmstat.c +1 -6
@@ -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 (); }/*
Signature · 7 lines
2.10.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 07/22] mm/vmstat: Drop get_online_cpus() from init_cpu_node_state/vmstat_cpu_dead()
Quoted 9 lines · Sebastian Andrzej Siewior
Both functions are called with protection against cpu hotplug already so
*_online_cpus()could be dropped.Cc Andrew Morton <[email protected]>Cc Vlastimil Babka <[email protected]>Cc Mel Gorman <[email protected]>Cc Johannes Weiner <[email protected]>Signed-off-by Sebastian Andrzej Siewior <[email protected]>
Quoted 42 lines
--- mm/vmstat.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)mm/vmstat.c +1
-6@@ -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 (); }/* Signature · 7 lines
2.10.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Signature · 8 lines
Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
tip-bot for Sebastian Andrzej Siewior
merge bot[tip:smp/hotplug] mm/vmstat: Drop get_online_cpus() from init_cpu_node_state/vmstat_cpu_dead()
In reply to Sebastian Andrzej Siewiormm/vmstat: Drop get_online_cpus() from init_cpu_node_state/vmstat_cpu_dead()
Commit-ID: 76f290935b1a395ee6c9a14697f16593591d1fe8 Gitweb: http://git.kernel.org/tip/76f290935b1a395ee6c9a14697f16593591d1fe8 Author: Sebastian Andrzej Siewior <[email protected]> AuthorDate: Sun, 27 Nov 2016 00:13:35 +0100 Committer: Thomas Gleixner <[email protected]> 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.
--- mm/vmstat.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
mm/vmstat.c +1 -6
@@ -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 (); }/*
PATCH 8/22 mm/vmstat: Avoid on each online CPU loops
In reply to Sebastian Andrzej SiewiorBoth iterations over online cpus can be replaced by the proper node specific functions.
--- mm/vmstat.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
mm/vmstat.c +7 -7
@@ -1720,19 +1720,19 @@ static void __init start_shepherd_timer(void)static void __init init_cpu_node_state (void ) { -int cpu; +int node; -for_each_online_cpu (cpu) -node_set_state (cpu_to_node (cpu),N_CPU ); +for_each_online_node (node) +node_set_state (node,N_CPU ); }static void vmstat_cpu_dead (int node) { -int cpu; +const struct cpumask *node_cpus; -for_each_online_cpu (cpu) -if (cpu_to_node (cpu) == node) -return ; + node_cpus =cpumask_of_node (node); +if (cpumask_weight (node_cpus) >0 ) +return ;node_clear_state (node,N_CPU ); }
Signature · 7 lines
2.10.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 08/22] mm/vmstat: Avoid on each online CPU loops
On Sun 27-11-16 00:13:36, Sebastian Andrzej Siewior wrote:
[...]
mm/vmstat.c static void __init start_shepherd_timer(void) · line 1726
Quoted 9 lines
static void
__initinit_cpu_node_state(void)
{mm/vmstat.c +3
-3-int cpu; +int node; -for_each_online_cpu (cpu) -node_set_state (cpu_to_node (cpu),N_CPU ); +for_each_online_node (node) +node_set_state (node,N_CPU );
Is this really correct? The point of the original code was to mark only those nodes which have at least one CPU. Or am I missing something?
mm/vmstat.c static void __init start_shepherd_timer(void) · line 1735
Quoted 13 lines
}
static void
vmstat_cpu_dead(int node)
{mm/vmstat.c +4
-4-int cpu; +const struct cpumask *node_cpus; -for_each_online_cpu (cpu) -if (cpu_to_node (cpu) == node) -return ; + node_cpus =cpumask_of_node (node); +if (cpumask_weight (node_cpus) >0 ) +return ;
This looks OK
Quoted 11 lines
node_clear_state(node, N_CPU);
}Signature · 7 lines
2.10.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Signature · 8 lines
Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 08/22] mm/vmstat: Avoid on each online CPU loops
Quoted 7 lines · Michal Hocko
On Sun 27-11-16 00:13:36, Sebastian Andrzej Siewior wrote:
[...]Quoted 5 lines
static void
__initinit_cpu_node_state(void)
{mm/vmstat.c +1
-1-int cpu; +int node;
Quoted 7 lines
mm/vmstat.c static void __init start_shepherd_timer(void) · line 1726
Quoted 4 lines
mm/vmstat.c +2
-2-for_each_online_cpu (cpu) -node_set_state (cpu_to_node (cpu),N_CPU ); +for_each_online_node (node) +node_set_state (node,N_CPU );Is this really correct? The point of the original code was to mark only those nodes which have at least one CPU. Or am I missing something?
You're right. An online node does not necessarily have an online CPU.
for_each_online_node(node) {
if (cpumask_weight(cpumask_of_node(node)) > 0)
node_set_state(node, N_CPU);
}is probably more correct.
Thanks,
tglx
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 08/22] mm/vmstat: Avoid on each online CPU loops
Quoted 16 lines · Thomas Gleixner
Quoted 7 lines · Michal Hocko
On Sun 27-11-16 00:13:36, Sebastian Andrzej Siewior wrote:
[...]Quoted 5 lines
static void
__initinit_cpu_node_state(void)
{mm/vmstat.c +1
-1-int cpu; +int node;Quoted 7 lines
mm/vmstat.c static void __init start_shepherd_timer(void) · line 1726
Quoted 4 lines
mm/vmstat.c +2
-2-for_each_online_cpu (cpu) -node_set_state (cpu_to_node (cpu),N_CPU ); +for_each_online_node (node) +node_set_state (node,N_CPU );Is this really correct? The point of the original code was to mark only those nodes which have at least one CPU. Or am I missing something?
Quoted 8 lines
You're right. An online node does not necessarily have an online CPU.
for_each_online_node(node) { if (cpumask_weight(cpumask_of_node(node)) > 0) node_set_state(node, N_CPU); }is probably more correct.
Yes, this looks correct. Considering that the same cpumask_weight is used in another function I guess a small helper would be nice. E.g. bool node_has_cpus(int node)
{
return cpumask_weight(cpumask_of_node(node)) > 0;
}Signature · 8 lines
Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH v2 8/22 mm/vmstat: Avoid on each online CPU loops
In reply to Thomas GleixnerBoth iterations over online cpus can be replaced by the proper node specific functions.
---
v1…v2: take into account that we may have online nodes with no CPUs.
mm/vmstat.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
mm/vmstat.c +9 -7
@@ -1720,19 +1720,21 @@ static void __init start_shepherd_timer(void)static void __init init_cpu_node_state (void ) { -int cpu; +int node; -for_each_online_cpu (cpu) -node_set_state (cpu_to_node (cpu),N_CPU ); +for_each_online_node (node) { +if (cpumask_weight (cpumask_of_node (node)) >0 ) +node_set_state (node,N_CPU ); + } }static void vmstat_cpu_dead (int node) { -int cpu; +const struct cpumask *node_cpus; -for_each_online_cpu (cpu) -if (cpu_to_node (cpu) == node) -return ; + node_cpus =cpumask_of_node (node); +if (cpumask_weight (node_cpus) >0 ) +return ;node_clear_state (node,N_CPU ); }
Signature · 7 lines
2.10.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 08/22 v2] mm/vmstat: Avoid on each online CPU loops
Quoted 9 lines · Sebastian Andrzej Siewior
Both iterations over online cpus can be replaced by the proper node specific functions.
Cc Andrew Morton <[email protected]>Cc Vlastimil Babka <[email protected]>Cc Mel Gorman <[email protected]>Cc Johannes Weiner <[email protected]>Signed-off-by Sebastian Andrzej Siewior <[email protected]>
Quoted 41 lines
---
v1a?|v2: take into account that we may have online nodes with no CPUs.mm/vmstat.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)mm/vmstat.c +9
-7@@ -1720,19 +1720,21 @@ static void __init start_shepherd_timer(void)static void __init init_cpu_node_state (void ) { -int cpu; +int node; -for_each_online_cpu (cpu) -node_set_state (cpu_to_node (cpu),N_CPU ); +for_each_online_node (node) { +if (cpumask_weight (cpumask_of_node (node)) >0 ) +node_set_state (node,N_CPU ); + } }static void vmstat_cpu_dead (int node) { -int cpu; +const struct cpumask *node_cpus; -for_each_online_cpu (cpu) -if (cpu_to_node (cpu) == node) -return ; + node_cpus =cpumask_of_node (node); +if (cpumask_weight (node_cpus) >0 ) +return ;node_clear_state (node,N_CPU ); }Signature · 1 line
2.10.2
Signature · 8 lines
Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
tip-bot for Sebastian Andrzej Siewior
merge bot[tip:smp/hotplug] mm/vmstat: Avoid on each online CPU loops
In reply to Sebastian Andrzej Siewiormm/vmstat: Avoid on each online CPU loops
Commit-ID: 4c501327b4c67f2b874219f20c41d2619b49c78c Gitweb: http://git.kernel.org/tip/4c501327b4c67f2b874219f20c41d2619b49c78c Author: Sebastian Andrzej Siewior <[email protected]> AuthorDate: Tue, 29 Nov 2016 15:51:14 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Fri, 2 Dec 2016 00:52:35 +0100
mm/vmstat: Avoid on each online CPU loops
Both iterations over online cpus can be replaced by the proper node specific functions.
--- mm/vmstat.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
mm/vmstat.c +9 -7
@@ -1720,19 +1720,21 @@ static void __init start_shepherd_timer(void)static void __init init_cpu_node_state (void ) { -int cpu; +int node; -for_each_online_cpu (cpu) -node_set_state (cpu_to_node (cpu),N_CPU ); +for_each_online_node (node) { +if (cpumask_weight (cpumask_of_node (node)) >0 ) +node_set_state (node,N_CPU ); + } }static void vmstat_cpu_dead (int node) { -int cpu; +const struct cpumask *node_cpus; -for_each_online_cpu (cpu) -if (cpu_to_node (cpu) == node) -return ; + node_cpus =cpumask_of_node (node); +if (cpumask_weight (node_cpus) >0 ) +return ;node_clear_state (node,N_CPU ); }
PATCH 9/22 mm/vmstat: Convert to hotplug state machine
In reply to Sebastian Andrzej SiewiorInstall the callbacks via the state machine, but do not invoke them as we can initialize the node state without calling the callbacks on all online CPUs.
start_shepherd_timer() is now called outside the get_online_cpus() block which is safe as it only operates on cpu possible mask.
--- include/linux/cpuhotplug.h | 1 + mm/vmstat.c | 76 +++++++++++++++++++++------------------------- 2 files changed, 36 insertions(+), 41 deletions(-)
include/linux/cpuhotplug.h +1 -0
@@ -20,6 +20,7 @@ enum cpuhp_state {CPUHP_VIRT_NET_DEAD ,CPUHP_SLUB_DEAD ,CPUHP_MM_WRITEBACK_DEAD , +CPUHP_MM_VMSTAT_DEAD ,CPUHP_SOFTIRQ_DEAD ,CPUHP_NET_MVNETA_DEAD , CPUHP_CPUIDLE_DEAD,
mm/vmstat.c +35 -41
99 lines not on this page · raw message
Signature · 7 lines
2.10.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH v2 9/22 mm/vmstat: Convert to hotplug state machine
Install the callbacks via the state machine, but do not invoke them as we can initialize the node state without calling the callbacks on all online CPUs.
start_shepherd_timer() is now called outside the get_online_cpus() block which is safe as it only operates on cpu possible mask.
---
v1…v2: rebase on top of PATCH 08/22 v2.
include/linux/cpuhotplug.h | 1 + mm/vmstat.c | 76 +++++++++++++++++++++------------------------- 2 files changed, 36 insertions(+), 41 deletions(-)
include/linux/cpuhotplug.h +1 -0
@@ -20,6 +20,7 @@ enum cpuhp_state {CPUHP_VIRT_NET_DEAD ,CPUHP_SLUB_DEAD ,CPUHP_MM_WRITEBACK_DEAD , +CPUHP_MM_VMSTAT_DEAD ,CPUHP_SOFTIRQ_DEAD ,CPUHP_NET_MVNETA_DEAD , CPUHP_CPUIDLE_DEAD,
mm/vmstat.c +35 -41
99 lines not on this page · raw message
Signature · 7 lines
2.10.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
tip-bot for Sebastian Andrzej Siewior
merge bot[tip:smp/hotplug] mm/vmstat: Convert to hotplug state machine
mm/vmstat: Convert to hotplug state machine
Commit-ID: 5438da977f83c945d4e72ee4f9c4508c0eb64e15 Gitweb: http://git.kernel.org/tip/5438da977f83c945d4e72ee4f9c4508c0eb64e15 Author: Sebastian Andrzej Siewior <[email protected]> AuthorDate: Tue, 29 Nov 2016 15:52:21 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Fri, 2 Dec 2016 00:52:35 +0100
mm/vmstat: Convert to hotplug state machine
Install the callbacks via the state machine, but do not invoke them as we can initialize the node state without calling the callbacks on all online CPUs.
start_shepherd_timer() is now called outside the get_online_cpus() block which is safe as it only operates on cpu possible mask.
--- include/linux/cpuhotplug.h | 1 + mm/vmstat.c | 76 +++++++++++++++++++++------------------------- 2 files changed, 36 insertions(+), 41 deletions(-)
include/linux/cpuhotplug.h +1 -0
@@ -20,6 +20,7 @@ enum cpuhp_state {CPUHP_VIRT_NET_DEAD ,CPUHP_SLUB_DEAD ,CPUHP_MM_WRITEBACK_DEAD , +CPUHP_MM_VMSTAT_DEAD ,CPUHP_SOFTIRQ_DEAD ,CPUHP_NET_MVNETA_DEAD , CPUHP_CPUIDLE_DEAD,
mm/vmstat.c +35 -41
99 lines not on this page · raw message
PATCH 10/22 mm/zsmalloc: Convert to hotplug state machine
In reply to Sebastian Andrzej SiewiorInstall the callbacks via the state machine and let the core invoke the callbacks on the already online CPUs.
--- include/linux/cpuhotplug.h | 1 + mm/zsmalloc.c | 67 +++++++++------------------------------------- 2 files changed, 14 insertions(+), 54 deletions(-)
include/linux/cpuhotplug.h +1 -0
@@ -64,6 +64,7 @@ enum cpuhp_state {CPUHP_NET_IUCV_PREPARE ,CPUHP_ARM_BL_PREPARE ,CPUHP_TRACE_RB_PREPARE , +CPUHP_MM_ZS_PREPARE ,CPUHP_TIMERS_DEAD ,CPUHP_NOTF_ERR_INJ_PREPARE , CPUHP_MIPS_SOC_PREPARE,
mm/zsmalloc.c +13 -54
99 lines not on this page · raw message
Signature · 7 lines
2.10.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
tip-bot for Sebastian Andrzej Siewior
merge bot[tip:smp/hotplug] mm/zsmalloc: Convert to hotplug state machine
mm/zsmalloc: Convert to hotplug state machine
Commit-ID: 215c89d055e085c42cea4fd571a1d0db0b6d5648 Gitweb: http://git.kernel.org/tip/215c89d055e085c42cea4fd571a1d0db0b6d5648 Author: Sebastian Andrzej Siewior <[email protected]> AuthorDate: Sun, 27 Nov 2016 00:13:38 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Fri, 2 Dec 2016 00:52:36 +0100
mm/zsmalloc: Convert to hotplug state machine
Install the callbacks via the state machine and let the core invoke the callbacks on the already online CPUs.
--- include/linux/cpuhotplug.h | 1 + mm/zsmalloc.c | 67 +++++++++------------------------------------- 2 files changed, 14 insertions(+), 54 deletions(-)
include/linux/cpuhotplug.h +1 -0
@@ -64,6 +64,7 @@ enum cpuhp_state {CPUHP_NET_IUCV_PREPARE ,CPUHP_ARM_BL_PREPARE ,CPUHP_TRACE_RB_PREPARE , +CPUHP_MM_ZS_PREPARE ,CPUHP_TIMERS_DEAD ,CPUHP_NOTF_ERR_INJ_PREPARE , CPUHP_MIPS_SOC_PREPARE,
mm/zsmalloc.c +13 -54
99 lines not on this page · raw message
PATCH 11/22 mm/zswap: Convert dst-mem to hotplug state machine
In reply to Sebastian Andrzej SiewiorInstall the callbacks via the state machine and let the core invoke the callbacks on the already online CPUs.
--- include/linux/cpuhotplug.h | 1 + mm/zswap.c | 75 +++++++++++----------------------------------- 2 files changed, 19 insertions(+), 57 deletions(-)
include/linux/cpuhotplug.h +1 -0
@@ -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,
mm/zswap.c +18 -57
108 lines not on this page · raw message
Signature · 7 lines
2.10.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
tip-bot for Sebastian Andrzej Siewior
merge bot[tip:smp/hotplug] mm/zswap: Convert dst-mem to hotplug state machine
mm/zswap: Convert dst-mem to hotplug state machine
Commit-ID: ad7ed7708db9ff388450935645816d44bf08a56d Gitweb: http://git.kernel.org/tip/ad7ed7708db9ff388450935645816d44bf08a56d Author: Sebastian Andrzej Siewior <[email protected]> AuthorDate: Sun, 27 Nov 2016 00:13:39 +0100 Committer: Thomas Gleixner <[email protected]> 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.
--- include/linux/cpuhotplug.h | 1 + mm/zswap.c | 73 +++++++++++----------------------------------- 2 files changed, 18 insertions(+), 56 deletions(-)
include/linux/cpuhotplug.h +1 -0
@@ -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,
mm/zswap.c +17 -56
107 lines not on this page · raw message
PATCH 12/22 mm/zswap: Convert pool to hotplug state machine
In reply to Sebastian Andrzej SiewiorInstall the callbacks via the state machine. Multi state is used to address the per-pool notifier. Uppon adding of the intance the callback is invoked for all online CPUs so the manual init can go.
--- include/linux/cpuhotplug.h | 1 + mm/zswap.c | 99 ++++++++++++++++------------------------------ 2 files changed, 35 insertions(+), 65 deletions(-)
include/linux/cpuhotplug.h +1 -0
@@ -66,6 +66,7 @@ enum cpuhp_state {CPUHP_TRACE_RB_PREPARE ,CPUHP_MM_ZS_PREPARE ,CPUHP_MM_ZSWP_MEM_PREPARE , +CPUHP_MM_ZSWP_POOL_PREPARE ,CPUHP_TIMERS_DEAD ,CPUHP_NOTF_ERR_INJ_PREPARE , CPUHP_MIPS_SOC_PREPARE,
mm/zswap.c +34 -65
150 lines not on this page · raw message
Signature · 7 lines
2.10.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
tip-bot for Sebastian Andrzej Siewior
merge bot[tip:smp/hotplug] mm/zswap: Convert pool to hotplug state machine
mm/zswap: Convert pool to hotplug state machine
Commit-ID: cab7a7e5b6c5c2638b00c72559ff9fb715583c98 Gitweb: http://git.kernel.org/tip/cab7a7e5b6c5c2638b00c72559ff9fb715583c98 Author: Sebastian Andrzej Siewior <[email protected]> AuthorDate: Sun, 27 Nov 2016 00:13:40 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Fri, 2 Dec 2016 00:52:36 +0100
mm/zswap: Convert pool to hotplug state machine
Install the callbacks via the state machine. Multi state is used to address the per-pool notifier. Uppon adding of the intance the callback is invoked for all online CPUs so the manual init can go.
--- include/linux/cpuhotplug.h | 1 + mm/zswap.c | 99 ++++++++++++++++------------------------------ 2 files changed, 35 insertions(+), 65 deletions(-)
include/linux/cpuhotplug.h +1 -0
@@ -66,6 +66,7 @@ enum cpuhp_state {CPUHP_TRACE_RB_PREPARE ,CPUHP_MM_ZS_PREPARE ,CPUHP_MM_ZSWP_MEM_PREPARE , +CPUHP_MM_ZSWP_POOL_PREPARE ,CPUHP_TIMERS_DEAD ,CPUHP_NOTF_ERR_INJ_PREPARE , CPUHP_MIPS_SOC_PREPARE,
mm/zswap.c +34 -65
150 lines not on this page · raw message
PATCH 13/22 iommu/vt-d: Convert to hotplug state machine
In reply to Sebastian Andrzej SiewiorFrom: Anna-Maria Gleixner <[email protected]>
Install the callbacks via the state machine.
--- drivers/iommu/intel-iommu.c | 24 ++++++------------------ include/linux/cpuhotplug.h | 1 + 2 files changed, 7 insertions(+), 18 deletions(-)
drivers/iommu/intel-iommu.c +6 -18
@@ -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 ;
include/linux/cpuhotplug.h +1 -0
@@ -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,
Signature · 1 line
2.10.2
tip-bot for Anna-Maria Gleixner
merge bot[tip:smp/hotplug] iommu/vt-d: Convert to hotplug state machine
iommu/vt-d: Convert to hotplug state machine
Commit-ID: 21647615db288d9dacad0de6a5df846b39d51bea Gitweb: http://git.kernel.org/tip/21647615db288d9dacad0de6a5df846b39d51bea Author: Anna-Maria Gleixner <[email protected]> AuthorDate: Sun, 27 Nov 2016 00:13:41 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Fri, 2 Dec 2016 00:52:37 +0100
iommu/vt-d: Convert to hotplug state machine
Install the callbacks via the state machine.
--- drivers/iommu/intel-iommu.c | 24 ++++++------------------ include/linux/cpuhotplug.h | 1 + 2 files changed, 7 insertions(+), 18 deletions(-)
drivers/iommu/intel-iommu.c +6 -18
@@ -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 ;
include/linux/cpuhotplug.h +1 -0
@@ -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,
PATCH 14/22 mm/compaction: Convert to hotplug state machine
In reply to Sebastian Andrzej SiewiorFrom: Anna-Maria Gleixner <[email protected]>
Install the callbacks via the state machine. Should the hotplug init fail then no threads are spawned.
--- mm/compaction.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-)
mm/compaction.c +18 -13
@@ -2043,33 +2043,38 @@ void kcompactd_stop(int nid)* away, we get changed to run anywhere: as the first one comes back, * restore their cpu bindings. */ -static int cpu_callback (struct notifier_block *nfb,unsigned long action, -void *hcpu) +static int kcompactd_cpu_online (unsigned int cpu) {int nid; -if (action ==CPU_ONLINE || action ==CPU_ONLINE_FROZEN ) { -for_each_node_state (nid,N_MEMORY ) { -pg_data_t *pgdat =NODE_DATA (nid); -const struct cpumask *mask; +for_each_node_state (nid,N_MEMORY ) { +pg_data_t *pgdat =NODE_DATA (nid); +const struct cpumask *mask; - mask =cpumask_of_node (pgdat->node_id); + mask =cpumask_of_node (pgdat->node_id); -if (cpumask_any_and (cpu_online_mask, mask) < nr_cpu_ids) -/* One of our CPUs online: restore mask */ -set_cpus_allowed_ptr (pgdat->kcompactd, mask); - } +if (cpumask_any_and (cpu_online_mask, mask) < nr_cpu_ids) +/* One of our CPUs online: restore mask */ +set_cpus_allowed_ptr (pgdat->kcompactd, mask); } -return NOTIFY_OK ; +return 0 ; }static int __init kcompactd_init (void ) {int nid; +int ret; + + ret =cpuhp_setup_state_nocalls (CPUHP_AP_ONLINE_DYN , +"mm/compaction:online" , + kcompactd_cpu_online,NULL ); +if (ret <0 ) { +pr_err ("kcompactd: failed to register hotplug callbacks.\n" ); +return ret; + }for_each_node_state (nid,N_MEMORY )kcompactd_run (nid); -hotcpu_notifier (cpu_callback,0 );return 0 ; }subsys_initcall (kcompactd_init)
Signature · 7 lines
2.10.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
tip-bot for Anna-Maria Gleixner
merge bot[tip:smp/hotplug] mm/compaction: Convert to hotplug state machine
mm/compaction: Convert to hotplug state machine
Commit-ID: e46b1db249d83bb19b6bdbed2b2e2ff3858cd211 Gitweb: http://git.kernel.org/tip/e46b1db249d83bb19b6bdbed2b2e2ff3858cd211 Author: Anna-Maria Gleixner <[email protected]> AuthorDate: Sun, 27 Nov 2016 00:13:42 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Fri, 2 Dec 2016 00:52:37 +0100
mm/compaction: Convert to hotplug state machine
Install the callbacks via the state machine. Should the hotplug init fail then no threads are spawned.
--- mm/compaction.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-)
mm/compaction.c +18 -13
@@ -2043,33 +2043,38 @@ void kcompactd_stop(int nid)* away, we get changed to run anywhere: as the first one comes back, * restore their cpu bindings. */ -static int cpu_callback (struct notifier_block *nfb,unsigned long action, -void *hcpu) +static int kcompactd_cpu_online (unsigned int cpu) {int nid; -if (action ==CPU_ONLINE || action ==CPU_ONLINE_FROZEN ) { -for_each_node_state (nid,N_MEMORY ) { -pg_data_t *pgdat =NODE_DATA (nid); -const struct cpumask *mask; +for_each_node_state (nid,N_MEMORY ) { +pg_data_t *pgdat =NODE_DATA (nid); +const struct cpumask *mask; - mask =cpumask_of_node (pgdat->node_id); + mask =cpumask_of_node (pgdat->node_id); -if (cpumask_any_and (cpu_online_mask, mask) < nr_cpu_ids) -/* One of our CPUs online: restore mask */ -set_cpus_allowed_ptr (pgdat->kcompactd, mask); - } +if (cpumask_any_and (cpu_online_mask, mask) < nr_cpu_ids) +/* One of our CPUs online: restore mask */ +set_cpus_allowed_ptr (pgdat->kcompactd, mask); } -return NOTIFY_OK ; +return 0 ; }static int __init kcompactd_init (void ) {int nid; +int ret; + + ret =cpuhp_setup_state_nocalls (CPUHP_AP_ONLINE_DYN , +"mm/compaction:online" , + kcompactd_cpu_online,NULL ); +if (ret <0 ) { +pr_err ("kcompactd: failed to register hotplug callbacks.\n" ); +return ret; + }for_each_node_state (nid,N_MEMORY )kcompactd_run (nid); -hotcpu_notifier (cpu_callback,0 );return 0 ; }subsys_initcall (kcompactd_init)
PATCH 15/22 arm64/cpuinfo: Make hotplug notifier symmetric
In reply to Sebastian Andrzej SiewiorFrom: Anna-Maria Gleixner <[email protected]>
There is no requirement to keep the sysfs files around until the CPU is completely dead. Remove them during the DOWN_PREPARE notification. This is a preparatory patch for converting to the hotplug state machine.
--- arch/arm64/kernel/cpuinfo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/kernel/cpuinfo.c +2 -1
@@ -272,9 +272,10 @@ static int cpuid_callback(struct notifier_block *nb,switch (action & ~CPU_TASKS_FROZEN ) {case CPU_ONLINE : +case CPU_DOWN_FAILED : rc =cpuid_add_regs (cpu);break ; -case CPU_DEAD : +case CPU_DOWN_PREPARE : rc =cpuid_remove_regs (cpu);break ; }
Signature · 1 line
2.10.2
Re: [PATCH 15/22] arm64/cpuinfo: Make hotplug notifier symmetric
Quoted 21 lines · Sebastian Andrzej Siewior
From: Anna-Maria Gleixner <[email protected]>
There is no requirement to keep the sysfs files around until the CPU is completely dead. Remove them during the
DOWN_PREPAREnotification. This is a preparatory patch for converting to the hotplug state machine.Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc linux-arm-kernel at lists.infradead.orgSigned-off-by Anna-Maria Gleixner <[email protected]>Signed-off-by Sebastian Andrzej Siewior <[email protected]>--- arch/arm64/kernel/cpuinfo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)arch/arm64/kernel/cpuinfo.c +0
-0@@ -272,9 +272,10 @@ static int cpuid_callback(struct notifier_block *nb,
arch/arm64/kernel/cpuinfo.c static int cpuid_callback(struct notifier_block *nb, · line 281
Quoted 10 lines
arch/arm64/kernel/cpuinfo.c +2
-1switch (action & ~CPU_TASKS_FROZEN ) {case CPU_ONLINE : +case CPU_DOWN_FAILED : rc =cpuid_add_regs (cpu);break ; -case CPU_DEAD : +case CPU_DOWN_PREPARE : rc =cpuid_remove_regs (cpu);break ; }
Looks reasonable to me:
tip-bot for Anna-Maria Gleixner
merge bot[tip:smp/hotplug] arm64/cpuinfo: Make hotplug notifier symmetric
In reply to Sebastian Andrzej Siewiorarm64/cpuinfo: Make hotplug notifier symmetric
Commit-ID: 914fb85f01571233af199a78ed1f88d9268421fd Gitweb: http://git.kernel.org/tip/914fb85f01571233af199a78ed1f88d9268421fd Author: Anna-Maria Gleixner <[email protected]> AuthorDate: Sun, 27 Nov 2016 00:13:43 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Fri, 2 Dec 2016 00:52:37 +0100
arm64/cpuinfo: Make hotplug notifier symmetric
There is no requirement to keep the sysfs files around until the CPU is completely dead. Remove them during the DOWN_PREPARE notification. This is a preparatory patch for converting to the hotplug state machine.
--- arch/arm64/kernel/cpuinfo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/kernel/cpuinfo.c +2 -1
@@ -272,9 +272,10 @@ static int cpuid_callback(struct notifier_block *nb,switch (action & ~CPU_TASKS_FROZEN ) {case CPU_ONLINE : +case CPU_DOWN_FAILED : rc =cpuid_add_regs (cpu);break ; -case CPU_DEAD : +case CPU_DOWN_PREPARE : rc =cpuid_remove_regs (cpu);break ; }
PATCH 16/22 arm64/cpuinfo: Convert to hotplug state machine
In reply to Sebastian Andrzej SiewiorFrom: Anna-Maria Gleixner <[email protected]>
Install the callbacks via the state machine and let the core invoke the callbacks on the already online CPUs.
--- arch/arm64/kernel/cpuinfo.c | 37 +++++++++---------------------------- 1 file changed, 9 insertions(+), 28 deletions(-)
arch/arm64/kernel/cpuinfo.c +9 -28
@@ -227,7 +227,7 @@ static struct attribute_group cpuregs_attr_group = { .name = "identification" }; -static int cpuid_add_regs (int cpu) +static int cpuid_cpu_online (unsigned int cpu) {int rc;struct device *dev;
@@ -248,7 +248,7 @@ static int cpuid_add_regs(int cpu)return rc; } -static int cpuid_remove_regs (int cpu) +static int cpuid_cpu_offline (unsigned int cpu) {struct device *dev;struct cpuinfo_arm64 *info = &per_cpu (cpu_data, cpu);
@@ -264,41 +264,22 @@ static int cpuid_remove_regs(int cpu)return 0 ; } -static int cpuid_callback (struct notifier_block *nb, -unsigned long action,void *hcpu) -{ -int rc =0 ; -unsigned long cpu = (unsigned long )hcpu; - -switch (action & ~CPU_TASKS_FROZEN ) { -case CPU_ONLINE : -case CPU_DOWN_FAILED : - rc =cpuid_add_regs (cpu); -break ; -case CPU_DOWN_PREPARE : - rc =cpuid_remove_regs (cpu); -break ; - } - -return notifier_from_errno (rc); -} -static int __init cpuinfo_regs_init (void ) { -int cpu; - -cpu_notifier_register_begin (); +int cpu, ret;for_each_possible_cpu (cpu) {struct cpuinfo_arm64 *info = &per_cpu (cpu_data, cpu);kobject_init (&info->kobj, &cpuregs_kobj_type); -if (cpu_online (cpu)) -cpuid_add_regs (cpu); } -__hotcpu_notifier (cpuid_callback,0 ); -cpu_notifier_register_done (); + ret =cpuhp_setup_state (CPUHP_AP_ONLINE_DYN ,"arm64/cpuinfo:online" , + cpuid_cpu_online, cpuid_cpu_offline); +if (ret <0 ) { +pr_err ("cpuinfo: failed to register hotplug callbacks.\n" ); +return ret; + }return 0 ; }static void cpuinfo_detect_icache_policy (struct cpuinfo_arm64 *info)
Signature · 1 line
2.10.2
Re: [PATCH 16/22] arm64/cpuinfo: Convert to hotplug state machine
Quoted 19 lines · Sebastian Andrzej Siewior
From: Anna-Maria Gleixner <[email protected]>
Install the callbacks via the state machine and let the core invoke the callbacks on the already online CPUs.
Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Cc linux-arm-kernel at lists.infradead.orgSigned-off-by Anna-Maria Gleixner <[email protected]>Signed-off-by Sebastian Andrzej Siewior <[email protected]>--- arch/arm64/kernel/cpuinfo.c | 37 +++++++++---------------------------- 1 file changed, 9 insertions(+), 28 deletions(-)arch/arm64/kernel/cpuinfo.c +0
-0@@ -227,7 +227,7 @@ static struct attribute_group cpuregs_attr_group = {
...
arch/arm64/kernel/cpuinfo.c static int cpuid_remove_regs(int cpu) · line 284
Quoted 8 lines
arch/arm64/kernel/cpuinfo.c +6
-0+ ret =cpuhp_setup_state (CPUHP_AP_ONLINE_DYN ,"arm64/cpuinfo:online" , + cpuid_cpu_online, cpuid_cpu_offline); +if (ret <0 ) { +pr_err ("cpuinfo: failed to register hotplug callbacks.\n" ); +return ret; + }return 0 ; }
tip-bot for Anna-Maria Gleixner
merge bot[tip:smp/hotplug] arm64/cpuinfo: Convert to hotplug state machine
In reply to Sebastian Andrzej Siewiorarm64/cpuinfo: Convert to hotplug state machine
Commit-ID: a7ce95e1741f2d866481c8138a84ce5af61eb219 Gitweb: http://git.kernel.org/tip/a7ce95e1741f2d866481c8138a84ce5af61eb219 Author: Anna-Maria Gleixner <[email protected]> AuthorDate: Sun, 27 Nov 2016 00:13:44 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Fri, 2 Dec 2016 00:52:38 +0100
arm64/cpuinfo: Convert to hotplug state machine
Install the callbacks via the state machine and let the core invoke the callbacks on the already online CPUs.
--- arch/arm64/kernel/cpuinfo.c | 37 +++++++++---------------------------- 1 file changed, 9 insertions(+), 28 deletions(-)
arch/arm64/kernel/cpuinfo.c +9 -28
@@ -227,7 +227,7 @@ static struct attribute_group cpuregs_attr_group = { .name = "identification" }; -static int cpuid_add_regs (int cpu) +static int cpuid_cpu_online (unsigned int cpu) {int rc;struct device *dev;
@@ -248,7 +248,7 @@ out:return rc; } -static int cpuid_remove_regs (int cpu) +static int cpuid_cpu_offline (unsigned int cpu) {struct device *dev;struct cpuinfo_arm64 *info = &per_cpu (cpu_data, cpu);
@@ -264,41 +264,22 @@ static int cpuid_remove_regs(int cpu)return 0 ; } -static int cpuid_callback (struct notifier_block *nb, -unsigned long action,void *hcpu) -{ -int rc =0 ; -unsigned long cpu = (unsigned long )hcpu; - -switch (action & ~CPU_TASKS_FROZEN ) { -case CPU_ONLINE : -case CPU_DOWN_FAILED : - rc =cpuid_add_regs (cpu); -break ; -case CPU_DOWN_PREPARE : - rc =cpuid_remove_regs (cpu); -break ; - } - -return notifier_from_errno (rc); -} -static int __init cpuinfo_regs_init (void ) { -int cpu; - -cpu_notifier_register_begin (); +int cpu, ret;for_each_possible_cpu (cpu) {struct cpuinfo_arm64 *info = &per_cpu (cpu_data, cpu);kobject_init (&info->kobj, &cpuregs_kobj_type); -if (cpu_online (cpu)) -cpuid_add_regs (cpu); } -__hotcpu_notifier (cpuid_callback,0 ); -cpu_notifier_register_done (); + ret =cpuhp_setup_state (CPUHP_AP_ONLINE_DYN ,"arm64/cpuinfo:online" , + cpuid_cpu_online, cpuid_cpu_offline); +if (ret <0 ) { +pr_err ("cpuinfo: failed to register hotplug callbacks.\n" ); +return ret; + }return 0 ; }static void cpuinfo_detect_icache_policy (struct cpuinfo_arm64 *info)
PATCH 17/22 KVM/PPC/Book3S HV: Convert to hotplug state machine
In reply to Sebastian Andrzej SiewiorFrom: Anna-Maria Gleixner <[email protected]>
Install the callbacks via the state machine.
--- arch/powerpc/kvm/book3s_hv.c | 48 ++++++++++---------------------------------- include/linux/cpuhotplug.h | 1 + 2 files changed, 12 insertions(+), 37 deletions(-)
arch/powerpc/kvm/book3s_hv.c +11 -37
@@ -2254,12 +2254,12 @@ static void post_guest_process(struct kvmppc_vcore *vc, bool is_master)* enter the guest. Only do this if it is the primary thread of the * core (not if a subcore) that is entering the guest. */ -static inline void kvmppc_clear_host_core (int cpu) +static inline int kvmppc_clear_host_core (unsigned int cpu) {int core;if (!kvmppc_host_rm_ops_hv ||cpu_thread_in_core (cpu)) -return ; +return 0 ;/* * Memory barrier can be omitted here as we will do a smp_wmb() * later in kvmppc_start_thread and we need ensure that state is
@@ -2267,6 +2267,7 @@ static inline void kvmppc_clear_host_core(int cpu)*/ core = cpu >> threads_shift; kvmppc_host_rm_ops_hv->rm_core[core].rm_state.in_host =0 ; +return 0 ; }/*
@@ -2274,12 +2275,12 @@ static inline void kvmppc_clear_host_core(int cpu)* Only need to do this if it is the primary thread of the core that is * exiting. */ -static inline void kvmppc_set_host_core (int cpu) +static inline int kvmppc_set_host_core (unsigned int cpu) {int core;if (!kvmppc_host_rm_ops_hv ||cpu_thread_in_core (cpu)) -return ; +return 0 ;/* * Memory barrier can be omitted here because we do a spin_unlock
@@ -2287,6 +2288,7 @@ static inline void kvmppc_set_host_core(int cpu)*/ core = cpu >> threads_shift; kvmppc_host_rm_ops_hv->rm_core[core].rm_state.in_host =1 ; +return 0 ; }/*
@@ -3094,36 +3096,6 @@ static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu) }#ifdef CONFIG_KVM_XICS -static int kvmppc_cpu_notify (struct notifier_block *self,unsigned long action, -void *hcpu) -{ -unsigned long cpu = (long )hcpu; - -switch (action) { -case CPU_UP_PREPARE : -case CPU_UP_PREPARE_FROZEN : -kvmppc_set_host_core (cpu); -break ; - -#ifdef CONFIG_HOTPLUG_CPU -case CPU_DEAD : -case CPU_DEAD_FROZEN : -case CPU_UP_CANCELED : -case CPU_UP_CANCELED_FROZEN : -kvmppc_clear_host_core (cpu); -break ; -#endif -default : -break ; - } - -return NOTIFY_OK ; -} - -static struct notifier_block kvmppc_cpu_notifier = { - .notifier_call = kvmppc_cpu_notify, -}; -/* * Allocate a per-core structure for managing state about which cores are * running in the host versus the guest and for exchanging data between
@@ -3185,15 +3157,17 @@ void kvmppc_alloc_host_rm_ops(void)return ; } -register_cpu_notifier (&kvmppc_cpu_notifier); - +cpuhp_setup_state_nocalls (CPUHP_KVM_PPC_BOOK3S_PREPARE , +"ppc/kvm_book3s:prepare" , + kvmppc_set_host_core, + kvmppc_clear_host_core);put_online_cpus (); }void kvmppc_free_host_rm_ops (void ) {if (kvmppc_host_rm_ops_hv) { -unregister_cpu_notifier (&kvmppc_cpu_notifier); +cpuhp_remove_state_nocalls (CPUHP_KVM_PPC_BOOK3S_PREPARE );kfree (kvmppc_host_rm_ops_hv->rm_core);kfree (kvmppc_host_rm_ops_hv); kvmppc_host_rm_ops_hv =NULL ;
include/linux/cpuhotplug.h +1 -0
@@ -68,6 +68,7 @@ enum cpuhp_state {CPUHP_MM_ZS_PREPARE ,CPUHP_MM_ZSWP_MEM_PREPARE ,CPUHP_MM_ZSWP_POOL_PREPARE , +CPUHP_KVM_PPC_BOOK3S_PREPARE ,CPUHP_TIMERS_DEAD ,CPUHP_NOTF_ERR_INJ_PREPARE , CPUHP_MIPS_SOC_PREPARE,
Signature · 1 line
2.10.2
tip-bot for Anna-Maria Gleixner
merge bot[tip:smp/hotplug] KVM/PPC/Book3S HV: Convert to hotplug state machine
KVM/PPC/Book3S HV: Convert to hotplug state machine
Commit-ID: 3f7cd919f3df05918535de39273174710409eb40 Gitweb: http://git.kernel.org/tip/3f7cd919f3df05918535de39273174710409eb40 Author: Anna-Maria Gleixner <[email protected]> AuthorDate: Sun, 27 Nov 2016 00:13:45 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Fri, 2 Dec 2016 00:52:38 +0100
KVM/PPC/Book3S HV: Convert to hotplug state machine
Install the callbacks via the state machine.
--- arch/powerpc/kvm/book3s_hv.c | 48 ++++++++++---------------------------------- include/linux/cpuhotplug.h | 1 + 2 files changed, 12 insertions(+), 37 deletions(-)
arch/powerpc/kvm/book3s_hv.c +11 -37
@@ -2254,12 +2254,12 @@ static void post_guest_process(struct kvmppc_vcore *vc, bool is_master)* enter the guest. Only do this if it is the primary thread of the * core (not if a subcore) that is entering the guest. */ -static inline void kvmppc_clear_host_core (int cpu) +static inline int kvmppc_clear_host_core (unsigned int cpu) {int core;if (!kvmppc_host_rm_ops_hv ||cpu_thread_in_core (cpu)) -return ; +return 0 ;/* * Memory barrier can be omitted here as we will do a smp_wmb() * later in kvmppc_start_thread and we need ensure that state is
@@ -2267,6 +2267,7 @@ static inline void kvmppc_clear_host_core(int cpu)*/ core = cpu >> threads_shift; kvmppc_host_rm_ops_hv->rm_core[core].rm_state.in_host =0 ; +return 0 ; }/*
@@ -2274,12 +2275,12 @@ static inline void kvmppc_clear_host_core(int cpu)* Only need to do this if it is the primary thread of the core that is * exiting. */ -static inline void kvmppc_set_host_core (int cpu) +static inline int kvmppc_set_host_core (unsigned int cpu) {int core;if (!kvmppc_host_rm_ops_hv ||cpu_thread_in_core (cpu)) -return ; +return 0 ;/* * Memory barrier can be omitted here because we do a spin_unlock
@@ -2287,6 +2288,7 @@ static inline void kvmppc_set_host_core(int cpu)*/ core = cpu >> threads_shift; kvmppc_host_rm_ops_hv->rm_core[core].rm_state.in_host =1 ; +return 0 ; }/*
@@ -3094,36 +3096,6 @@ static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu) }#ifdef CONFIG_KVM_XICS -static int kvmppc_cpu_notify (struct notifier_block *self,unsigned long action, -void *hcpu) -{ -unsigned long cpu = (long )hcpu; - -switch (action) { -case CPU_UP_PREPARE : -case CPU_UP_PREPARE_FROZEN : -kvmppc_set_host_core (cpu); -break ; - -#ifdef CONFIG_HOTPLUG_CPU -case CPU_DEAD : -case CPU_DEAD_FROZEN : -case CPU_UP_CANCELED : -case CPU_UP_CANCELED_FROZEN : -kvmppc_clear_host_core (cpu); -break ; -#endif -default : -break ; - } - -return NOTIFY_OK ; -} - -static struct notifier_block kvmppc_cpu_notifier = { - .notifier_call = kvmppc_cpu_notify, -}; -/* * Allocate a per-core structure for managing state about which cores are * running in the host versus the guest and for exchanging data between
@@ -3185,15 +3157,17 @@ void kvmppc_alloc_host_rm_ops(void)return ; } -register_cpu_notifier (&kvmppc_cpu_notifier); - +cpuhp_setup_state_nocalls (CPUHP_KVM_PPC_BOOK3S_PREPARE , +"ppc/kvm_book3s:prepare" , + kvmppc_set_host_core, + kvmppc_clear_host_core);put_online_cpus (); }void kvmppc_free_host_rm_ops (void ) {if (kvmppc_host_rm_ops_hv) { -unregister_cpu_notifier (&kvmppc_cpu_notifier); +cpuhp_remove_state_nocalls (CPUHP_KVM_PPC_BOOK3S_PREPARE );kfree (kvmppc_host_rm_ops_hv->rm_core);kfree (kvmppc_host_rm_ops_hv); kvmppc_host_rm_ops_hv =NULL ;
include/linux/cpuhotplug.h +1 -0
@@ -68,6 +68,7 @@ enum cpuhp_state {CPUHP_MM_ZS_PREPARE ,CPUHP_MM_ZSWP_MEM_PREPARE ,CPUHP_MM_ZSWP_POOL_PREPARE , +CPUHP_KVM_PPC_BOOK3S_PREPARE ,CPUHP_TIMERS_DEAD ,CPUHP_NOTF_ERR_INJ_PREPARE , CPUHP_MIPS_SOC_PREPARE,
PATCH 18/22 zram: Convert to hotplug state machine
In reply to Sebastian Andrzej SiewiorFrom: Anna-Maria Gleixner <[email protected]>
Install the callbacks via the state machine with multi instance support and let the core invoke the callbacks on the already online CPUs.
--- drivers/block/zram/zcomp.c | 76 ++++++++++++++----------------------------- drivers/block/zram/zcomp.h | 5 +-- drivers/block/zram/zram_drv.c | 9 +++++ include/linux/cpuhotplug.h | 1 + 4 files changed, 38 insertions(+), 53 deletions(-)
drivers/block/zram/zcomp.c +25 -51
@@ -160,82 +160,56 @@ int zcomp_decompress(struct zcomp_strm *zstrm, dst, &dst_len); } -static int __zcomp_cpu_notifier (struct zcomp *comp, -unsigned long action,unsigned long cpu) +int zcomp_cpu_up_prepare (unsigned int cpu,struct hlist_node *node) { + struct zcomp *comp = hlist_entry(node, struct zcomp, node);struct zcomp_strm *zstrm; -switch (action) { -case CPU_UP_PREPARE : -if (WARN_ON (*per_cpu_ptr (comp->stream, cpu))) -break ; - zstrm =zcomp_strm_alloc (comp); -if (IS_ERR_OR_NULL (zstrm)) { -pr_err ("Can't allocate a compression stream\n" ); -return NOTIFY_BAD ; - } - *per_cpu_ptr (comp->stream, cpu) = zstrm; -break ; -case CPU_DEAD : -case CPU_UP_CANCELED : - zstrm = *per_cpu_ptr (comp->stream, cpu); -if (!IS_ERR_OR_NULL (zstrm)) -zcomp_strm_free (zstrm); - *per_cpu_ptr (comp->stream, cpu) =NULL ; -break ; -default : -break ; +if (WARN_ON (*per_cpu_ptr (comp->stream, cpu))) +return 0 ; + + zstrm =zcomp_strm_alloc (comp); +if (IS_ERR_OR_NULL (zstrm)) { +pr_err ("Can't allocate a compression stream\n" ); +return -ENOMEM ; } -return NOTIFY_OK ; + *per_cpu_ptr (comp->stream, cpu) = zstrm; +return 0 ; } -static int zcomp_cpu_notifier (struct notifier_block *nb, -unsigned long action,void *pcpu) +int zcomp_cpu_dead (unsigned int cpu,struct hlist_node *node) { -unsigned long cpu = (unsigned long )pcpu; -struct zcomp *comp =container_of (nb,typeof (*comp), notifier); + struct zcomp *comp = hlist_entry(node, struct zcomp, node); +struct zcomp_strm *zstrm; -return __zcomp_cpu_notifier (comp, action, cpu); + zstrm = *per_cpu_ptr (comp->stream, cpu); +if (!IS_ERR_OR_NULL (zstrm)) +zcomp_strm_free (zstrm); + *per_cpu_ptr (comp->stream, cpu) =NULL ; +return 0 ; }static int zcomp_init (struct zcomp *comp) { -unsigned long cpu;int ret; - comp->notifier.notifier_call = zcomp_cpu_notifier; - comp->stream = alloc_percpu(struct zcomp_strm *);if (!comp->stream)return -ENOMEM ; -cpu_notifier_register_begin (); -for_each_online_cpu (cpu) { - ret =__zcomp_cpu_notifier (comp,CPU_UP_PREPARE , cpu); -if (ret ==NOTIFY_BAD ) - goto cleanup; - } -__register_cpu_notifier (&comp->notifier); -cpu_notifier_register_done (); + ret =cpuhp_state_add_instance (CPUHP_ZCOMP_PREPARE , &comp->node); +if (ret <0 ) + goto cleanup;return 0 ; cleanup: -for_each_online_cpu (cpu) -__zcomp_cpu_notifier (comp,CPU_UP_CANCELED , cpu); -cpu_notifier_register_done (); -return -ENOMEM ; +free_percpu (comp->stream); +return ret; }void zcomp_destroy (struct zcomp *comp) { -unsigned long cpu; - -cpu_notifier_register_begin (); -for_each_online_cpu (cpu) -__zcomp_cpu_notifier (comp,CPU_UP_CANCELED , cpu); -__unregister_cpu_notifier (&comp->notifier); -cpu_notifier_register_done (); - +cpuhp_state_remove_instance (CPUHP_ZCOMP_PREPARE , &comp->node);free_percpu (comp->stream);kfree (comp); }
drivers/block/zram/zcomp.h +3 -2
@@ -19,11 +19,12 @@ struct zcomp_strm {/* dynamic per-device compression frontend */ struct zcomp {struct zcomp_strm *__percpu *stream; -struct notifier_block notifier; -const char *name; +struct hlist_node node; }; +int zcomp_cpu_up_prepare (unsigned int cpu,struct hlist_node *node); +int zcomp_cpu_dead (unsigned int cpu,struct hlist_node *node);ssize_t zcomp_available_show (const char *comp,char *buf);bool zcomp_available_algorithm (const char *comp);
drivers/block/zram/zram_drv.c +9 -0
@@ -30,6 +30,7 @@#include <linux/err.h> #include <linux/idr.h> #include <linux/sysfs.h> +#include <linux/cpuhotplug.h> #include "zram_drv.h"
@@ -1436,15 +1437,22 @@ static void destroy_devices(void)idr_for_each (&zram_index_idr, &zram_remove_cb,NULL );idr_destroy (&zram_index_idr);unregister_blkdev (zram_major,"zram" ); +cpuhp_remove_multi_state (CPUHP_ZCOMP_PREPARE ); }static int __init zram_init (void ) {int ret; + ret =cpuhp_setup_state_multi (CPUHP_ZCOMP_PREPARE ,"block/zram:prepare" , + zcomp_cpu_up_prepare, zcomp_cpu_dead); +if (ret <0 ) +return ret; + ret =class_register (&zram_control_class);if (ret) {pr_err ("Unable to register zram-control class\n" ); +cpuhp_remove_multi_state (CPUHP_ZCOMP_PREPARE );return ret; }
@@ -1452,6 +1460,7 @@ static int __init zram_init(void)if (zram_major <=0 ) {pr_err ("Unable to get major number\n" );class_unregister (&zram_control_class); +cpuhp_remove_multi_state (CPUHP_ZCOMP_PREPARE );return -EBUSY ; }
include/linux/cpuhotplug.h +1 -0
@@ -69,6 +69,7 @@ enum cpuhp_state {CPUHP_MM_ZSWP_MEM_PREPARE ,CPUHP_MM_ZSWP_POOL_PREPARE ,CPUHP_KVM_PPC_BOOK3S_PREPARE , +CPUHP_ZCOMP_PREPARE ,CPUHP_TIMERS_DEAD ,CPUHP_NOTF_ERR_INJ_PREPARE , CPUHP_MIPS_SOC_PREPARE,
Signature · 1 line
2.10.2
tip-bot for Anna-Maria Gleixner
merge bot[tip:smp/hotplug] zram: Convert to hotplug state machine
zram: Convert to hotplug state machine
Commit-ID: 1dd6c834fa4a75a86fecefb6d1f1525f1cb755c7 Gitweb: http://git.kernel.org/tip/1dd6c834fa4a75a86fecefb6d1f1525f1cb755c7 Author: Anna-Maria Gleixner <[email protected]> AuthorDate: Sun, 27 Nov 2016 00:13:46 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Fri, 2 Dec 2016 00:52:39 +0100
zram: Convert to hotplug state machine
Install the callbacks via the state machine with multi instance support and let the core invoke the callbacks on the already online CPUs.
--- drivers/block/zram/zcomp.c | 76 ++++++++++++++----------------------------- drivers/block/zram/zcomp.h | 5 +-- drivers/block/zram/zram_drv.c | 9 +++++ include/linux/cpuhotplug.h | 1 + 4 files changed, 38 insertions(+), 53 deletions(-)
drivers/block/zram/zcomp.c +25 -51
@@ -160,82 +160,56 @@ int zcomp_decompress(struct zcomp_strm *zstrm, dst, &dst_len); } -static int __zcomp_cpu_notifier (struct zcomp *comp, -unsigned long action,unsigned long cpu) +int zcomp_cpu_up_prepare (unsigned int cpu,struct hlist_node *node) { + struct zcomp *comp = hlist_entry(node, struct zcomp, node);struct zcomp_strm *zstrm; -switch (action) { -case CPU_UP_PREPARE : -if (WARN_ON (*per_cpu_ptr (comp->stream, cpu))) -break ; - zstrm =zcomp_strm_alloc (comp); -if (IS_ERR_OR_NULL (zstrm)) { -pr_err ("Can't allocate a compression stream\n" ); -return NOTIFY_BAD ; - } - *per_cpu_ptr (comp->stream, cpu) = zstrm; -break ; -case CPU_DEAD : -case CPU_UP_CANCELED : - zstrm = *per_cpu_ptr (comp->stream, cpu); -if (!IS_ERR_OR_NULL (zstrm)) -zcomp_strm_free (zstrm); - *per_cpu_ptr (comp->stream, cpu) =NULL ; -break ; -default : -break ; +if (WARN_ON (*per_cpu_ptr (comp->stream, cpu))) +return 0 ; + + zstrm =zcomp_strm_alloc (comp); +if (IS_ERR_OR_NULL (zstrm)) { +pr_err ("Can't allocate a compression stream\n" ); +return -ENOMEM ; } -return NOTIFY_OK ; + *per_cpu_ptr (comp->stream, cpu) = zstrm; +return 0 ; } -static int zcomp_cpu_notifier (struct notifier_block *nb, -unsigned long action,void *pcpu) +int zcomp_cpu_dead (unsigned int cpu,struct hlist_node *node) { -unsigned long cpu = (unsigned long )pcpu; -struct zcomp *comp =container_of (nb,typeof (*comp), notifier); + struct zcomp *comp = hlist_entry(node, struct zcomp, node); +struct zcomp_strm *zstrm; -return __zcomp_cpu_notifier (comp, action, cpu); + zstrm = *per_cpu_ptr (comp->stream, cpu); +if (!IS_ERR_OR_NULL (zstrm)) +zcomp_strm_free (zstrm); + *per_cpu_ptr (comp->stream, cpu) =NULL ; +return 0 ; }static int zcomp_init (struct zcomp *comp) { -unsigned long cpu;int ret; - comp->notifier.notifier_call = zcomp_cpu_notifier; - comp->stream = alloc_percpu(struct zcomp_strm *);if (!comp->stream)return -ENOMEM ; -cpu_notifier_register_begin (); -for_each_online_cpu (cpu) { - ret =__zcomp_cpu_notifier (comp,CPU_UP_PREPARE , cpu); -if (ret ==NOTIFY_BAD ) - goto cleanup; - } -__register_cpu_notifier (&comp->notifier); -cpu_notifier_register_done (); + ret =cpuhp_state_add_instance (CPUHP_ZCOMP_PREPARE , &comp->node); +if (ret <0 ) + goto cleanup;return 0 ; cleanup: -for_each_online_cpu (cpu) -__zcomp_cpu_notifier (comp,CPU_UP_CANCELED , cpu); -cpu_notifier_register_done (); -return -ENOMEM ; +free_percpu (comp->stream); +return ret; }void zcomp_destroy (struct zcomp *comp) { -unsigned long cpu; - -cpu_notifier_register_begin (); -for_each_online_cpu (cpu) -__zcomp_cpu_notifier (comp,CPU_UP_CANCELED , cpu); -__unregister_cpu_notifier (&comp->notifier); -cpu_notifier_register_done (); - +cpuhp_state_remove_instance (CPUHP_ZCOMP_PREPARE , &comp->node);free_percpu (comp->stream);kfree (comp); }
drivers/block/zram/zcomp.h +3 -2
@@ -19,11 +19,12 @@ struct zcomp_strm {/* dynamic per-device compression frontend */ struct zcomp {struct zcomp_strm *__percpu *stream; -struct notifier_block notifier; -const char *name; +struct hlist_node node; }; +int zcomp_cpu_up_prepare (unsigned int cpu,struct hlist_node *node); +int zcomp_cpu_dead (unsigned int cpu,struct hlist_node *node);ssize_t zcomp_available_show (const char *comp,char *buf);bool zcomp_available_algorithm (const char *comp);
drivers/block/zram/zram_drv.c +9 -0
@@ -30,6 +30,7 @@#include <linux/err.h> #include <linux/idr.h> #include <linux/sysfs.h> +#include <linux/cpuhotplug.h> #include "zram_drv.h"
@@ -1436,15 +1437,22 @@ static void destroy_devices(void)idr_for_each (&zram_index_idr, &zram_remove_cb,NULL );idr_destroy (&zram_index_idr);unregister_blkdev (zram_major,"zram" ); +cpuhp_remove_multi_state (CPUHP_ZCOMP_PREPARE ); }static int __init zram_init (void ) {int ret; + ret =cpuhp_setup_state_multi (CPUHP_ZCOMP_PREPARE ,"block/zram:prepare" , + zcomp_cpu_up_prepare, zcomp_cpu_dead); +if (ret <0 ) +return ret; + ret =class_register (&zram_control_class);if (ret) {pr_err ("Unable to register zram-control class\n" ); +cpuhp_remove_multi_state (CPUHP_ZCOMP_PREPARE );return ret; }
@@ -1452,6 +1460,7 @@ static int __init zram_init(void)if (zram_major <=0 ) {pr_err ("Unable to get major number\n" );class_unregister (&zram_control_class); +cpuhp_remove_multi_state (CPUHP_ZCOMP_PREPARE );return -EBUSY ; }
include/linux/cpuhotplug.h +1 -0
@@ -69,6 +69,7 @@ enum cpuhp_state {CPUHP_MM_ZSWP_MEM_PREPARE ,CPUHP_MM_ZSWP_POOL_PREPARE ,CPUHP_KVM_PPC_BOOK3S_PREPARE , +CPUHP_ZCOMP_PREPARE ,CPUHP_TIMERS_DEAD ,CPUHP_NOTF_ERR_INJ_PREPARE , CPUHP_MIPS_SOC_PREPARE,
PATCH 19/22 soc/fsl/qbman: Convert to hotplug state machine
In reply to Sebastian Andrzej SiewiorInstall the callbacks via the state machine.
--- drivers/soc/fsl/qbman/bman_portal.c | 46 +++++++++++++------------------------ 1 file changed, 16 insertions(+), 30 deletions(-)
drivers/soc/fsl/qbman/bman_portal.c +16 -30
@@ -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 ; }
Signature · 1 line
2.10.2
tip-bot for Sebastian Andrzej Siewior
merge bot[tip:smp/hotplug] soc/fsl/qbman: Convert to hotplug state machine
soc/fsl/qbman: Convert to hotplug state machine
Commit-ID: fce77c3562eccdd8002c9c7947f00af70e00a375 Gitweb: http://git.kernel.org/tip/fce77c3562eccdd8002c9c7947f00af70e00a375 Author: Sebastian Andrzej Siewior <[email protected]> AuthorDate: Sun, 27 Nov 2016 00:13:47 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Fri, 2 Dec 2016 00:52:39 +0100
soc/fsl/qbman: Convert to hotplug state machine
Install the callbacks via the state machine.
--- drivers/soc/fsl/qbman/bman_portal.c | 46 +++++++++++++------------------------ 1 file changed, 16 insertions(+), 30 deletions(-)
drivers/soc/fsl/qbman/bman_portal.c +16 -30
@@ -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 ; }
PATCH 20/22 soc/fsl/qbman: Convert to hotplug state machine
In reply to Sebastian Andrzej SiewiorInstall the callbacks via the state machine.
--- drivers/soc/fsl/qbman/qman_portal.c | 39 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 27 deletions(-)
drivers/soc/fsl/qbman/qman_portal.c +12 -27
@@ -179,7 +179,7 @@ static void qman_portal_update_sdest(const struct qm_portal_config *pcfg,qman_set_sdest (pcfg->channel, cpu); } -static void qman_offline_cpu (unsigned int cpu) +static int qman_offline_cpu (unsigned int cpu) {struct qman_portal *p;const struct qm_portal_config *pcfg;
@@ -192,9 +192,10 @@ static void qman_offline_cpu(unsigned int cpu)qman_portal_update_sdest (pcfg,0 ); } } +return 0 ; } -static void qman_online_cpu (unsigned int cpu) +static int qman_online_cpu (unsigned int cpu) {struct qman_portal *p;const struct qm_portal_config *pcfg;
@@ -207,31 +208,9 @@ static void qman_online_cpu(unsigned int cpu)qman_portal_update_sdest (pcfg, cpu); } } +return 0 ; } -static int qman_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 : -qman_online_cpu (cpu); -break ; -case CPU_DOWN_PREPARE : -case CPU_DOWN_PREPARE_FROZEN : -qman_offline_cpu (cpu); -default : -break ; - } -return NOTIFY_OK ; -} - -static struct notifier_block qman_hotplug_cpu_notifier = { - .notifier_call = qman_hotplug_cpu_callback, -}; -static int qman_portal_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;
@@ -346,8 +325,14 @@ static int __init qman_portal_driver_register(struct platform_driver *drv)if (ret <0 )return ret; -register_hotcpu_notifier (&qman_hotplug_cpu_notifier); - + ret =cpuhp_setup_state_nocalls (CPUHP_AP_ONLINE_DYN , +"soc/qman_portal:online" , + qman_online_cpu, qman_offline_cpu); +if (ret <0 ) { +pr_err ("qman: failed to register hotplug callbacks.\n" ); +platform_driver_unregister (drv); +return ret; + }return 0 ; }
Signature · 1 line
2.10.2
tip-bot for Sebastian Andrzej Siewior
merge bot[tip:smp/hotplug] soc/fsl/qbman: Convert to hotplug state machine
soc/fsl/qbman: Convert to hotplug state machine
Commit-ID: 1f759d328f6d8c06b5db55374b028565187deaca Gitweb: http://git.kernel.org/tip/1f759d328f6d8c06b5db55374b028565187deaca Author: Sebastian Andrzej Siewior <[email protected]> AuthorDate: Sun, 27 Nov 2016 00:13:48 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Fri, 2 Dec 2016 00:52:40 +0100
soc/fsl/qbman: Convert to hotplug state machine
Install the callbacks via the state machine.
--- drivers/soc/fsl/qbman/qman_portal.c | 39 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 27 deletions(-)
drivers/soc/fsl/qbman/qman_portal.c +12 -27
@@ -179,7 +179,7 @@ static void qman_portal_update_sdest(const struct qm_portal_config *pcfg,qman_set_sdest (pcfg->channel, cpu); } -static void qman_offline_cpu (unsigned int cpu) +static int qman_offline_cpu (unsigned int cpu) {struct qman_portal *p;const struct qm_portal_config *pcfg;
@@ -192,9 +192,10 @@ static void qman_offline_cpu(unsigned int cpu)qman_portal_update_sdest (pcfg,0 ); } } +return 0 ; } -static void qman_online_cpu (unsigned int cpu) +static int qman_online_cpu (unsigned int cpu) {struct qman_portal *p;const struct qm_portal_config *pcfg;
@@ -207,31 +208,9 @@ static void qman_online_cpu(unsigned int cpu)qman_portal_update_sdest (pcfg, cpu); } } +return 0 ; } -static int qman_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 : -qman_online_cpu (cpu); -break ; -case CPU_DOWN_PREPARE : -case CPU_DOWN_PREPARE_FROZEN : -qman_offline_cpu (cpu); -default : -break ; - } -return NOTIFY_OK ; -} - -static struct notifier_block qman_hotplug_cpu_notifier = { - .notifier_call = qman_hotplug_cpu_callback, -}; -static int qman_portal_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;
@@ -346,8 +325,14 @@ static int __init qman_portal_driver_register(struct platform_driver *drv)if (ret <0 )return ret; -register_hotcpu_notifier (&qman_hotplug_cpu_notifier); - + ret =cpuhp_setup_state_nocalls (CPUHP_AP_ONLINE_DYN , +"soc/qman_portal:online" , + qman_online_cpu, qman_offline_cpu); +if (ret <0 ) { +pr_err ("qman: failed to register hotplug callbacks.\n" ); +platform_driver_unregister (drv); +return ret; + }return 0 ; }
PATCH 21/22 staging/lustre/libcfs: Convert to hotplug state machine
In reply to Sebastian Andrzej SiewiorFrom: Anna-Maria Gleixner <[email protected]>
Install the callbacks via the state machine.
--- .../staging/lustre/lnet/libcfs/linux/linux-cpu.c | 89 ++++++++++++---------- include/linux/cpuhotplug.h | 1 + 2 files changed, 50 insertions(+), 40 deletions(-)
drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c +49 -40
@@ -73,6 +73,9 @@ struct cfs_cpt_data { };static struct cfs_cpt_data cpt_data; +#ifdef CONFIG_HOTPLUG_CPU +static enum cpuhp_state lustre_cpu_online; +#endif static void cfs_node_to_cpumask (int node,cpumask_t *mask)
@@ -942,48 +945,38 @@ cfs_cpt_table_create_pattern(char *pattern) }#ifdef CONFIG_HOTPLUG_CPU -static int -cfs_cpu_notify (struct notifier_block *self,unsigned long action,void *hcpu) + +static void cfs_cpu_incr_cpt_version (void ) { -unsigned int cpu = (unsigned long )hcpu; -bool warn; - -switch (action) { -case CPU_DEAD : -case CPU_DEAD_FROZEN : -case CPU_ONLINE : -case CPU_ONLINE_FROZEN : -spin_lock (&cpt_data.cpt_lock); - cpt_data.cpt_version++; -spin_unlock (&cpt_data.cpt_lock); -/* Fall through */ -default : -if (action !=CPU_DEAD && action !=CPU_DEAD_FROZEN ) { -CDEBUG (D_INFO ,"CPU changed [cpu %u action %lx]\n" , - cpu, action); -break ; - } - -mutex_lock (&cpt_data.cpt_mutex); -/* if all HTs in a core are offline, it may break affinity */ -cpumask_copy (cpt_data.cpt_cpumask, -topology_sibling_cpumask (cpu)); - warn =cpumask_any_and (cpt_data.cpt_cpumask, - cpu_online_mask) >= nr_cpu_ids; -mutex_unlock (&cpt_data.cpt_mutex); -CDEBUG (warn ?D_WARNING :D_INFO , -"Lustre: can't support CPU plug-out well now, performance and stability could be impacted [CPU %u action: %lx]\n" , - cpu, action); - } - -return NOTIFY_OK ; +spin_lock (&cpt_data.cpt_lock); + cpt_data.cpt_version++; +spin_unlock (&cpt_data.cpt_lock); } -static struct notifier_block cfs_cpu_notifier = { - .notifier_call = cfs_cpu_notify, - .priority =0 -}; +static int cfs_cpu_online (unsigned int cpu) +{ +cfs_cpu_incr_cpt_version (); +return 0 ; +} +static int cfs_cpu_dead (unsigned int cpu) +{ +bool warn; +int next; + +cfs_cpu_incr_cpt_version (); + +mutex_lock (&cpt_data.cpt_mutex); +/* if all HTs in a core are offline, it may break affinity */ +cpumask_copy (cpt_data.cpt_cpumask,topology_sibling_cpumask (cpu)); + next =cpumask_any_and (cpt_data.cpt_cpumask, cpu_online_mask); + warn = next >= nr_cpu_ids; +mutex_unlock (&cpt_data.cpt_mutex); +CDEBUG (warn ?D_WARNING :D_INFO , +"Lustre: can't support CPU plug-out well now, performance and stability could be impacted [CPU %u]\n" , + cpu); +return 0 ; +}#endif void
@@ -993,7 +986,9 @@ cfs_cpu_fini(void)cfs_cpt_table_free (cfs_cpt_table);#ifdef CONFIG_HOTPLUG_CPU -unregister_hotcpu_notifier (&cfs_cpu_notifier); +if (lustre_cpu_online) +cpuhp_remove_state_nocalls (lustre_cpu_online); +cpuhp_remove_state_nocalls (CPUHP_LUSTRE_CFS_DEAD );#endif if (cpt_data.cpt_cpumask)LIBCFS_FREE (cpt_data.cpt_cpumask,cpumask_size ());
@@ -1002,6 +997,10 @@ cfs_cpu_fini(void)int cfs_cpu_init (void ) { +#ifdef CONFIG_HOTPLUG_CPU +int ret; +#endif +LASSERT (!cfs_cpt_table);memset (&cpt_data,0 ,sizeof (cpt_data));
@@ -1016,7 +1015,17 @@ cfs_cpu_init(void)mutex_init (&cpt_data.cpt_mutex);#ifdef CONFIG_HOTPLUG_CPU -register_hotcpu_notifier (&cfs_cpu_notifier); + ret =cpuhp_setup_state_nocalls (CPUHP_LUSTRE_CFS_DEAD , +"staging/lustre/cfe:dead" ,NULL , + cfs_cpu_dead); +if (ret <0 ) + goto failed; + ret =cpuhp_setup_state_nocalls (CPUHP_AP_ONLINE_DYN , +"staging/lustre/cfe:online" , + cfs_cpu_online,NULL ); +if (ret <0 ) + goto failed; + lustre_cpu_online = ret;#endif if (*cpu_pattern !=0 ) {
include/linux/cpuhotplug.h +1 -0
@@ -41,6 +41,7 @@ enum cpuhp_state {CPUHP_NET_DEV_DEAD ,CPUHP_PCI_XGENE_DEAD ,CPUHP_IOMMU_INTEL_DEAD , +CPUHP_LUSTRE_CFS_DEAD ,CPUHP_WORKQUEUE_PREP ,CPUHP_POWER_NUMA_PREPARE , CPUHP_HRTIMERS_PREPARE,
Signature · 1 line
2.10.2
PATCH v2 21/22 staging/lustre/libcfs: Convert to hotplug state machine
From: Anna-Maria Gleixner <[email protected]>
Install the callbacks via the state machine.
---
v1?v2: rebase to linux-next
Side note: Is there a reason the handle the down state very late at CPU_DEAD time and use the counterpart of the online callback (the old CPU_DOWN_PREPARE state).
.../staging/lustre/lnet/libcfs/linux/linux-cpu.c | 88 ++++++++++++---------- include/linux/cpuhotplug.h | 1 + 2 files changed, 49 insertions(+), 40 deletions(-)
drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c +48 -40
@@ -75,6 +75,9 @@ struct cfs_cpt_data { };static struct cfs_cpt_data cpt_data; +#ifdef CONFIG_HOTPLUG_CPU +static enum cpuhp_state lustre_cpu_online; +#endif static void cfs_node_to_cpumask (int node,cpumask_t *mask)
@@ -967,48 +970,37 @@ cfs_cpt_table_create_pattern(char *pattern) }#ifdef CONFIG_HOTPLUG_CPU -static int -cfs_cpu_notify (struct notifier_block *self,unsigned long action,void *hcpu) +static void cfs_cpu_incr_cpt_version (void ) { -unsigned int cpu = (unsigned long )hcpu; -bool warn; - -switch (action) { -case CPU_DEAD : -case CPU_DEAD_FROZEN : -case CPU_ONLINE : -case CPU_ONLINE_FROZEN : -spin_lock (&cpt_data.cpt_lock); - cpt_data.cpt_version++; -spin_unlock (&cpt_data.cpt_lock); -/* Fall through */ -default : -if (action !=CPU_DEAD && action !=CPU_DEAD_FROZEN ) { -CDEBUG (D_INFO ,"CPU changed [cpu %u action %lx]\n" , - cpu, action); -break ; - } - -mutex_lock (&cpt_data.cpt_mutex); -/* if all HTs in a core are offline, it may break affinity */ -cpumask_copy (cpt_data.cpt_cpumask, -topology_sibling_cpumask (cpu)); - warn =cpumask_any_and (cpt_data.cpt_cpumask, - cpu_online_mask) >= nr_cpu_ids; -mutex_unlock (&cpt_data.cpt_mutex); -CDEBUG (warn ?D_WARNING :D_INFO , -"Lustre: can't support CPU plug-out well now, performance and stability could be impacted [CPU %u action: %lx]\n" , - cpu, action); - } - -return NOTIFY_OK ; +spin_lock (&cpt_data.cpt_lock); + cpt_data.cpt_version++; +spin_unlock (&cpt_data.cpt_lock); } -static struct notifier_block cfs_cpu_notifier = { - .notifier_call = cfs_cpu_notify, - .priority =0 -}; +static int cfs_cpu_online (unsigned int cpu) +{ +cfs_cpu_incr_cpt_version (); +return 0 ; +} +static int cfs_cpu_dead (unsigned int cpu) +{ +bool warn; + +cfs_cpu_incr_cpt_version (); + +mutex_lock (&cpt_data.cpt_mutex); +/* if all HTs in a core are offline, it may break affinity */ +cpumask_copy (cpt_data.cpt_cpumask, +topology_sibling_cpumask (cpu)); + warn =cpumask_any_and (cpt_data.cpt_cpumask, + cpu_online_mask) >= nr_cpu_ids; +mutex_unlock (&cpt_data.cpt_mutex); +CDEBUG (warn ?D_WARNING :D_INFO , +"Lustre: can't support CPU plug-out well now, performance and stability could be impacted [CPU %u]\n" , + cpu); +return 0 ; +}#endif void
@@ -1018,7 +1010,9 @@ cfs_cpu_fini(void)cfs_cpt_table_free (cfs_cpt_table);#ifdef CONFIG_HOTPLUG_CPU -unregister_hotcpu_notifier (&cfs_cpu_notifier); +if (lustre_cpu_online) +cpuhp_remove_state_nocalls (lustre_cpu_online); +cpuhp_remove_state_nocalls (CPUHP_LUSTRE_CFS_DEAD );#endif if (cpt_data.cpt_cpumask)LIBCFS_FREE (cpt_data.cpt_cpumask,cpumask_size ());
@@ -1027,6 +1021,10 @@ cfs_cpu_fini(void)int cfs_cpu_init (void ) { +#ifdef CONFIG_HOTPLUG_CPU +int ret; +#endif +LASSERT (!cfs_cpt_table);memset (&cpt_data,0 ,sizeof (cpt_data));
@@ -1041,7 +1039,17 @@ cfs_cpu_init(void)mutex_init (&cpt_data.cpt_mutex);#ifdef CONFIG_HOTPLUG_CPU -register_hotcpu_notifier (&cfs_cpu_notifier); + ret =cpuhp_setup_state_nocalls (CPUHP_LUSTRE_CFS_DEAD , +"staging/lustre/cfe:dead" ,NULL , + cfs_cpu_dead); +if (ret <0 ) + goto failed; + ret =cpuhp_setup_state_nocalls (CPUHP_AP_ONLINE_DYN , +"staging/lustre/cfe:online" , + cfs_cpu_online,NULL ); +if (ret <0 ) + goto failed; + lustre_cpu_online = ret;#endif if (*cpu_pattern) {
include/linux/cpuhotplug.h +1 -0
@@ -41,6 +41,7 @@ enum cpuhp_state {CPUHP_NET_DEV_DEAD ,CPUHP_PCI_XGENE_DEAD ,CPUHP_IOMMU_INTEL_DEAD , +CPUHP_LUSTRE_CFS_DEAD ,CPUHP_WORKQUEUE_PREP ,CPUHP_POWER_NUMA_PREPARE , CPUHP_HRTIMERS_PREPARE,
Signature · 1 line
2.10.2
Greg Kroah-Hartman
maintainerRe: [PATCH 21/22 v2] staging/lustre/libcfs: Convert to hotplug state machine
Quoted 12 lines · Sebastian Andrzej Siewior
From: Anna-Maria Gleixner <[email protected]>
Install the callbacks via the state machine.
Cc Oleg Drokin <[email protected]>Cc Andreas Dilger <[email protected]>Cc James Simmons <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Signed-off-by Anna-Maria Gleixner <[email protected]>[bigeasy: rebase to linux-next]Signed-off-by Sebastian Andrzej Siewior <[email protected]>
Quoted 6 lines
---
v1…v2: rebase to linux-nextSide note: Is there a reason the handle the down state very late at
CPU_DEADtime and use the counterpart of the online callback (the oldCPU_DOWN_PREPAREstate).
You need a blank line before the cc: lines in your changelog please...
thanks,
greg k-h
PATCH v3 21/22 staging/lustre/libcfs: Convert to hotplug state machine
From: Anna-Maria Gleixner <[email protected]>
Install the callbacks via the state machine.
---
v2?v3: add the missing blank before the Cc: lines. v1?v2: rebase to linux-next
Side note: Is there a reason the handle the down state very late at CPU_DEAD time and use the counterpart of the online callback (the old CPU_DOWN_PREPARE state).
.../staging/lustre/lnet/libcfs/linux/linux-cpu.c | 88 ++++++++++++---------- include/linux/cpuhotplug.h | 1 + 2 files changed, 49 insertions(+), 40 deletions(-)
drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c +48 -40
@@ -75,6 +75,9 @@ struct cfs_cpt_data { };static struct cfs_cpt_data cpt_data; +#ifdef CONFIG_HOTPLUG_CPU +static enum cpuhp_state lustre_cpu_online; +#endif static void cfs_node_to_cpumask (int node,cpumask_t *mask)
@@ -967,48 +970,37 @@ cfs_cpt_table_create_pattern(char *pattern) }#ifdef CONFIG_HOTPLUG_CPU -static int -cfs_cpu_notify (struct notifier_block *self,unsigned long action,void *hcpu) +static void cfs_cpu_incr_cpt_version (void ) { -unsigned int cpu = (unsigned long )hcpu; -bool warn; - -switch (action) { -case CPU_DEAD : -case CPU_DEAD_FROZEN : -case CPU_ONLINE : -case CPU_ONLINE_FROZEN : -spin_lock (&cpt_data.cpt_lock); - cpt_data.cpt_version++; -spin_unlock (&cpt_data.cpt_lock); -/* Fall through */ -default : -if (action !=CPU_DEAD && action !=CPU_DEAD_FROZEN ) { -CDEBUG (D_INFO ,"CPU changed [cpu %u action %lx]\n" , - cpu, action); -break ; - } - -mutex_lock (&cpt_data.cpt_mutex); -/* if all HTs in a core are offline, it may break affinity */ -cpumask_copy (cpt_data.cpt_cpumask, -topology_sibling_cpumask (cpu)); - warn =cpumask_any_and (cpt_data.cpt_cpumask, - cpu_online_mask) >= nr_cpu_ids; -mutex_unlock (&cpt_data.cpt_mutex); -CDEBUG (warn ?D_WARNING :D_INFO , -"Lustre: can't support CPU plug-out well now, performance and stability could be impacted [CPU %u action: %lx]\n" , - cpu, action); - } - -return NOTIFY_OK ; +spin_lock (&cpt_data.cpt_lock); + cpt_data.cpt_version++; +spin_unlock (&cpt_data.cpt_lock); } -static struct notifier_block cfs_cpu_notifier = { - .notifier_call = cfs_cpu_notify, - .priority =0 -}; +static int cfs_cpu_online (unsigned int cpu) +{ +cfs_cpu_incr_cpt_version (); +return 0 ; +} +static int cfs_cpu_dead (unsigned int cpu) +{ +bool warn; + +cfs_cpu_incr_cpt_version (); + +mutex_lock (&cpt_data.cpt_mutex); +/* if all HTs in a core are offline, it may break affinity */ +cpumask_copy (cpt_data.cpt_cpumask, +topology_sibling_cpumask (cpu)); + warn =cpumask_any_and (cpt_data.cpt_cpumask, + cpu_online_mask) >= nr_cpu_ids; +mutex_unlock (&cpt_data.cpt_mutex); +CDEBUG (warn ?D_WARNING :D_INFO , +"Lustre: can't support CPU plug-out well now, performance and stability could be impacted [CPU %u]\n" , + cpu); +return 0 ; +}#endif void
@@ -1018,7 +1010,9 @@ cfs_cpu_fini(void)cfs_cpt_table_free (cfs_cpt_table);#ifdef CONFIG_HOTPLUG_CPU -unregister_hotcpu_notifier (&cfs_cpu_notifier); +if (lustre_cpu_online) +cpuhp_remove_state_nocalls (lustre_cpu_online); +cpuhp_remove_state_nocalls (CPUHP_LUSTRE_CFS_DEAD );#endif if (cpt_data.cpt_cpumask)LIBCFS_FREE (cpt_data.cpt_cpumask,cpumask_size ());
@@ -1027,6 +1021,10 @@ cfs_cpu_fini(void)int cfs_cpu_init (void ) { +#ifdef CONFIG_HOTPLUG_CPU +int ret; +#endif +LASSERT (!cfs_cpt_table);memset (&cpt_data,0 ,sizeof (cpt_data));
@@ -1041,7 +1039,17 @@ cfs_cpu_init(void)mutex_init (&cpt_data.cpt_mutex);#ifdef CONFIG_HOTPLUG_CPU -register_hotcpu_notifier (&cfs_cpu_notifier); + ret =cpuhp_setup_state_nocalls (CPUHP_LUSTRE_CFS_DEAD , +"staging/lustre/cfe:dead" ,NULL , + cfs_cpu_dead); +if (ret <0 ) + goto failed; + ret =cpuhp_setup_state_nocalls (CPUHP_AP_ONLINE_DYN , +"staging/lustre/cfe:online" , + cfs_cpu_online,NULL ); +if (ret <0 ) + goto failed; + lustre_cpu_online = ret;#endif if (*cpu_pattern) {
include/linux/cpuhotplug.h +1 -0
@@ -41,6 +41,7 @@ enum cpuhp_state {CPUHP_NET_DEV_DEAD ,CPUHP_PCI_XGENE_DEAD ,CPUHP_IOMMU_INTEL_DEAD , +CPUHP_LUSTRE_CFS_DEAD ,CPUHP_WORKQUEUE_PREP ,CPUHP_POWER_NUMA_PREPARE , CPUHP_HRTIMERS_PREPARE,
Signature · 1 line
2.10.2
PATCH 22/22 Remove obsolete cpu hotplug register / unregister functions
In reply to Sebastian Andrzej SiewiorUsers of
hotcpu_notifier() cpu_notifier() __hotcpu_notifier() __cpu_notifier() register_hotcpu_notifier() register_cpu_notifier() __register_hotcpu_notifier() __register_cpu_notifier() unregister_hotcpu_notifier() unregister_cpu_notifier() __unregister_hotcpu_notifier() __unregister_cpu_notifier()
are not longer in tree so remove them.
While at it, some unused CPU states are removed here, too. This includes the compatibily wrappers. The remaining states (like CPU_ONLINE) are used SMP bring up code to makr the current state.
--- include/linux/cpu.h | 48 ---------------- include/linux/cpuhotplug.h | 2 - kernel/cpu.c | 139 +-------------------------------------------- 3 files changed, 1 insertion(+), 188 deletions(-)
include/linux/cpu.h +0 -48
@@ -57,9 +57,6 @@ struct notifier_block;#define CPU_ONLINE 0x0002/* CPU (unsigned)v is up */ #define CPU_UP_PREPARE 0x0003/* CPU (unsigned)v coming up */ -#define CPU_UP_CANCELED 0x0004/* CPU (unsigned)v NOT coming up */ -#define CPU_DOWN_PREPARE 0x0005/* CPU (unsigned)v going down */ -#define CPU_DOWN_FAILED 0x0006/* CPU (unsigned)v NOT going down */ #define CPU_DEAD 0x0007/* CPU (unsigned)v dead */ #define CPU_POST_DEAD 0x0009/* CPU (unsigned)v dead, cpu_hotplug * lock is dropped */
@@ -134,33 +131,9 @@ void notify_cpu_starting(unsigned int cpu);extern void cpu_maps_update_begin (void );extern void cpu_maps_update_done (void ); -#define cpu_notifier_register_begin cpu_maps_update_begin -#define cpu_notifier_register_done cpu_maps_update_done -#else /* CONFIG_SMP */ #define cpuhp_tasks_frozen 0 -#define cpu_notifier (fn, pri) do { (void)(fn); } while (0) -#define __cpu_notifier (fn, pri) do { (void)(fn); } while (0) - -static inline int register_cpu_notifier (struct notifier_block *nb) -{ -return 0 ; -} - -static inline int __register_cpu_notifier (struct notifier_block *nb) -{ -return 0 ; -} - -static inline void unregister_cpu_notifier (struct notifier_block *nb) -{ -} - -static inline void __unregister_cpu_notifier (struct notifier_block *nb) -{ -} -static inline void cpu_maps_update_begin (void ) { }
@@ -169,14 +142,6 @@ static inline void cpu_maps_update_done(void) { } -static inline void cpu_notifier_register_begin (void ) -{ -} - -static inline void cpu_notifier_register_done (void ) -{ -} -#endif /* CONFIG_SMP */ extern struct bus_type cpu_subsys;
@@ -189,12 +154,6 @@ extern void get_online_cpus(void);extern void put_online_cpus (void );extern void cpu_hotplug_disable (void );extern void cpu_hotplug_enable (void ); -#define hotcpu_notifier (fn, pri) cpu_notifier(fn, pri) -#define __hotcpu_notifier (fn, pri) __cpu_notifier(fn, pri) -#define register_hotcpu_notifier (nb) register_cpu_notifier(nb) -#define __register_hotcpu_notifier (nb) __register_cpu_notifier(nb) -#define unregister_hotcpu_notifier (nb) unregister_cpu_notifier(nb) -#define __unregister_hotcpu_notifier (nb) __unregister_cpu_notifier(nb)void clear_tasks_mm_cpumask (int cpu);int cpu_down (unsigned int cpu);
@@ -206,13 +165,6 @@ static inline void cpu_hotplug_done(void) {}#define put_online_cpus () do { } while (0)#define cpu_hotplug_disable () do { } while (0)#define cpu_hotplug_enable () do { } while (0) -#define hotcpu_notifier (fn, pri) do { (void)(fn); } while (0) -#define __hotcpu_notifier (fn, pri) do { (void)(fn); } while (0) -/* These aren't inline functions due to a GCC bug. */ -#define register_hotcpu_notifier (nb) ({ (void)(nb); 0; }) -#define __register_hotcpu_notifier (nb) ({ (void)(nb); 0; }) -#define unregister_hotcpu_notifier (nb) ({ (void)(nb); }) -#define __unregister_hotcpu_notifier (nb) ({ (void)(nb); })#endif /* CONFIG_HOTPLUG_CPU */ #ifdef CONFIG_PM_SLEEP_SMP
include/linux/cpuhotplug.h +0 -2
@@ -57,7 +57,6 @@ enum cpuhp_state {CPUHP_POWERPC_MMU_CTX_PREPARE ,CPUHP_XEN_PREPARE ,CPUHP_XEN_EVTCHN_PREPARE , -CPUHP_NOTIFY_PREPARE ,CPUHP_ARM_SHMOBILE_SCU_PREPARE ,CPUHP_SH_SH3X_PREPARE , CPUHP_BLK_MQ_PREPARE,
@@ -142,7 +141,6 @@ enum cpuhp_state {CPUHP_AP_PERF_ARM_L2X0_ONLINE ,CPUHP_AP_WORKQUEUE_ONLINE ,CPUHP_AP_RCUTREE_ONLINE , -CPUHP_AP_NOTIFY_ONLINE ,CPUHP_AP_ONLINE_DYN ,CPUHP_AP_ONLINE_DYN_END =CPUHP_AP_ONLINE_DYN +30 , CPUHP_AP_X86_HPET_ONLINE,
kernel/cpu.c +1 -138
218 lines not on this page · raw message
Signature · 1 line
2.10.2
cover cpu/hotplug: Final cleanup
The following series completes the cpuhotplug rework stage ONE.
- Fix a completely broken new user of the state machine
- Prevent overwriting existing states
- Convert the last left over drivers to the state machine
- Remove the notifiers and related code
- Cleanup the state names (tree wide)
- Consolidate a few hotplug states
It's also available from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git WIP.hotplug
Thanks,
tglx
--- a/lib/cpu-notifier-error-inject.c | 84 --------- arch/arm/kernel/smp_twd.c | 2 arch/arm/mach-imx/mmdc.c | 34 ++- arch/arm/mach-mvebu/coherency.c | 2 arch/arm/mm/cache-l2x0-pmu.c | 2 arch/arm/mm/cache-l2x0.c | 2 arch/arm/vfp/vfpmodule.c | 2 arch/arm/xen/enlighten.c | 2 arch/arm64/kernel/armv8_deprecated.c | 2 arch/arm64/kernel/debug-monitors.c | 2 arch/arm64/kernel/hw_breakpoint.c | 2 arch/blackfin/kernel/perf_event.c | 2 arch/mips/kernel/pm-cps.c | 2 arch/mips/oprofile/op_model_loongson3.c | 2 arch/powerpc/mm/numa.c | 2 arch/powerpc/perf/core-book3s.c | 2 arch/s390/kernel/perf_cpum_cf.c | 2 arch/s390/kernel/perf_cpum_sf.c | 2 arch/x86/entry/vdso/vma.c | 2 arch/x86/events/amd/ibs.c | 2 arch/x86/events/amd/power.c | 2 arch/x86/events/amd/uncore.c | 6 arch/x86/events/core.c | 6 arch/x86/events/intel/cqm.c | 4 arch/x86/events/intel/cstate.c | 5 arch/x86/events/intel/rapl.c | 4 arch/x86/events/intel/uncore.c | 10 - arch/x86/kernel/apb_timer.c | 2 arch/x86/kernel/apic/x2apic_cluster.c | 2 arch/x86/kernel/hpet.c | 4 arch/x86/kernel/tboot.c | 2 arch/x86/kvm/x86.c | 2 arch/x86/xen/enlighten.c | 4 arch/xtensa/kernel/perf_event.c | 2 b/arch/metag/kernel/perf/perf_event.c | 2 drivers/bus/arm-cci.c | 2 drivers/bus/arm-ccn.c | 2 drivers/clocksource/arc_timer.c | 2 drivers/clocksource/arm_arch_timer.c | 2 drivers/clocksource/arm_global_timer.c | 2 drivers/clocksource/dummy_timer.c | 2 drivers/clocksource/exynos_mct.c | 2 drivers/clocksource/jcore-pit.c | 2 drivers/clocksource/metag_generic.c | 2 drivers/clocksource/mips-gic-timer.c | 4 drivers/clocksource/qcom-timer.c | 2 drivers/clocksource/time-armada-370-xp.c | 2 drivers/clocksource/timer-atlas7.c | 2 drivers/hwtracing/coresight/coresight-etm3x.c | 4 drivers/hwtracing/coresight/coresight-etm4x.c | 8 drivers/irqchip/irq-armada-370-xp.c | 6 drivers/irqchip/irq-bcm2836.c | 2 drivers/irqchip/irq-gic-v3.c | 6 drivers/irqchip/irq-gic.c | 2 drivers/irqchip/irq-hip04.c | 2 drivers/leds/trigger/ledtrig-cpu.c | 2 drivers/net/virtio_net.c | 4 drivers/perf/arm_pmu.c | 2 drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 81 +++----- drivers/scsi/bnx2i/bnx2i_init.c | 80 +++----- drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c | 85 ++++----- drivers/xen/events/events_fifo.c | 2 include/linux/cpu.h | 90 --------- include/linux/cpuhotplug.h | 9 kernel/cpu.c | 172 ++----------------- lib/Kconfig.debug | 24 -- lib/Makefile | 1 virt/kvm/arm/arch_timer.c | 2 virt/kvm/arm/vgic/vgic-init.c | 2 virt/kvm/kvm_main.c | 2 70 files changed, 240 insertions(+), 587 deletions(-)
PATCH 1/10 ARM: imx: mmcd: Fix broken cpu hotplug handling
The cpu hotplug support of this perf driver is broken in several ways:
1) It adds a instance before setting up the state.
2) The state for the instance is different from the state of the callback. It's just a randomly chosen state.
3) The instance registration is not error checked so nobody noticed that the call can never succeed.
4) The state for the multi install callbacks is chosen randomly and overwrites existing state. This is now prevented by the core code so the call is guaranteed to fail.
5) The error exit path in the init function leaves the instance registered and then frees the memory which contains the enqueued hlist node.
6) The remove function is removing the state and not the instance.
Fix it by:
- Setting up the state before adding instances. Use a dynamically allocated state for it.
- Install instances after the state has been set up
- Remove the instance in the error path before freeing memory
- Remove instance not the state in the driver remove callback
While at is use raw_cpu_processor_id(), because cpu_processor_id() cannot be used in preemptible context, and set the driver data after successful registration of the pmu.
--- arch/arm/mach-imx/mmdc.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-)
arch/arm/mach-imx/mmdc.c +22 -12
@@ -60,6 +60,7 @@#define to_mmdc_pmu (p) container_of(p, struct mmdc_pmu, pmu) +static enum cpuhp_state cpuhp_mmdc_state;static int ddr_type;struct fsl_mmdc_devtype_data {
@@ -451,8 +452,8 @@ static int imx_mmdc_remove(struct platfo {struct mmdc_pmu *pmu_mmdc =platform_get_drvdata (pdev); +cpuhp_state_remove_instance_nocalls (cpuhp_mmdc_state, &pmu_mmdc->node);perf_pmu_unregister (&pmu_mmdc->pmu); -cpuhp_remove_state_nocalls (CPUHP_ONLINE );kfree (pmu_mmdc);return 0 ; }
@@ -472,6 +473,18 @@ static int imx_mmdc_perf_init(struct plareturn -ENOMEM ; } +/* The first instance registers the hotplug state */ +if (!cpuhp_mmdc_state) { + ret =cpuhp_setup_state_multi (CPUHP_AP_ONLINE_DYN , +"perf/arm/mmdc:online" ,NULL , + mmdc_pmu_offline_cpu); +if (ret <0 ) { +pr_err ("cpuhp_setup_state_multi failed\n" ); + goto pmu_free; + } + cpuhp_mmdc_state = ret; + } + mmdc_num =mmdc_pmu_init (pmu_mmdc, mmdc_base, &pdev->dev);if (mmdc_num ==0 ) name ="mmdc" ;
@@ -485,26 +498,23 @@ static int imx_mmdc_perf_init(struct pla HRTIMER_MODE_REL); pmu_mmdc->hrtimer.function = mmdc_pmu_timer_handler; -cpuhp_state_add_instance_nocalls (CPUHP_ONLINE , - &pmu_mmdc->node); -cpumask_set_cpu (smp_processor_id (), &pmu_mmdc->cpu); - ret =cpuhp_setup_state_multi (CPUHP_AP_NOTIFY_ONLINE , -"MMDC_ONLINE" ,NULL , - mmdc_pmu_offline_cpu); -if (ret) { -pr_err ("cpuhp_setup_state_multi failure\n" ); - goto pmu_register_err; - } +cpumask_set_cpu (raw_smp_processor_id (), &pmu_mmdc->cpu); + +/* Register the pmu instance for cpu hotplug */ +cpuhp_state_add_instance_nocalls (cpuhp_mmdc_state, &pmu_mmdc->node); ret =perf_pmu_register (&(pmu_mmdc->pmu), name,-1 ); -platform_set_drvdata (pdev, pmu_mmdc);if (ret) goto pmu_register_err; + +platform_set_drvdata (pdev, pmu_mmdc);return 0 ; pmu_register_err:pr_warn ("MMDC Perf PMU failed (%d), disabled\n" , ret); +cpuhp_state_remove_instance_nocalls (cpuhp_mmdc_state, &pmu_mmdc->node);hrtimer_cancel (&pmu_mmdc->hrtimer); +pmu_free:kfree (pmu_mmdc);return ret; }
tip-bot for Thomas Gleixner
merge bot[tip:smp/urgent] ARM/imx/mmcd: Fix broken cpu hotplug handling
ARM/imx/mmcd: Fix broken cpu hotplug handling
Commit-ID: a5d3bb6a5ba9727a02b328a249652f3ea655a064 Gitweb: http://git.kernel.org/tip/a5d3bb6a5ba9727a02b328a249652f3ea655a064 Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 21 Dec 2016 20:19:48 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Thu, 22 Dec 2016 11:37:53 +0100
ARM/imx/mmcd: Fix broken cpu hotplug handling
The cpu hotplug support of this perf driver is broken in several ways:
1) It adds a instance before setting up the state.
2) The state for the instance is different from the state of the callback. It's just a randomly chosen state.
3) The instance registration is not error checked so nobody noticed that the call can never succeed.
4) The state for the multi install callbacks is chosen randomly and overwrites existing state. This is now prevented by the core code so the call is guaranteed to fail.
5) The error exit path in the init function leaves the instance registered and then frees the memory which contains the enqueued hlist node.
6) The remove function is removing the state and not the instance.
Fix it by:
- Setting up the state before adding instances. Use a dynamically allocated state for it.
- Installing instances after the state has been set up
- Removing the instance in the error path before freeing memory
- Removing the instance not the state in the driver remove callback
While at is use raw_cpu_processor_id(), because cpu_processor_id() cannot be used in preemptible context, and set the driver data after successful registration of the pmu.
--- arch/arm/mach-imx/mmdc.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-)
arch/arm/mach-imx/mmdc.c +22 -12
@@ -60,6 +60,7 @@#define to_mmdc_pmu (p) container_of(p, struct mmdc_pmu, pmu) +static enum cpuhp_state cpuhp_mmdc_state;static int ddr_type;struct fsl_mmdc_devtype_data {
@@ -451,8 +452,8 @@ static int imx_mmdc_remove(struct platform_device *pdev) {struct mmdc_pmu *pmu_mmdc =platform_get_drvdata (pdev); +cpuhp_state_remove_instance_nocalls (cpuhp_mmdc_state, &pmu_mmdc->node);perf_pmu_unregister (&pmu_mmdc->pmu); -cpuhp_remove_state_nocalls (CPUHP_ONLINE );kfree (pmu_mmdc);return 0 ; }
@@ -472,6 +473,18 @@ static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_breturn -ENOMEM ; } +/* The first instance registers the hotplug state */ +if (!cpuhp_mmdc_state) { + ret =cpuhp_setup_state_multi (CPUHP_AP_ONLINE_DYN , +"perf/arm/mmdc:online" ,NULL , + mmdc_pmu_offline_cpu); +if (ret <0 ) { +pr_err ("cpuhp_setup_state_multi failed\n" ); + goto pmu_free; + } + cpuhp_mmdc_state = ret; + } + mmdc_num =mmdc_pmu_init (pmu_mmdc, mmdc_base, &pdev->dev);if (mmdc_num ==0 ) name ="mmdc" ;
@@ -485,26 +498,23 @@ static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_b HRTIMER_MODE_REL); pmu_mmdc->hrtimer.function = mmdc_pmu_timer_handler; -cpuhp_state_add_instance_nocalls (CPUHP_ONLINE , - &pmu_mmdc->node); -cpumask_set_cpu (smp_processor_id (), &pmu_mmdc->cpu); - ret =cpuhp_setup_state_multi (CPUHP_AP_NOTIFY_ONLINE , -"MMDC_ONLINE" ,NULL , - mmdc_pmu_offline_cpu); -if (ret) { -pr_err ("cpuhp_setup_state_multi failure\n" ); - goto pmu_register_err; - } +cpumask_set_cpu (raw_smp_processor_id (), &pmu_mmdc->cpu); + +/* Register the pmu instance for cpu hotplug */ +cpuhp_state_add_instance_nocalls (cpuhp_mmdc_state, &pmu_mmdc->node); ret =perf_pmu_register (&(pmu_mmdc->pmu), name,-1 ); -platform_set_drvdata (pdev, pmu_mmdc);if (ret) goto pmu_register_err; + +platform_set_drvdata (pdev, pmu_mmdc);return 0 ; pmu_register_err:pr_warn ("MMDC Perf PMU failed (%d), disabled\n" , ret); +cpuhp_state_remove_instance_nocalls (cpuhp_mmdc_state, &pmu_mmdc->node);hrtimer_cancel (&pmu_mmdc->hrtimer); +pmu_free:kfree (pmu_mmdc);return ret; }
tip-bot for Thomas Gleixner
merge bot[tip:smp/urgent] ARM/imx/mmcd: Fix broken cpu hotplug handling
In reply to Thomas GleixnerARM/imx/mmcd: Fix broken cpu hotplug handling
Commit-ID: a051f220d6b9bf9367695e2c319ccc3712b631ee Gitweb: http://git.kernel.org/tip/a051f220d6b9bf9367695e2c319ccc3712b631ee Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 21 Dec 2016 20:19:48 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Sun, 25 Dec 2016 10:47:40 +0100
ARM/imx/mmcd: Fix broken cpu hotplug handling
The cpu hotplug support of this perf driver is broken in several ways:
1) It adds a instance before setting up the state.
2) The state for the instance is different from the state of the callback. It's just a randomly chosen state.
3) The instance registration is not error checked so nobody noticed that the call can never succeed.
4) The state for the multi install callbacks is chosen randomly and overwrites existing state. This is now prevented by the core code so the call is guaranteed to fail.
5) The error exit path in the init function leaves the instance registered and then frees the memory which contains the enqueued hlist node.
6) The remove function is removing the state and not the instance.
Fix it by:
- Setting up the state before adding instances. Use a dynamically allocated state for it.
- Installing instances after the state has been set up
- Removing the instance in the error path before freeing memory
- Removing the instance not the state in the driver remove callback
While at is use raw_cpu_processor_id(), because cpu_processor_id() cannot be used in preemptible context, and set the driver data after successful registration of the pmu.
--- arch/arm/mach-imx/mmdc.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-)
arch/arm/mach-imx/mmdc.c +22 -12
@@ -60,6 +60,7 @@#define to_mmdc_pmu (p) container_of(p, struct mmdc_pmu, pmu) +static enum cpuhp_state cpuhp_mmdc_state;static int ddr_type;struct fsl_mmdc_devtype_data {
@@ -451,8 +452,8 @@ static int imx_mmdc_remove(struct platform_device *pdev) {struct mmdc_pmu *pmu_mmdc =platform_get_drvdata (pdev); +cpuhp_state_remove_instance_nocalls (cpuhp_mmdc_state, &pmu_mmdc->node);perf_pmu_unregister (&pmu_mmdc->pmu); -cpuhp_remove_state_nocalls (CPUHP_ONLINE );kfree (pmu_mmdc);return 0 ; }
@@ -472,6 +473,18 @@ static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_breturn -ENOMEM ; } +/* The first instance registers the hotplug state */ +if (!cpuhp_mmdc_state) { + ret =cpuhp_setup_state_multi (CPUHP_AP_ONLINE_DYN , +"perf/arm/mmdc:online" ,NULL , + mmdc_pmu_offline_cpu); +if (ret <0 ) { +pr_err ("cpuhp_setup_state_multi failed\n" ); + goto pmu_free; + } + cpuhp_mmdc_state = ret; + } + mmdc_num =mmdc_pmu_init (pmu_mmdc, mmdc_base, &pdev->dev);if (mmdc_num ==0 ) name ="mmdc" ;
@@ -485,26 +498,23 @@ static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_b HRTIMER_MODE_REL); pmu_mmdc->hrtimer.function = mmdc_pmu_timer_handler; -cpuhp_state_add_instance_nocalls (CPUHP_ONLINE , - &pmu_mmdc->node); -cpumask_set_cpu (smp_processor_id (), &pmu_mmdc->cpu); - ret =cpuhp_setup_state_multi (CPUHP_AP_NOTIFY_ONLINE , -"MMDC_ONLINE" ,NULL , - mmdc_pmu_offline_cpu); -if (ret) { -pr_err ("cpuhp_setup_state_multi failure\n" ); - goto pmu_register_err; - } +cpumask_set_cpu (raw_smp_processor_id (), &pmu_mmdc->cpu); + +/* Register the pmu instance for cpu hotplug */ +cpuhp_state_add_instance_nocalls (cpuhp_mmdc_state, &pmu_mmdc->node); ret =perf_pmu_register (&(pmu_mmdc->pmu), name,-1 ); -platform_set_drvdata (pdev, pmu_mmdc);if (ret) goto pmu_register_err; + +platform_set_drvdata (pdev, pmu_mmdc);return 0 ; pmu_register_err:pr_warn ("MMDC Perf PMU failed (%d), disabled\n" , ret); +cpuhp_state_remove_instance_nocalls (cpuhp_mmdc_state, &pmu_mmdc->node);hrtimer_cancel (&pmu_mmdc->hrtimer); +pmu_free:kfree (pmu_mmdc);return ret; }
PATCH 2/10 cpu/hotplug: Prevent overwriting of callbacks
In reply to Thomas GleixnerDevelopers manage to overwrite states blindly without thought. That's fatal and hard to debug. Add sanity checks to make it fail.
--- kernel/cpu.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-)
kernel/cpu.c +21 -12
@@ -1432,23 +1432,29 @@ static int cpuhp_cb_check(enum cpuhp_stareturn 0 ; } -static void cpuhp_store_callbacks (enum cpuhp_state state, -const char *name, -int (*startup)(unsigned int cpu), -int (*teardown)(unsigned int cpu), -bool multi_instance) +static int cpuhp_store_callbacks (enum cpuhp_state state,const char *name, +int (*startup)(unsigned int cpu), +int (*teardown)(unsigned int cpu), +bool multi_instance) {/* (Un)Install the callbacks for further cpu hotplug operations */ struct cpuhp_step *sp; +int ret =0 ;mutex_lock (&cpuhp_state_mutex); sp =cpuhp_get_step (state); +if (name && sp->name) { + ret = -EBUSY ; + goto out; + } sp->startup.single = startup; sp->teardown.single = teardown; sp->name = name; sp->multi_instance = multi_instance;INIT_HLIST_HEAD (&sp->list); +out:mutex_unlock (&cpuhp_state_mutex); +return ret; }static void *cpuhp_get_teardown_cb (enum cpuhp_state state)
@@ -1580,11 +1586,13 @@ EXPORT_SYMBOL_GPL(__cpuhp_state_add_inst/** * __cpuhp_setup_state - Setup the callbacks for an hotplug machine state -* @state: The state to setup -* @invoke: If true, the startup function is invoked for cpus where -* cpu state >= @state -* @startup: startup callback function -* @teardown: teardown callback function +* @state: The state to setup +* @invoke: If true, the startup function is invoked for cpus where +* cpu state >= @state +* @startup: startup callback function +* @teardown: teardown callback function +* @multi_instance: State is set up for multiple instances which get +* added afterwards. * * Returns: * On success:
@@ -1615,9 +1623,10 @@ int __cpuhp_setup_state(enum cpuhp_state state = ret; } -cpuhp_store_callbacks (state, name, startup, teardown, multi_instance); + ret =cpuhp_store_callbacks (state, name, startup, teardown, + multi_instance); -if (!invoke || !startup) +if (ret || !invoke || !startup) goto out;/*
Re: [patch 02/10] cpu/hotplug: Prevent overwriting of callbacks
Quoted 2 lines · Thomas Gleixner
Developers manage to overwrite states blindly without thought. That's fatal and hard to debug. Add sanity checks to make it fail.
This breaks dynamic states :( Fixed version below.
Thanks,
tglx
8<------------------
Subject: cpu/hotplug: Prevent overwriting of callbacks
From: Thomas Gleixner <[email protected]>
Date: Wed, 21 Dec 2016 20:19:49 +0100
Developers manage to overwrite states blindly without thought. That's fatal and hard to debug. Add sanity checks to make it fail.
This requries to restructure the code so that the dynamic state allocation happens in the same lock protected section as the actual store. Otherwise the previous assignment of 'Reserved' to the name field would trigger the overwrite check.
--- kernel/cpu.c | 96 ++++++++++++++++++++++++++++++----------------------------- 1 file changed, 50 insertions(+), 46 deletions(-)
kernel/cpu.c +50 -46
@@ -1432,23 +1432,53 @@ static int cpuhp_cb_check(enum cpuhp_stareturn 0 ; } -static void cpuhp_store_callbacks (enum cpuhp_state state, -const char *name, -int (*startup)(unsigned int cpu), -int (*teardown)(unsigned int cpu), -bool multi_instance) +/* +* Returns a free for dynamic slot assignment of the Online state. The states +* are protected by the cpuhp_slot_states mutex and an empty slot is identified +* by having no name assigned. +*/ +static int cpuhp_reserve_state (enum cpuhp_state state) +{ +enum cpuhp_state i; + +for (i =CPUHP_AP_ONLINE_DYN ; i <=CPUHP_AP_ONLINE_DYN_END ; i++) { +if (!cpuhp_ap_states[i].name) +return i; + } +WARN (1 ,"No more dynamic states available for CPU hotplug\n" ); +return -ENOSPC ; +} + +static int cpuhp_store_callbacks (enum cpuhp_state state,const char *name, +int (*startup)(unsigned int cpu), +int (*teardown)(unsigned int cpu), +bool multi_instance) {/* (Un)Install the callbacks for further cpu hotplug operations */ struct cpuhp_step *sp; +int ret =0 ;mutex_lock (&cpuhp_state_mutex); + +if (state ==CPUHP_AP_ONLINE_DYN ) { + ret =cpuhp_reserve_state (state); +if (ret <0 ) + goto out; + state = ret; + } sp =cpuhp_get_step (state); +if (name && sp->name) { + ret = -EBUSY ; + goto out; + } sp->startup.single = startup; sp->teardown.single = teardown; sp->name = name; sp->multi_instance = multi_instance;INIT_HLIST_HEAD (&sp->list); +out:mutex_unlock (&cpuhp_state_mutex); +return ret; }static void *cpuhp_get_teardown_cb (enum cpuhp_state state)
@@ -1509,29 +1539,6 @@ static void cpuhp_rollback_install(int f } } -/* -* Returns a free for dynamic slot assignment of the Online state. The states -* are protected by the cpuhp_slot_states mutex and an empty slot is identified -* by having no name assigned. -*/ -static int cpuhp_reserve_state (enum cpuhp_state state) -{ -enum cpuhp_state i; - -mutex_lock (&cpuhp_state_mutex); -for (i =CPUHP_AP_ONLINE_DYN ; i <=CPUHP_AP_ONLINE_DYN_END ; i++) { -if (cpuhp_ap_states[i].name) -continue ; - - cpuhp_ap_states[i].name ="Reserved" ; -mutex_unlock (&cpuhp_state_mutex); -return i; - } -mutex_unlock (&cpuhp_state_mutex); -WARN (1 ,"No more dynamic states available for CPU hotplug\n" ); -return -ENOSPC ; -} -int __cpuhp_state_add_instance (enum cpuhp_state state,struct hlist_node *node,bool invoke) {
@@ -1580,11 +1587,13 @@ EXPORT_SYMBOL_GPL(__cpuhp_state_add_inst/** * __cpuhp_setup_state - Setup the callbacks for an hotplug machine state -* @state: The state to setup -* @invoke: If true, the startup function is invoked for cpus where -* cpu state >= @state -* @startup: startup callback function -* @teardown: teardown callback function +* @state: The state to setup +* @invoke: If true, the startup function is invoked for cpus where +* cpu state >= @state +* @startup: startup callback function +* @teardown: teardown callback function +* @multi_instance: State is set up for multiple instances which get +* added afterwards. * * Returns: * On success:
@@ -1599,25 +1608,16 @@ int __cpuhp_setup_state(enum cpuhp_state bool multi_instance) {int cpu, ret =0 ; -int dyn_state =0 ;if (cpuhp_cb_check (state) || !name)return -EINVAL ;get_online_cpus (); -/* currently assignments for the ONLINE state are possible */ -if (state ==CPUHP_AP_ONLINE_DYN ) { - dyn_state =1 ; - ret =cpuhp_reserve_state (state); -if (ret <0 ) - goto out; - state = ret; - } + ret =cpuhp_store_callbacks (state, name, startup, teardown, + multi_instance); -cpuhp_store_callbacks (state, name, startup, teardown, multi_instance); - -if (!invoke || !startup) +if (ret || !invoke || !startup) goto out;/*
@@ -1641,7 +1641,11 @@ int __cpuhp_setup_state(enum cpuhp_state } out:put_online_cpus (); -if (!ret && dyn_state) +/* +* If the requested state is CPUHP_AP_ONLINE_DYN, return the +* dynamically allocated state in case of success. +*/ +if (!ret && state ==CPUHP_AP_ONLINE_DYN )return state;return ret; }
Re: [patch 02/10] cpu/hotplug: Prevent overwriting of callbacks
Oh hai!
I have kernel panic on boot here after this patch, 4.10-rc1 with this commit (dc280d93623927570da279e99393879dbbab39e7) reverted boots fine.
Potato-quality photo of incomplete traceback of 4.10-rc1 panic can be found at https://ojab.ru/IMG_20161227_015233.jpg (unfortunately I can't figure out how to increase resolution to catch a full trace and I don't have a serial terminal).
CPU here is 'AMD Phenom(tm) II X4 905e Processor' (4 core, 4 threads).
//wbr ojab
Re: [patch 02/10] cpu/hotplug: Prevent overwriting of callbacks
Quoted 5 lines · ojab
Oh hai!
I have kernel panic on boot here after this patch, 4.10-rc1 with this commit (
dc280d93623927570da279e99393879dbbab39e7) reverted boots fine.
Quoted 9 lines
Potato-quality photo of incomplete traceback of 4.10-rc1 panic can be found at https://ojab.ru/IMG_20161227_015233.jpg (unfortunately I can't figure out how to increase resolution to catch a full trace and I don't have a serial terminal).
CPU here is 'AMD Phenom(tm) II X4 905e Processor' (4 core, 4 threads).
//wbr ojab
…and looks like it's fixed by patches in [patch 0/2] smp/hotplug: Fix last minute wreckage thread
//wbr ojab
tip-bot for Thomas Gleixner
merge bot[tip:smp/urgent] cpu/hotplug: Prevent overwriting of callbacks
In reply to Thomas Gleixnercpu/hotplug: Prevent overwriting of callbacks
Commit-ID: ab92ca2014a32ea5dc7f954f84661f6d96f0ba26 Gitweb: http://git.kernel.org/tip/ab92ca2014a32ea5dc7f954f84661f6d96f0ba26 Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 21 Dec 2016 20:19:49 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Thu, 22 Dec 2016 11:37:54 +0100
cpu/hotplug: Prevent overwriting of callbacks
Developers manage to overwrite states blindly without thought. That's fatal and hard to debug. Add sanity checks to make it fail.
This requries to restructure the code so that the dynamic state allocation happens in the same lock protected section as the actual store. Otherwise the previous assignment of 'Reserved' to the name field would trigger the overwrite check.
--- kernel/cpu.c | 96 +++++++++++++++++++++++++++++++----------------------------- 1 file changed, 50 insertions(+), 46 deletions(-)
kernel/cpu.c +50 -46
@@ -1432,23 +1432,53 @@ static int cpuhp_cb_check(enum cpuhp_state state)return 0 ; } -static void cpuhp_store_callbacks (enum cpuhp_state state, -const char *name, -int (*startup)(unsigned int cpu), -int (*teardown)(unsigned int cpu), -bool multi_instance) +/* +* Returns a free for dynamic slot assignment of the Online state. The states +* are protected by the cpuhp_slot_states mutex and an empty slot is identified +* by having no name assigned. +*/ +static int cpuhp_reserve_state (enum cpuhp_state state) +{ +enum cpuhp_state i; + +for (i =CPUHP_AP_ONLINE_DYN ; i <=CPUHP_AP_ONLINE_DYN_END ; i++) { +if (!cpuhp_ap_states[i].name) +return i; + } +WARN (1 ,"No more dynamic states available for CPU hotplug\n" ); +return -ENOSPC ; +} + +static int cpuhp_store_callbacks (enum cpuhp_state state,const char *name, +int (*startup)(unsigned int cpu), +int (*teardown)(unsigned int cpu), +bool multi_instance) {/* (Un)Install the callbacks for further cpu hotplug operations */ struct cpuhp_step *sp; +int ret =0 ;mutex_lock (&cpuhp_state_mutex); + +if (state ==CPUHP_AP_ONLINE_DYN ) { + ret =cpuhp_reserve_state (state); +if (ret <0 ) + goto out; + state = ret; + } sp =cpuhp_get_step (state); +if (name && sp->name) { + ret = -EBUSY ; + goto out; + } sp->startup.single = startup; sp->teardown.single = teardown; sp->name = name; sp->multi_instance = multi_instance;INIT_HLIST_HEAD (&sp->list); +out:mutex_unlock (&cpuhp_state_mutex); +return ret; }static void *cpuhp_get_teardown_cb (enum cpuhp_state state)
@@ -1509,29 +1539,6 @@ static void cpuhp_rollback_install(int failedcpu, enum cpuhp_state state, } } -/* -* Returns a free for dynamic slot assignment of the Online state. The states -* are protected by the cpuhp_slot_states mutex and an empty slot is identified -* by having no name assigned. -*/ -static int cpuhp_reserve_state (enum cpuhp_state state) -{ -enum cpuhp_state i; - -mutex_lock (&cpuhp_state_mutex); -for (i =CPUHP_AP_ONLINE_DYN ; i <=CPUHP_AP_ONLINE_DYN_END ; i++) { -if (cpuhp_ap_states[i].name) -continue ; - - cpuhp_ap_states[i].name ="Reserved" ; -mutex_unlock (&cpuhp_state_mutex); -return i; - } -mutex_unlock (&cpuhp_state_mutex); -WARN (1 ,"No more dynamic states available for CPU hotplug\n" ); -return -ENOSPC ; -} -int __cpuhp_state_add_instance (enum cpuhp_state state,struct hlist_node *node,bool invoke) {
@@ -1580,11 +1587,13 @@ EXPORT_SYMBOL_GPL(__cpuhp_state_add_instance);/** * __cpuhp_setup_state - Setup the callbacks for an hotplug machine state -* @state: The state to setup -* @invoke: If true, the startup function is invoked for cpus where -* cpu state >= @state -* @startup: startup callback function -* @teardown: teardown callback function +* @state: The state to setup +* @invoke: If true, the startup function is invoked for cpus where +* cpu state >= @state +* @startup: startup callback function +* @teardown: teardown callback function +* @multi_instance: State is set up for multiple instances which get +* added afterwards. * * Returns: * On success:
@@ -1599,25 +1608,16 @@ int __cpuhp_setup_state(enum cpuhp_state state, bool multi_instance) {int cpu, ret =0 ; -int dyn_state =0 ;if (cpuhp_cb_check (state) || !name)return -EINVAL ;get_online_cpus (); -/* currently assignments for the ONLINE state are possible */ -if (state ==CPUHP_AP_ONLINE_DYN ) { - dyn_state =1 ; - ret =cpuhp_reserve_state (state); -if (ret <0 ) - goto out; - state = ret; - } - -cpuhp_store_callbacks (state, name, startup, teardown, multi_instance); + ret =cpuhp_store_callbacks (state, name, startup, teardown, + multi_instance); -if (!invoke || !startup) +if (ret || !invoke || !startup) goto out;/*
@@ -1641,7 +1641,11 @@ int __cpuhp_setup_state(enum cpuhp_state state, } out:put_online_cpus (); -if (!ret && dyn_state) +/* +* If the requested state is CPUHP_AP_ONLINE_DYN, return the +* dynamically allocated state in case of success. +*/ +if (!ret && state ==CPUHP_AP_ONLINE_DYN )return state;return ret; }
tip-bot for Thomas Gleixner
merge bot[tip:smp/urgent] cpu/hotplug: Prevent overwriting of callbacks
In reply to Thomas Gleixnercpu/hotplug: Prevent overwriting of callbacks
Commit-ID: dc280d93623927570da279e99393879dbbab39e7 Gitweb: http://git.kernel.org/tip/dc280d93623927570da279e99393879dbbab39e7 Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 21 Dec 2016 20:19:49 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Sun, 25 Dec 2016 10:47:42 +0100
cpu/hotplug: Prevent overwriting of callbacks
Developers manage to overwrite states blindly without thought. That's fatal and hard to debug. Add sanity checks to make it fail.
This requries to restructure the code so that the dynamic state allocation happens in the same lock protected section as the actual store. Otherwise the previous assignment of 'Reserved' to the name field would trigger the overwrite check.
--- kernel/cpu.c | 96 +++++++++++++++++++++++++++++++----------------------------- 1 file changed, 50 insertions(+), 46 deletions(-)
kernel/cpu.c +50 -46
@@ -1432,23 +1432,53 @@ static int cpuhp_cb_check(enum cpuhp_state state)return 0 ; } -static void cpuhp_store_callbacks (enum cpuhp_state state, -const char *name, -int (*startup)(unsigned int cpu), -int (*teardown)(unsigned int cpu), -bool multi_instance) +/* +* Returns a free for dynamic slot assignment of the Online state. The states +* are protected by the cpuhp_slot_states mutex and an empty slot is identified +* by having no name assigned. +*/ +static int cpuhp_reserve_state (enum cpuhp_state state) +{ +enum cpuhp_state i; + +for (i =CPUHP_AP_ONLINE_DYN ; i <=CPUHP_AP_ONLINE_DYN_END ; i++) { +if (!cpuhp_ap_states[i].name) +return i; + } +WARN (1 ,"No more dynamic states available for CPU hotplug\n" ); +return -ENOSPC ; +} + +static int cpuhp_store_callbacks (enum cpuhp_state state,const char *name, +int (*startup)(unsigned int cpu), +int (*teardown)(unsigned int cpu), +bool multi_instance) {/* (Un)Install the callbacks for further cpu hotplug operations */ struct cpuhp_step *sp; +int ret =0 ;mutex_lock (&cpuhp_state_mutex); + +if (state ==CPUHP_AP_ONLINE_DYN ) { + ret =cpuhp_reserve_state (state); +if (ret <0 ) + goto out; + state = ret; + } sp =cpuhp_get_step (state); +if (name && sp->name) { + ret = -EBUSY ; + goto out; + } sp->startup.single = startup; sp->teardown.single = teardown; sp->name = name; sp->multi_instance = multi_instance;INIT_HLIST_HEAD (&sp->list); +out:mutex_unlock (&cpuhp_state_mutex); +return ret; }static void *cpuhp_get_teardown_cb (enum cpuhp_state state)
@@ -1509,29 +1539,6 @@ static void cpuhp_rollback_install(int failedcpu, enum cpuhp_state state, } } -/* -* Returns a free for dynamic slot assignment of the Online state. The states -* are protected by the cpuhp_slot_states mutex and an empty slot is identified -* by having no name assigned. -*/ -static int cpuhp_reserve_state (enum cpuhp_state state) -{ -enum cpuhp_state i; - -mutex_lock (&cpuhp_state_mutex); -for (i =CPUHP_AP_ONLINE_DYN ; i <=CPUHP_AP_ONLINE_DYN_END ; i++) { -if (cpuhp_ap_states[i].name) -continue ; - - cpuhp_ap_states[i].name ="Reserved" ; -mutex_unlock (&cpuhp_state_mutex); -return i; - } -mutex_unlock (&cpuhp_state_mutex); -WARN (1 ,"No more dynamic states available for CPU hotplug\n" ); -return -ENOSPC ; -} -int __cpuhp_state_add_instance (enum cpuhp_state state,struct hlist_node *node,bool invoke) {
@@ -1580,11 +1587,13 @@ EXPORT_SYMBOL_GPL(__cpuhp_state_add_instance);/** * __cpuhp_setup_state - Setup the callbacks for an hotplug machine state -* @state: The state to setup -* @invoke: If true, the startup function is invoked for cpus where -* cpu state >= @state -* @startup: startup callback function -* @teardown: teardown callback function +* @state: The state to setup +* @invoke: If true, the startup function is invoked for cpus where +* cpu state >= @state +* @startup: startup callback function +* @teardown: teardown callback function +* @multi_instance: State is set up for multiple instances which get +* added afterwards. * * Returns: * On success:
@@ -1599,25 +1608,16 @@ int __cpuhp_setup_state(enum cpuhp_state state, bool multi_instance) {int cpu, ret =0 ; -int dyn_state =0 ;if (cpuhp_cb_check (state) || !name)return -EINVAL ;get_online_cpus (); -/* currently assignments for the ONLINE state are possible */ -if (state ==CPUHP_AP_ONLINE_DYN ) { - dyn_state =1 ; - ret =cpuhp_reserve_state (state); -if (ret <0 ) - goto out; - state = ret; - } - -cpuhp_store_callbacks (state, name, startup, teardown, multi_instance); + ret =cpuhp_store_callbacks (state, name, startup, teardown, + multi_instance); -if (!invoke || !startup) +if (ret || !invoke || !startup) goto out;/*
@@ -1641,7 +1641,11 @@ int __cpuhp_setup_state(enum cpuhp_state state, } out:put_online_cpus (); -if (!ret && dyn_state) +/* +* If the requested state is CPUHP_AP_ONLINE_DYN, return the +* dynamically allocated state in case of success. +*/ +if (!ret && state ==CPUHP_AP_ONLINE_DYN )return state;return ret; }
PATCH 3/10 scsi/bnx2fc: Convert to hotplug state machine
In reply to Thomas GleixnerFrom: Sebastian Andrzej Siewior <[email protected]>
Install the callbacks via the state machine. No functional change.
This is the minimal fixup so we can remove the hotplug notifier mess completely.
The real rework of this driver to use work queues is still stuck in review/testing on the SCSI mailing list.
--- drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 81 +++++++++++++++----------------------- include/linux/cpuhotplug.h | 1 2 files changed, 35 insertions(+), 47 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +34 -47
@@ -127,13 +127,6 @@ module_param_named(log_fka, bnx2fc_log_fMODULE_PARM_DESC (log_fka," Print message to kernel log when fcoe is " "initiating a FIP keep alive when debug logging is enabled." ); -static int bnx2fc_cpu_callback (struct notifier_block *nfb, -unsigned long action,void *hcpu); -/* notification function for CPU hotplug events */ -static struct notifier_block bnx2fc_cpu_notifier = { - .notifier_call = bnx2fc_cpu_callback, -}; -static inline struct net_device *bnx2fc_netdev (const struct fc_lport *lport) { return ((struct bnx2fc_interface *)
@@ -2622,37 +2615,19 @@ static void bnx2fc_percpu_thread_destroykthread_stop (thread); } -/** -* bnx2fc_cpu_callback - Handler for CPU hotplug events -* -* @nfb: The callback data block -* @action: The event triggering the callback -* @hcpu: The index of the CPU that the event is for -* -* This creates or destroys per-CPU data for fcoe -* -* Returns NOTIFY_OK always. -*/ -static int bnx2fc_cpu_callback (struct notifier_block *nfb, -unsigned long action,void *hcpu) + +static int bnx2fc_cpu_online (unsigned int cpu) { -unsigned cpu = (unsigned long )hcpu; +printk (PFX "CPU %x online: Create Rx thread\n" , cpu); +bnx2fc_percpu_thread_create (cpu); +return 0 ; +} -switch (action) { -case CPU_ONLINE : -case CPU_ONLINE_FROZEN : -printk (PFX "CPU %x online: Create Rx thread\n" , cpu); -bnx2fc_percpu_thread_create (cpu); -break ; -case CPU_DEAD : -case CPU_DEAD_FROZEN : -printk (PFX "CPU %x offline: Remove Rx thread\n" , cpu); -bnx2fc_percpu_thread_destroy (cpu); -break ; -default : -break ; - } -return NOTIFY_OK ; +static int bnx2fc_cpu_dead (unsigned int cpu) +{ +printk (PFX "CPU %x offline: Remove Rx thread\n" , cpu); +bnx2fc_percpu_thread_destroy (cpu); +return 0 ; }static int bnx2fc_slave_configure (struct scsi_device *sdev)
@@ -2664,6 +2639,8 @@ static int bnx2fc_slave_configure(structreturn 0 ; } +static enum cpuhp_state bnx2fc_online_state; +/** * bnx2fc_mod_init - module init entry point *
@@ -2724,21 +2701,31 @@ static int __init bnx2fc_mod_init(void)spin_lock_init (&p->fp_work_lock); } -cpu_notifier_register_begin (); +get_online_cpus (); -for_each_online_cpu (cpu) { +for_each_online_cpu (cpu)bnx2fc_percpu_thread_create (cpu); - } -/* Initialize per CPU interrupt thread */ -__register_hotcpu_notifier (&bnx2fc_cpu_notifier); - -cpu_notifier_register_done (); + rc =cpuhp_setup_state_nocalls (CPUHP_AP_ONLINE_DYN , +"scsi/bnx2fc:online" , + bnx2fc_cpu_online,NULL ); +if (rc <0 ) + goto stop_threads; + bnx2fc_online_state = rc; + +cpuhp_setup_state_nocalls (CPUHP_SCSI_BNX2FC_DEAD ,"scsi/bnx2fc:dead" , +NULL , bnx2fc_cpu_dead); +put_online_cpus ();cnic_register_driver (CNIC_ULP_FCOE , &bnx2fc_cnic_cb);return 0 ; +stop_threads: +for_each_online_cpu (cpu) +bnx2fc_percpu_thread_destroy (cpu); +put_online_cpus (); +kthread_stop (l2_thread); free_wq:destroy_workqueue (bnx2fc_wq); release_bt:
@@ -2797,16 +2784,16 @@ static void __exit bnx2fc_mod_exit(void)if (l2_thread)kthread_stop (l2_thread); -cpu_notifier_register_begin (); - +get_online_cpus ();/* Destroy per cpu threads */ for_each_online_cpu (cpu) {bnx2fc_percpu_thread_destroy (cpu); } -__unregister_hotcpu_notifier (&bnx2fc_cpu_notifier); +cpuhp_remove_state_nocalls (bnx2fc_online_state); +cpuhp_remove_state_nocalls (CPUHP_SCSI_BNX2FC_DEAD ); -cpu_notifier_register_done (); +put_online_cpus ();destroy_workqueue (bnx2fc_wq);/*
include/linux/cpuhotplug.h +1 -0
@@ -41,6 +41,7 @@ enum cpuhp_state {CPUHP_NET_DEV_DEAD ,CPUHP_PCI_XGENE_DEAD ,CPUHP_IOMMU_INTEL_DEAD , +CPUHP_SCSI_BNX2FC_DEAD ,CPUHP_WORKQUEUE_PREP ,CPUHP_POWER_NUMA_PREPARE , CPUHP_HRTIMERS_PREPARE,
tip-bot for Sebastian Andrzej Siewior
merge bot[tip:smp/urgent] scsi/bnx2fc: Convert to hotplug state machine
scsi/bnx2fc: Convert to hotplug state machine
Commit-ID: 017426e49fec9fff11cba0dfcf9ea931425db904 Gitweb: http://git.kernel.org/tip/017426e49fec9fff11cba0dfcf9ea931425db904 Author: Sebastian Andrzej Siewior <[email protected]> AuthorDate: Wed, 21 Dec 2016 20:19:50 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Thu, 22 Dec 2016 11:37:54 +0100
scsi/bnx2fc: Convert to hotplug state machine
Install the callbacks via the state machine. No functional change.
This is the minimal fixup so we can remove the hotplug notifier mess completely.
The real rework of this driver to use work queues is still stuck in review/testing on the SCSI mailing list.
--- drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 79 ++++++++++++++++----------------------- include/linux/cpuhotplug.h | 1 + 2 files changed, 34 insertions(+), 46 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +33 -46
@@ -127,13 +127,6 @@ module_param_named(log_fka, bnx2fc_log_fka, uint, S_IRUGO|S_IWUSR);MODULE_PARM_DESC (log_fka," Print message to kernel log when fcoe is " "initiating a FIP keep alive when debug logging is enabled." ); -static int bnx2fc_cpu_callback (struct notifier_block *nfb, -unsigned long action,void *hcpu); -/* notification function for CPU hotplug events */ -static struct notifier_block bnx2fc_cpu_notifier = { - .notifier_call = bnx2fc_cpu_callback, -}; -static inline struct net_device *bnx2fc_netdev (const struct fc_lport *lport) { return ((struct bnx2fc_interface *)
@@ -2622,37 +2615,19 @@ static void bnx2fc_percpu_thread_destroy(unsigned int cpu)kthread_stop (thread); } -/** -* bnx2fc_cpu_callback - Handler for CPU hotplug events -* -* @nfb: The callback data block -* @action: The event triggering the callback -* @hcpu: The index of the CPU that the event is for -* -* This creates or destroys per-CPU data for fcoe -* -* Returns NOTIFY_OK always. -*/ -static int bnx2fc_cpu_callback (struct notifier_block *nfb, -unsigned long action,void *hcpu) + +static int bnx2fc_cpu_online (unsigned int cpu) { -unsigned cpu = (unsigned long )hcpu; +printk (PFX "CPU %x online: Create Rx thread\n" , cpu); +bnx2fc_percpu_thread_create (cpu); +return 0 ; +} -switch (action) { -case CPU_ONLINE : -case CPU_ONLINE_FROZEN : -printk (PFX "CPU %x online: Create Rx thread\n" , cpu); -bnx2fc_percpu_thread_create (cpu); -break ; -case CPU_DEAD : -case CPU_DEAD_FROZEN : -printk (PFX "CPU %x offline: Remove Rx thread\n" , cpu); -bnx2fc_percpu_thread_destroy (cpu); -break ; -default : -break ; - } -return NOTIFY_OK ; +static int bnx2fc_cpu_dead (unsigned int cpu) +{ +printk (PFX "CPU %x offline: Remove Rx thread\n" , cpu); +bnx2fc_percpu_thread_destroy (cpu); +return 0 ; }static int bnx2fc_slave_configure (struct scsi_device *sdev)
@@ -2664,6 +2639,8 @@ static int bnx2fc_slave_configure(struct scsi_device *sdev)return 0 ; } +static enum cpuhp_state bnx2fc_online_state; +/** * bnx2fc_mod_init - module init entry point *
@@ -2724,21 +2701,31 @@ static int __init bnx2fc_mod_init(void)spin_lock_init (&p->fp_work_lock); } -cpu_notifier_register_begin (); +get_online_cpus (); -for_each_online_cpu (cpu) { +for_each_online_cpu (cpu)bnx2fc_percpu_thread_create (cpu); - } -/* Initialize per CPU interrupt thread */ -__register_hotcpu_notifier (&bnx2fc_cpu_notifier); + rc =cpuhp_setup_state_nocalls (CPUHP_AP_ONLINE_DYN , +"scsi/bnx2fc:online" , + bnx2fc_cpu_online,NULL ); +if (rc <0 ) + goto stop_threads; + bnx2fc_online_state = rc; -cpu_notifier_register_done (); +cpuhp_setup_state_nocalls (CPUHP_SCSI_BNX2FC_DEAD ,"scsi/bnx2fc:dead" , +NULL , bnx2fc_cpu_dead); +put_online_cpus ();cnic_register_driver (CNIC_ULP_FCOE , &bnx2fc_cnic_cb);return 0 ; +stop_threads: +for_each_online_cpu (cpu) +bnx2fc_percpu_thread_destroy (cpu); +put_online_cpus (); +kthread_stop (l2_thread); free_wq:destroy_workqueue (bnx2fc_wq); release_bt:
@@ -2797,16 +2784,16 @@ static void __exit bnx2fc_mod_exit(void)if (l2_thread)kthread_stop (l2_thread); -cpu_notifier_register_begin (); - +get_online_cpus ();/* Destroy per cpu threads */ for_each_online_cpu (cpu) {bnx2fc_percpu_thread_destroy (cpu); } -__unregister_hotcpu_notifier (&bnx2fc_cpu_notifier); +cpuhp_remove_state_nocalls (bnx2fc_online_state); +cpuhp_remove_state_nocalls (CPUHP_SCSI_BNX2FC_DEAD ); -cpu_notifier_register_done (); +put_online_cpus ();destroy_workqueue (bnx2fc_wq);/*
include/linux/cpuhotplug.h +1 -0
@@ -41,6 +41,7 @@ enum cpuhp_state {CPUHP_NET_DEV_DEAD ,CPUHP_PCI_XGENE_DEAD ,CPUHP_IOMMU_INTEL_DEAD , +CPUHP_SCSI_BNX2FC_DEAD ,CPUHP_WORKQUEUE_PREP ,CPUHP_POWER_NUMA_PREPARE , CPUHP_HRTIMERS_PREPARE,
tip-bot for Sebastian Andrzej Siewior
merge bot[tip:smp/urgent] scsi/bnx2fc: Convert to hotplug state machine
In reply to Thomas Gleixnerscsi/bnx2fc: Convert to hotplug state machine
Commit-ID: c53b005dd64bdcf5acac00bd55ecf94dda22dc4f Gitweb: http://git.kernel.org/tip/c53b005dd64bdcf5acac00bd55ecf94dda22dc4f Author: Sebastian Andrzej Siewior <[email protected]> AuthorDate: Wed, 21 Dec 2016 20:19:50 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Sun, 25 Dec 2016 10:47:42 +0100
scsi/bnx2fc: Convert to hotplug state machine
Install the callbacks via the state machine. No functional change.
This is the minimal fixup so we can remove the hotplug notifier mess completely.
The real rework of this driver to use work queues is still stuck in review/testing on the SCSI mailing list.
--- drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 79 ++++++++++++++++----------------------- include/linux/cpuhotplug.h | 1 + 2 files changed, 34 insertions(+), 46 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +33 -46
@@ -127,13 +127,6 @@ module_param_named(log_fka, bnx2fc_log_fka, uint, S_IRUGO|S_IWUSR);MODULE_PARM_DESC (log_fka," Print message to kernel log when fcoe is " "initiating a FIP keep alive when debug logging is enabled." ); -static int bnx2fc_cpu_callback (struct notifier_block *nfb, -unsigned long action,void *hcpu); -/* notification function for CPU hotplug events */ -static struct notifier_block bnx2fc_cpu_notifier = { - .notifier_call = bnx2fc_cpu_callback, -}; -static inline struct net_device *bnx2fc_netdev (const struct fc_lport *lport) { return ((struct bnx2fc_interface *)
@@ -2622,37 +2615,19 @@ static void bnx2fc_percpu_thread_destroy(unsigned int cpu)kthread_stop (thread); } -/** -* bnx2fc_cpu_callback - Handler for CPU hotplug events -* -* @nfb: The callback data block -* @action: The event triggering the callback -* @hcpu: The index of the CPU that the event is for -* -* This creates or destroys per-CPU data for fcoe -* -* Returns NOTIFY_OK always. -*/ -static int bnx2fc_cpu_callback (struct notifier_block *nfb, -unsigned long action,void *hcpu) + +static int bnx2fc_cpu_online (unsigned int cpu) { -unsigned cpu = (unsigned long )hcpu; +printk (PFX "CPU %x online: Create Rx thread\n" , cpu); +bnx2fc_percpu_thread_create (cpu); +return 0 ; +} -switch (action) { -case CPU_ONLINE : -case CPU_ONLINE_FROZEN : -printk (PFX "CPU %x online: Create Rx thread\n" , cpu); -bnx2fc_percpu_thread_create (cpu); -break ; -case CPU_DEAD : -case CPU_DEAD_FROZEN : -printk (PFX "CPU %x offline: Remove Rx thread\n" , cpu); -bnx2fc_percpu_thread_destroy (cpu); -break ; -default : -break ; - } -return NOTIFY_OK ; +static int bnx2fc_cpu_dead (unsigned int cpu) +{ +printk (PFX "CPU %x offline: Remove Rx thread\n" , cpu); +bnx2fc_percpu_thread_destroy (cpu); +return 0 ; }static int bnx2fc_slave_configure (struct scsi_device *sdev)
@@ -2664,6 +2639,8 @@ static int bnx2fc_slave_configure(struct scsi_device *sdev)return 0 ; } +static enum cpuhp_state bnx2fc_online_state; +/** * bnx2fc_mod_init - module init entry point *
@@ -2724,21 +2701,31 @@ static int __init bnx2fc_mod_init(void)spin_lock_init (&p->fp_work_lock); } -cpu_notifier_register_begin (); +get_online_cpus (); -for_each_online_cpu (cpu) { +for_each_online_cpu (cpu)bnx2fc_percpu_thread_create (cpu); - } -/* Initialize per CPU interrupt thread */ -__register_hotcpu_notifier (&bnx2fc_cpu_notifier); + rc =cpuhp_setup_state_nocalls (CPUHP_AP_ONLINE_DYN , +"scsi/bnx2fc:online" , + bnx2fc_cpu_online,NULL ); +if (rc <0 ) + goto stop_threads; + bnx2fc_online_state = rc; -cpu_notifier_register_done (); +cpuhp_setup_state_nocalls (CPUHP_SCSI_BNX2FC_DEAD ,"scsi/bnx2fc:dead" , +NULL , bnx2fc_cpu_dead); +put_online_cpus ();cnic_register_driver (CNIC_ULP_FCOE , &bnx2fc_cnic_cb);return 0 ; +stop_threads: +for_each_online_cpu (cpu) +bnx2fc_percpu_thread_destroy (cpu); +put_online_cpus (); +kthread_stop (l2_thread); free_wq:destroy_workqueue (bnx2fc_wq); release_bt:
@@ -2797,16 +2784,16 @@ static void __exit bnx2fc_mod_exit(void)if (l2_thread)kthread_stop (l2_thread); -cpu_notifier_register_begin (); - +get_online_cpus ();/* Destroy per cpu threads */ for_each_online_cpu (cpu) {bnx2fc_percpu_thread_destroy (cpu); } -__unregister_hotcpu_notifier (&bnx2fc_cpu_notifier); +cpuhp_remove_state_nocalls (bnx2fc_online_state); +cpuhp_remove_state_nocalls (CPUHP_SCSI_BNX2FC_DEAD ); -cpu_notifier_register_done (); +put_online_cpus ();destroy_workqueue (bnx2fc_wq);/*
include/linux/cpuhotplug.h +1 -0
@@ -41,6 +41,7 @@ enum cpuhp_state {CPUHP_NET_DEV_DEAD ,CPUHP_PCI_XGENE_DEAD ,CPUHP_IOMMU_INTEL_DEAD , +CPUHP_SCSI_BNX2FC_DEAD ,CPUHP_WORKQUEUE_PREP ,CPUHP_POWER_NUMA_PREPARE , CPUHP_HRTIMERS_PREPARE,
PATCH 4/10 scsi/bnx2i: Convert to hotplug state machine
In reply to Thomas GleixnerFrom: Sebastian Andrzej Siewior <[email protected]>
Install the callbacks via the state machine. No functional change.
This is the minimal fixup so we can remove the hotplug notifier mess completely.
The real rework of this driver to use work queues is still stuck in review/testing on the SCSI mailing list.
--- drivers/scsi/bnx2i/bnx2i_init.c | 80 +++++++++++++++------------------------- include/linux/cpuhotplug.h | 1 2 files changed, 32 insertions(+), 49 deletions(-)
drivers/scsi/bnx2i/bnx2i_init.c +31 -49
@@ -70,14 +70,6 @@ u64 iscsi_error_mask = 0x00; DEFINE_PER_CPU(struct bnx2i_percpu_s, bnx2i_percpu); -static int bnx2i_cpu_callback (struct notifier_block *nfb, -unsigned long action,void *hcpu); -/* notification function for CPU hotplug events */ -static struct notifier_block bnx2i_cpu_notifier = { - .notifier_call = bnx2i_cpu_callback, -}; - -/** * bnx2i_identify_device - identifies NetXtreme II device type * @hba: Adapter structure pointer
@@ -461,41 +453,21 @@ static void bnx2i_percpu_thread_destroy(kthread_stop (thread); } - -/** -* bnx2i_cpu_callback - Handler for CPU hotplug events -* -* @nfb: The callback data block -* @action: The event triggering the callback -* @hcpu: The index of the CPU that the event is for -* -* This creates or destroys per-CPU data for iSCSI -* -* Returns NOTIFY_OK always. -*/ -static int bnx2i_cpu_callback (struct notifier_block *nfb, -unsigned long action,void *hcpu) +static int bnx2i_cpu_online (unsigned int cpu) { -unsigned cpu = (unsigned long )hcpu; +pr_info ("bnx2i: CPU %x online: Create Rx thread\n" , cpu); +bnx2i_percpu_thread_create (cpu); +return 0 ; +} -switch (action) { -case CPU_ONLINE : -case CPU_ONLINE_FROZEN : -printk (KERN_INFO "bnx2i: CPU %x online: Create Rx thread\n" , - cpu); -bnx2i_percpu_thread_create (cpu); -break ; -case CPU_DEAD : -case CPU_DEAD_FROZEN : -printk (KERN_INFO "CPU %x offline: Remove Rx thread\n" , cpu); -bnx2i_percpu_thread_destroy (cpu); -break ; -default : -break ; - } -return NOTIFY_OK ; +static int bnx2i_cpu_dead (unsigned int cpu) +{ +pr_info ("CPU %x offline: Remove Rx thread\n" , cpu); +bnx2i_percpu_thread_destroy (cpu); +return 0 ; } +static enum cpuhp_state bnx2i_online_state;/** * bnx2i_mod_init - module init entry point
@@ -539,18 +511,28 @@ static int __init bnx2i_mod_init(void) p->iothread =NULL ; } -cpu_notifier_register_begin (); +get_online_cpus ();for_each_online_cpu (cpu)bnx2i_percpu_thread_create (cpu); -/* Initialize per CPU interrupt thread */ -__register_hotcpu_notifier (&bnx2i_cpu_notifier); - -cpu_notifier_register_done (); - + err =cpuhp_setup_state_nocalls (CPUHP_AP_ONLINE_DYN , +"scsi/bnx2i:online" , + bnx2i_cpu_online,NULL ); +if (err <0 ) + goto remove_threads; + bnx2i_online_state = err; + +cpuhp_setup_state_nocalls (CPUHP_SCSI_BNX2I_DEAD ,"scsi/bnx2i:dead" , +NULL , bnx2i_cpu_dead); +put_online_cpus ();return 0 ; +remove_threads: +for_each_online_cpu (cpu) +bnx2i_percpu_thread_destroy (cpu); +put_online_cpus (); +cnic_unregister_driver (CNIC_ULP_ISCSI ); unreg_xport:iscsi_unregister_transport (&bnx2i_iscsi_transport); out:
@@ -587,14 +569,14 @@ static void __exit bnx2i_mod_exit(void) }mutex_unlock (&bnx2i_dev_lock); -cpu_notifier_register_begin (); +get_online_cpus ();for_each_online_cpu (cpu)bnx2i_percpu_thread_destroy (cpu); -__unregister_hotcpu_notifier (&bnx2i_cpu_notifier); - -cpu_notifier_register_done (); +cpuhp_remove_state_nocalls (bnx2i_online_state); +cpuhp_remove_state_nocalls (CPUHP_SCSI_BNX2I_DEAD ); +put_online_cpus ();iscsi_unregister_transport (&bnx2i_iscsi_transport);cnic_unregister_driver (CNIC_ULP_ISCSI );
include/linux/cpuhotplug.h +1 -0
@@ -42,6 +42,7 @@ enum cpuhp_state {CPUHP_PCI_XGENE_DEAD ,CPUHP_IOMMU_INTEL_DEAD ,CPUHP_SCSI_BNX2FC_DEAD , +CPUHP_SCSI_BNX2I_DEAD ,CPUHP_WORKQUEUE_PREP ,CPUHP_POWER_NUMA_PREPARE , CPUHP_HRTIMERS_PREPARE,
tip-bot for Sebastian Andrzej Siewior
merge bot[tip:smp/urgent] scsi/bnx2i: Convert to hotplug state machine
scsi/bnx2i: Convert to hotplug state machine
Commit-ID: ea1c68c71a84aafdcbd7f3a8a14a198a3879c0bf Gitweb: http://git.kernel.org/tip/ea1c68c71a84aafdcbd7f3a8a14a198a3879c0bf Author: Sebastian Andrzej Siewior <[email protected]> AuthorDate: Wed, 21 Dec 2016 20:19:51 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Thu, 22 Dec 2016 11:37:54 +0100
scsi/bnx2i: Convert to hotplug state machine
Install the callbacks via the state machine. No functional change.
This is the minimal fixup so we can remove the hotplug notifier mess completely.
The real rework of this driver to use work queues is still stuck in review/testing on the SCSI mailing list.
--- drivers/scsi/bnx2i/bnx2i_init.c | 78 ++++++++++++++++------------------------- include/linux/cpuhotplug.h | 1 + 2 files changed, 31 insertions(+), 48 deletions(-)
drivers/scsi/bnx2i/bnx2i_init.c +30 -48
@@ -70,14 +70,6 @@ u64 iscsi_error_mask = 0x00; DEFINE_PER_CPU(struct bnx2i_percpu_s, bnx2i_percpu); -static int bnx2i_cpu_callback (struct notifier_block *nfb, -unsigned long action,void *hcpu); -/* notification function for CPU hotplug events */ -static struct notifier_block bnx2i_cpu_notifier = { - .notifier_call = bnx2i_cpu_callback, -}; - -/** * bnx2i_identify_device - identifies NetXtreme II device type * @hba: Adapter structure pointer
@@ -461,41 +453,21 @@ static void bnx2i_percpu_thread_destroy(unsigned int cpu)kthread_stop (thread); } - -/** -* bnx2i_cpu_callback - Handler for CPU hotplug events -* -* @nfb: The callback data block -* @action: The event triggering the callback -* @hcpu: The index of the CPU that the event is for -* -* This creates or destroys per-CPU data for iSCSI -* -* Returns NOTIFY_OK always. -*/ -static int bnx2i_cpu_callback (struct notifier_block *nfb, -unsigned long action,void *hcpu) +static int bnx2i_cpu_online (unsigned int cpu) { -unsigned cpu = (unsigned long )hcpu; +pr_info ("bnx2i: CPU %x online: Create Rx thread\n" , cpu); +bnx2i_percpu_thread_create (cpu); +return 0 ; +} -switch (action) { -case CPU_ONLINE : -case CPU_ONLINE_FROZEN : -printk (KERN_INFO "bnx2i: CPU %x online: Create Rx thread\n" , - cpu); -bnx2i_percpu_thread_create (cpu); -break ; -case CPU_DEAD : -case CPU_DEAD_FROZEN : -printk (KERN_INFO "CPU %x offline: Remove Rx thread\n" , cpu); -bnx2i_percpu_thread_destroy (cpu); -break ; -default : -break ; - } -return NOTIFY_OK ; +static int bnx2i_cpu_dead (unsigned int cpu) +{ +pr_info ("CPU %x offline: Remove Rx thread\n" , cpu); +bnx2i_percpu_thread_destroy (cpu); +return 0 ; } +static enum cpuhp_state bnx2i_online_state;/** * bnx2i_mod_init - module init entry point
@@ -539,18 +511,28 @@ static int __init bnx2i_mod_init(void) p->iothread =NULL ; } -cpu_notifier_register_begin (); +get_online_cpus ();for_each_online_cpu (cpu)bnx2i_percpu_thread_create (cpu); -/* Initialize per CPU interrupt thread */ -__register_hotcpu_notifier (&bnx2i_cpu_notifier); - -cpu_notifier_register_done (); + err =cpuhp_setup_state_nocalls (CPUHP_AP_ONLINE_DYN , +"scsi/bnx2i:online" , + bnx2i_cpu_online,NULL ); +if (err <0 ) + goto remove_threads; + bnx2i_online_state = err; +cpuhp_setup_state_nocalls (CPUHP_SCSI_BNX2I_DEAD ,"scsi/bnx2i:dead" , +NULL , bnx2i_cpu_dead); +put_online_cpus ();return 0 ; +remove_threads: +for_each_online_cpu (cpu) +bnx2i_percpu_thread_destroy (cpu); +put_online_cpus (); +cnic_unregister_driver (CNIC_ULP_ISCSI ); unreg_xport:iscsi_unregister_transport (&bnx2i_iscsi_transport); out:
@@ -587,14 +569,14 @@ static void __exit bnx2i_mod_exit(void) }mutex_unlock (&bnx2i_dev_lock); -cpu_notifier_register_begin (); +get_online_cpus ();for_each_online_cpu (cpu)bnx2i_percpu_thread_destroy (cpu); -__unregister_hotcpu_notifier (&bnx2i_cpu_notifier); - -cpu_notifier_register_done (); +cpuhp_remove_state_nocalls (bnx2i_online_state); +cpuhp_remove_state_nocalls (CPUHP_SCSI_BNX2I_DEAD ); +put_online_cpus ();iscsi_unregister_transport (&bnx2i_iscsi_transport);cnic_unregister_driver (CNIC_ULP_ISCSI );
include/linux/cpuhotplug.h +1 -0
@@ -42,6 +42,7 @@ enum cpuhp_state {CPUHP_PCI_XGENE_DEAD ,CPUHP_IOMMU_INTEL_DEAD ,CPUHP_SCSI_BNX2FC_DEAD , +CPUHP_SCSI_BNX2I_DEAD ,CPUHP_WORKQUEUE_PREP ,CPUHP_POWER_NUMA_PREPARE , CPUHP_HRTIMERS_PREPARE,
tip-bot for Sebastian Andrzej Siewior
merge bot[tip:smp/urgent] scsi/bnx2i: Convert to hotplug state machine
In reply to Thomas Gleixnerscsi/bnx2i: Convert to hotplug state machine
Commit-ID: e210faa2359f92eb2e417cd8462eb980a4dbb172 Gitweb: http://git.kernel.org/tip/e210faa2359f92eb2e417cd8462eb980a4dbb172 Author: Sebastian Andrzej Siewior <[email protected]> AuthorDate: Wed, 21 Dec 2016 20:19:51 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Sun, 25 Dec 2016 10:47:43 +0100
scsi/bnx2i: Convert to hotplug state machine
Install the callbacks via the state machine. No functional change.
This is the minimal fixup so we can remove the hotplug notifier mess completely.
The real rework of this driver to use work queues is still stuck in review/testing on the SCSI mailing list.
--- drivers/scsi/bnx2i/bnx2i_init.c | 78 ++++++++++++++++------------------------- include/linux/cpuhotplug.h | 1 + 2 files changed, 31 insertions(+), 48 deletions(-)
drivers/scsi/bnx2i/bnx2i_init.c +30 -48
@@ -70,14 +70,6 @@ u64 iscsi_error_mask = 0x00; DEFINE_PER_CPU(struct bnx2i_percpu_s, bnx2i_percpu); -static int bnx2i_cpu_callback (struct notifier_block *nfb, -unsigned long action,void *hcpu); -/* notification function for CPU hotplug events */ -static struct notifier_block bnx2i_cpu_notifier = { - .notifier_call = bnx2i_cpu_callback, -}; - -/** * bnx2i_identify_device - identifies NetXtreme II device type * @hba: Adapter structure pointer
@@ -461,41 +453,21 @@ static void bnx2i_percpu_thread_destroy(unsigned int cpu)kthread_stop (thread); } - -/** -* bnx2i_cpu_callback - Handler for CPU hotplug events -* -* @nfb: The callback data block -* @action: The event triggering the callback -* @hcpu: The index of the CPU that the event is for -* -* This creates or destroys per-CPU data for iSCSI -* -* Returns NOTIFY_OK always. -*/ -static int bnx2i_cpu_callback (struct notifier_block *nfb, -unsigned long action,void *hcpu) +static int bnx2i_cpu_online (unsigned int cpu) { -unsigned cpu = (unsigned long )hcpu; +pr_info ("bnx2i: CPU %x online: Create Rx thread\n" , cpu); +bnx2i_percpu_thread_create (cpu); +return 0 ; +} -switch (action) { -case CPU_ONLINE : -case CPU_ONLINE_FROZEN : -printk (KERN_INFO "bnx2i: CPU %x online: Create Rx thread\n" , - cpu); -bnx2i_percpu_thread_create (cpu); -break ; -case CPU_DEAD : -case CPU_DEAD_FROZEN : -printk (KERN_INFO "CPU %x offline: Remove Rx thread\n" , cpu); -bnx2i_percpu_thread_destroy (cpu); -break ; -default : -break ; - } -return NOTIFY_OK ; +static int bnx2i_cpu_dead (unsigned int cpu) +{ +pr_info ("CPU %x offline: Remove Rx thread\n" , cpu); +bnx2i_percpu_thread_destroy (cpu); +return 0 ; } +static enum cpuhp_state bnx2i_online_state;/** * bnx2i_mod_init - module init entry point
@@ -539,18 +511,28 @@ static int __init bnx2i_mod_init(void) p->iothread =NULL ; } -cpu_notifier_register_begin (); +get_online_cpus ();for_each_online_cpu (cpu)bnx2i_percpu_thread_create (cpu); -/* Initialize per CPU interrupt thread */ -__register_hotcpu_notifier (&bnx2i_cpu_notifier); - -cpu_notifier_register_done (); + err =cpuhp_setup_state_nocalls (CPUHP_AP_ONLINE_DYN , +"scsi/bnx2i:online" , + bnx2i_cpu_online,NULL ); +if (err <0 ) + goto remove_threads; + bnx2i_online_state = err; +cpuhp_setup_state_nocalls (CPUHP_SCSI_BNX2I_DEAD ,"scsi/bnx2i:dead" , +NULL , bnx2i_cpu_dead); +put_online_cpus ();return 0 ; +remove_threads: +for_each_online_cpu (cpu) +bnx2i_percpu_thread_destroy (cpu); +put_online_cpus (); +cnic_unregister_driver (CNIC_ULP_ISCSI ); unreg_xport:iscsi_unregister_transport (&bnx2i_iscsi_transport); out:
@@ -587,14 +569,14 @@ static void __exit bnx2i_mod_exit(void) }mutex_unlock (&bnx2i_dev_lock); -cpu_notifier_register_begin (); +get_online_cpus ();for_each_online_cpu (cpu)bnx2i_percpu_thread_destroy (cpu); -__unregister_hotcpu_notifier (&bnx2i_cpu_notifier); - -cpu_notifier_register_done (); +cpuhp_remove_state_nocalls (bnx2i_online_state); +cpuhp_remove_state_nocalls (CPUHP_SCSI_BNX2I_DEAD ); +put_online_cpus ();iscsi_unregister_transport (&bnx2i_iscsi_transport);cnic_unregister_driver (CNIC_ULP_ISCSI );
include/linux/cpuhotplug.h +1 -0
@@ -42,6 +42,7 @@ enum cpuhp_state {CPUHP_PCI_XGENE_DEAD ,CPUHP_IOMMU_INTEL_DEAD ,CPUHP_SCSI_BNX2FC_DEAD , +CPUHP_SCSI_BNX2I_DEAD ,CPUHP_WORKQUEUE_PREP ,CPUHP_POWER_NUMA_PREPARE , CPUHP_HRTIMERS_PREPARE,
PATCH 5/10 staging/lustre/libcfs: Convert to hotplug state machine
In reply to Thomas GleixnerFrom: Anna-Maria Gleixner <[email protected]>
Install the callbacks via the state machine. No functional change.
---
drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c | 85 ++++++++++--------- include/linux/cpuhotplug.h | 1 2 files changed, 46 insertions(+), 40 deletions(-)
drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c +45 -40
@@ -967,48 +967,38 @@ cfs_cpt_table_create_pattern(char *patte }#ifdef CONFIG_HOTPLUG_CPU -static int -cfs_cpu_notify (struct notifier_block *self,unsigned long action,void *hcpu) -{ -unsigned int cpu = (unsigned long )hcpu; -bool warn; - -switch (action) { -case CPU_DEAD : -case CPU_DEAD_FROZEN : -case CPU_ONLINE : -case CPU_ONLINE_FROZEN : -spin_lock (&cpt_data.cpt_lock); - cpt_data.cpt_version++; -spin_unlock (&cpt_data.cpt_lock); -/* Fall through */ -default : -if (action !=CPU_DEAD && action !=CPU_DEAD_FROZEN ) { -CDEBUG (D_INFO ,"CPU changed [cpu %u action %lx]\n" , - cpu, action); -break ; - } +static enum cpuhp_state lustre_cpu_online; -mutex_lock (&cpt_data.cpt_mutex); -/* if all HTs in a core are offline, it may break affinity */ -cpumask_copy (cpt_data.cpt_cpumask, -topology_sibling_cpumask (cpu)); - warn =cpumask_any_and (cpt_data.cpt_cpumask, - cpu_online_mask) >= nr_cpu_ids; -mutex_unlock (&cpt_data.cpt_mutex); -CDEBUG (warn ?D_WARNING :D_INFO , -"Lustre: can't support CPU plug-out well now, performance and stability could be impacted [CPU %u action: %lx]\n" , - cpu, action); - } +static void cfs_cpu_incr_cpt_version (void ) +{ +spin_lock (&cpt_data.cpt_lock); + cpt_data.cpt_version++; +spin_unlock (&cpt_data.cpt_lock); +} -return NOTIFY_OK ; +static int cfs_cpu_online (unsigned int cpu) +{ +cfs_cpu_incr_cpt_version (); +return 0 ; } -static struct notifier_block cfs_cpu_notifier = { - .notifier_call = cfs_cpu_notify, - .priority =0 -}; +static int cfs_cpu_dead (unsigned int cpu) +{ +bool warn; + +cfs_cpu_incr_cpt_version (); +mutex_lock (&cpt_data.cpt_mutex); +/* if all HTs in a core are offline, it may break affinity */ +cpumask_copy (cpt_data.cpt_cpumask,topology_sibling_cpumask (cpu)); + warn =cpumask_any_and (cpt_data.cpt_cpumask, + cpu_online_mask) >= nr_cpu_ids; +mutex_unlock (&cpt_data.cpt_mutex); +CDEBUG (warn ?D_WARNING :D_INFO , +"Lustre: can't support CPU plug-out well now, performance and stability could be impacted [CPU %u]\n" , + cpu); +return 0 ; +}#endif void
@@ -1018,7 +1008,9 @@ cfs_cpu_fini(void)cfs_cpt_table_free (cfs_cpt_table);#ifdef CONFIG_HOTPLUG_CPU -unregister_hotcpu_notifier (&cfs_cpu_notifier); +if (lustre_cpu_online >0 ) +cpuhp_remove_state_nocalls (lustre_cpu_online); +cpuhp_remove_state_nocalls (CPUHP_LUSTRE_CFS_DEAD );#endif if (cpt_data.cpt_cpumask)LIBCFS_FREE (cpt_data.cpt_cpumask,cpumask_size ());
@@ -1027,6 +1019,8 @@ cfs_cpu_fini(void)int cfs_cpu_init (void ) { +int ret =0 ; +LASSERT (!cfs_cpt_table);memset (&cpt_data,0 ,sizeof (cpt_data));
@@ -1041,8 +1035,19 @@ cfs_cpu_init(void)mutex_init (&cpt_data.cpt_mutex);#ifdef CONFIG_HOTPLUG_CPU -register_hotcpu_notifier (&cfs_cpu_notifier); + ret =cpuhp_setup_state_nocalls (CPUHP_LUSTRE_CFS_DEAD , +"staging/lustre/cfe:dead" ,NULL , + cfs_cpu_dead); +if (ret <0 ) + goto failed; + ret =cpuhp_setup_state_nocalls (CPUHP_AP_ONLINE_DYN , +"staging/lustre/cfe:online" , + cfs_cpu_online,NULL ); +if (ret <0 ) + goto failed; + lustre_cpu_online = ret;#endif + ret = -EINVAL ;if (*cpu_pattern) { cfs_cpt_table =cfs_cpt_table_create_pattern (cpu_pattern);
@@ -1075,7 +1080,7 @@ cfs_cpu_init(void) failed:cfs_cpu_fini (); - return -1; + return ret; }#endif
include/linux/cpuhotplug.h +1 -0
@@ -41,6 +41,7 @@ enum cpuhp_state {CPUHP_NET_DEV_DEAD ,CPUHP_PCI_XGENE_DEAD ,CPUHP_IOMMU_INTEL_DEAD , +CPUHP_LUSTRE_CFS_DEAD ,CPUHP_SCSI_BNX2FC_DEAD ,CPUHP_SCSI_BNX2I_DEAD , CPUHP_WORKQUEUE_PREP,
tip-bot for Anna-Maria Gleixner
merge bot[tip:smp/urgent] staging/lustre/libcfs: Convert to hotplug state machine
staging/lustre/libcfs: Convert to hotplug state machine
Commit-ID: b44c6c54a04a6d956c561a6ce4d64f4070405823 Gitweb: http://git.kernel.org/tip/b44c6c54a04a6d956c561a6ce4d64f4070405823 Author: Anna-Maria Gleixner <[email protected]> AuthorDate: Wed, 21 Dec 2016 20:19:52 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Thu, 22 Dec 2016 11:37:55 +0100
staging/lustre/libcfs: Convert to hotplug state machine
Install the callbacks via the state machine. No functional change.
--- .../staging/lustre/lnet/libcfs/linux/linux-cpu.c | 85 ++++++++++++---------- include/linux/cpuhotplug.h | 1 + 2 files changed, 46 insertions(+), 40 deletions(-)
drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c +45 -40
@@ -967,48 +967,38 @@ cfs_cpt_table_create_pattern(char *pattern) }#ifdef CONFIG_HOTPLUG_CPU -static int -cfs_cpu_notify (struct notifier_block *self,unsigned long action,void *hcpu) -{ -unsigned int cpu = (unsigned long )hcpu; -bool warn; - -switch (action) { -case CPU_DEAD : -case CPU_DEAD_FROZEN : -case CPU_ONLINE : -case CPU_ONLINE_FROZEN : -spin_lock (&cpt_data.cpt_lock); - cpt_data.cpt_version++; -spin_unlock (&cpt_data.cpt_lock); -/* Fall through */ -default : -if (action !=CPU_DEAD && action !=CPU_DEAD_FROZEN ) { -CDEBUG (D_INFO ,"CPU changed [cpu %u action %lx]\n" , - cpu, action); -break ; - } +static enum cpuhp_state lustre_cpu_online; -mutex_lock (&cpt_data.cpt_mutex); -/* if all HTs in a core are offline, it may break affinity */ -cpumask_copy (cpt_data.cpt_cpumask, -topology_sibling_cpumask (cpu)); - warn =cpumask_any_and (cpt_data.cpt_cpumask, - cpu_online_mask) >= nr_cpu_ids; -mutex_unlock (&cpt_data.cpt_mutex); -CDEBUG (warn ?D_WARNING :D_INFO , -"Lustre: can't support CPU plug-out well now, performance and stability could be impacted [CPU %u action: %lx]\n" , - cpu, action); - } +static void cfs_cpu_incr_cpt_version (void ) +{ +spin_lock (&cpt_data.cpt_lock); + cpt_data.cpt_version++; +spin_unlock (&cpt_data.cpt_lock); +} -return NOTIFY_OK ; +static int cfs_cpu_online (unsigned int cpu) +{ +cfs_cpu_incr_cpt_version (); +return 0 ; } -static struct notifier_block cfs_cpu_notifier = { - .notifier_call = cfs_cpu_notify, - .priority =0 -}; +static int cfs_cpu_dead (unsigned int cpu) +{ +bool warn; + +cfs_cpu_incr_cpt_version (); +mutex_lock (&cpt_data.cpt_mutex); +/* if all HTs in a core are offline, it may break affinity */ +cpumask_copy (cpt_data.cpt_cpumask,topology_sibling_cpumask (cpu)); + warn =cpumask_any_and (cpt_data.cpt_cpumask, + cpu_online_mask) >= nr_cpu_ids; +mutex_unlock (&cpt_data.cpt_mutex); +CDEBUG (warn ?D_WARNING :D_INFO , +"Lustre: can't support CPU plug-out well now, performance and stability could be impacted [CPU %u]\n" , + cpu); +return 0 ; +}#endif void
@@ -1018,7 +1008,9 @@ cfs_cpu_fini(void)cfs_cpt_table_free (cfs_cpt_table);#ifdef CONFIG_HOTPLUG_CPU -unregister_hotcpu_notifier (&cfs_cpu_notifier); +if (lustre_cpu_online >0 ) +cpuhp_remove_state_nocalls (lustre_cpu_online); +cpuhp_remove_state_nocalls (CPUHP_LUSTRE_CFS_DEAD );#endif if (cpt_data.cpt_cpumask)LIBCFS_FREE (cpt_data.cpt_cpumask,cpumask_size ());
@@ -1027,6 +1019,8 @@ cfs_cpu_fini(void)int cfs_cpu_init (void ) { +int ret =0 ; +LASSERT (!cfs_cpt_table);memset (&cpt_data,0 ,sizeof (cpt_data));
@@ -1041,8 +1035,19 @@ cfs_cpu_init(void)mutex_init (&cpt_data.cpt_mutex);#ifdef CONFIG_HOTPLUG_CPU -register_hotcpu_notifier (&cfs_cpu_notifier); + ret =cpuhp_setup_state_nocalls (CPUHP_LUSTRE_CFS_DEAD , +"staging/lustre/cfe:dead" ,NULL , + cfs_cpu_dead); +if (ret <0 ) + goto failed; + ret =cpuhp_setup_state_nocalls (CPUHP_AP_ONLINE_DYN , +"staging/lustre/cfe:online" , + cfs_cpu_online,NULL ); +if (ret <0 ) + goto failed; + lustre_cpu_online = ret;#endif + ret = -EINVAL ;if (*cpu_pattern) { cfs_cpt_table =cfs_cpt_table_create_pattern (cpu_pattern);
@@ -1075,7 +1080,7 @@ cfs_cpu_init(void) failed:cfs_cpu_fini (); - return -1; + return ret; }#endif
include/linux/cpuhotplug.h +1 -0
@@ -41,6 +41,7 @@ enum cpuhp_state {CPUHP_NET_DEV_DEAD ,CPUHP_PCI_XGENE_DEAD ,CPUHP_IOMMU_INTEL_DEAD , +CPUHP_LUSTRE_CFS_DEAD ,CPUHP_SCSI_BNX2FC_DEAD ,CPUHP_SCSI_BNX2I_DEAD , CPUHP_WORKQUEUE_PREP,
tip-bot for Anna-Maria Gleixner
merge bot[tip:smp/urgent] staging/lustre/libcfs: Convert to hotplug state machine
In reply to Thomas Gleixnerstaging/lustre/libcfs: Convert to hotplug state machine
Commit-ID: 7b737965b33188bd3dbb44e938535c4006d97fbb Gitweb: http://git.kernel.org/tip/7b737965b33188bd3dbb44e938535c4006d97fbb Author: Anna-Maria Gleixner <[email protected]> AuthorDate: Wed, 21 Dec 2016 20:19:52 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Sun, 25 Dec 2016 10:47:43 +0100
staging/lustre/libcfs: Convert to hotplug state machine
Install the callbacks via the state machine. No functional change.
--- .../staging/lustre/lnet/libcfs/linux/linux-cpu.c | 85 ++++++++++++---------- include/linux/cpuhotplug.h | 1 + 2 files changed, 46 insertions(+), 40 deletions(-)
drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c +45 -40
@@ -967,48 +967,38 @@ cfs_cpt_table_create_pattern(char *pattern) }#ifdef CONFIG_HOTPLUG_CPU -static int -cfs_cpu_notify (struct notifier_block *self,unsigned long action,void *hcpu) -{ -unsigned int cpu = (unsigned long )hcpu; -bool warn; - -switch (action) { -case CPU_DEAD : -case CPU_DEAD_FROZEN : -case CPU_ONLINE : -case CPU_ONLINE_FROZEN : -spin_lock (&cpt_data.cpt_lock); - cpt_data.cpt_version++; -spin_unlock (&cpt_data.cpt_lock); -/* Fall through */ -default : -if (action !=CPU_DEAD && action !=CPU_DEAD_FROZEN ) { -CDEBUG (D_INFO ,"CPU changed [cpu %u action %lx]\n" , - cpu, action); -break ; - } +static enum cpuhp_state lustre_cpu_online; -mutex_lock (&cpt_data.cpt_mutex); -/* if all HTs in a core are offline, it may break affinity */ -cpumask_copy (cpt_data.cpt_cpumask, -topology_sibling_cpumask (cpu)); - warn =cpumask_any_and (cpt_data.cpt_cpumask, - cpu_online_mask) >= nr_cpu_ids; -mutex_unlock (&cpt_data.cpt_mutex); -CDEBUG (warn ?D_WARNING :D_INFO , -"Lustre: can't support CPU plug-out well now, performance and stability could be impacted [CPU %u action: %lx]\n" , - cpu, action); - } +static void cfs_cpu_incr_cpt_version (void ) +{ +spin_lock (&cpt_data.cpt_lock); + cpt_data.cpt_version++; +spin_unlock (&cpt_data.cpt_lock); +} -return NOTIFY_OK ; +static int cfs_cpu_online (unsigned int cpu) +{ +cfs_cpu_incr_cpt_version (); +return 0 ; } -static struct notifier_block cfs_cpu_notifier = { - .notifier_call = cfs_cpu_notify, - .priority =0 -}; +static int cfs_cpu_dead (unsigned int cpu) +{ +bool warn; + +cfs_cpu_incr_cpt_version (); +mutex_lock (&cpt_data.cpt_mutex); +/* if all HTs in a core are offline, it may break affinity */ +cpumask_copy (cpt_data.cpt_cpumask,topology_sibling_cpumask (cpu)); + warn =cpumask_any_and (cpt_data.cpt_cpumask, + cpu_online_mask) >= nr_cpu_ids; +mutex_unlock (&cpt_data.cpt_mutex); +CDEBUG (warn ?D_WARNING :D_INFO , +"Lustre: can't support CPU plug-out well now, performance and stability could be impacted [CPU %u]\n" , + cpu); +return 0 ; +}#endif void
@@ -1018,7 +1008,9 @@ cfs_cpu_fini(void)cfs_cpt_table_free (cfs_cpt_table);#ifdef CONFIG_HOTPLUG_CPU -unregister_hotcpu_notifier (&cfs_cpu_notifier); +if (lustre_cpu_online >0 ) +cpuhp_remove_state_nocalls (lustre_cpu_online); +cpuhp_remove_state_nocalls (CPUHP_LUSTRE_CFS_DEAD );#endif if (cpt_data.cpt_cpumask)LIBCFS_FREE (cpt_data.cpt_cpumask,cpumask_size ());
@@ -1027,6 +1019,8 @@ cfs_cpu_fini(void)int cfs_cpu_init (void ) { +int ret =0 ; +LASSERT (!cfs_cpt_table);memset (&cpt_data,0 ,sizeof (cpt_data));
@@ -1041,8 +1035,19 @@ cfs_cpu_init(void)mutex_init (&cpt_data.cpt_mutex);#ifdef CONFIG_HOTPLUG_CPU -register_hotcpu_notifier (&cfs_cpu_notifier); + ret =cpuhp_setup_state_nocalls (CPUHP_LUSTRE_CFS_DEAD , +"staging/lustre/cfe:dead" ,NULL , + cfs_cpu_dead); +if (ret <0 ) + goto failed; + ret =cpuhp_setup_state_nocalls (CPUHP_AP_ONLINE_DYN , +"staging/lustre/cfe:online" , + cfs_cpu_online,NULL ); +if (ret <0 ) + goto failed; + lustre_cpu_online = ret;#endif + ret = -EINVAL ;if (*cpu_pattern) { cfs_cpt_table =cfs_cpt_table_create_pattern (cpu_pattern);
@@ -1075,7 +1080,7 @@ cfs_cpu_init(void) failed:cfs_cpu_fini (); - return -1; + return ret; }#endif
include/linux/cpuhotplug.h +1 -0
@@ -41,6 +41,7 @@ enum cpuhp_state {CPUHP_NET_DEV_DEAD ,CPUHP_PCI_XGENE_DEAD ,CPUHP_IOMMU_INTEL_DEAD , +CPUHP_LUSTRE_CFS_DEAD ,CPUHP_SCSI_BNX2FC_DEAD ,CPUHP_SCSI_BNX2I_DEAD , CPUHP_WORKQUEUE_PREP,
PATCH 6/10 cpu/hotplug: Remove obsolete cpu hotplug register/unregister functions
In reply to Thomas Gleixnerhotcpu_notifier(), cpu_notifier(), __hotcpu_notifier(), __cpu_notifier(), register_hotcpu_notifier(), register_cpu_notifier(), __register_hotcpu_notifier(), __register_cpu_notifier(), unregister_hotcpu_notifier(), unregister_cpu_notifier(), __unregister_hotcpu_notifier(), __unregister_cpu_notifier()
are unused now. Remove them and all related code.
Remove also the now pointless cpu notifier error injection mechanism. The states can be executed step by step and error rollback is the same as cpu down, so any state transition can be tested w/o requiring the notifier error injection.
Some CPU hotplug states are kept as they are (ab)used for hotplug state tracking.
--- include/linux/cpu.h | 90 ------------------------- include/linux/cpuhotplug.h | 3 kernel/cpu.c | 139 ---------------------------------------- lib/Kconfig.debug | 24 ------ lib/Makefile | 1 lib/cpu-notifier-error-inject.c | 84 ------------------------ 6 files changed, 1 insertion(+), 340 deletions(-)
include/linux/cpu.h +0 -90
@@ -57,9 +57,6 @@ struct notifier_block;#define CPU_ONLINE 0x0002/* CPU (unsigned)v is up */ #define CPU_UP_PREPARE 0x0003/* CPU (unsigned)v coming up */ -#define CPU_UP_CANCELED 0x0004/* CPU (unsigned)v NOT coming up */ -#define CPU_DOWN_PREPARE 0x0005/* CPU (unsigned)v going down */ -#define CPU_DOWN_FAILED 0x0006/* CPU (unsigned)v NOT going down */ #define CPU_DEAD 0x0007/* CPU (unsigned)v dead */ #define CPU_POST_DEAD 0x0009/* CPU (unsigned)v dead, cpu_hotplug * lock is dropped */
@@ -80,80 +77,14 @@ struct notifier_block;#ifdef CONFIG_SMP extern bool cpuhp_tasks_frozen; -/* Need to know about CPUs going up/down? */ -#if defined(CONFIG_HOTPLUG_CPU ) || !defined(MODULE ) -#define cpu_notifier (fn, pri) { \ - static struct notifier_block fn##_nb = \ - { .notifier_call = fn, .priority = pri }; \ - register_cpu_notifier(&fn##_nb); \ -} - -#define __cpu_notifier (fn, pri) { \ - static struct notifier_block fn##_nb = \ - { .notifier_call = fn, .priority = pri }; \ - __register_cpu_notifier(&fn##_nb); \ -} - -extern int register_cpu_notifier (struct notifier_block *nb); -extern int __register_cpu_notifier (struct notifier_block *nb); -extern void unregister_cpu_notifier (struct notifier_block *nb); -extern void __unregister_cpu_notifier (struct notifier_block *nb); - -#else /* #if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) */ -#define cpu_notifier (fn, pri) do { (void)(fn); } while (0) -#define __cpu_notifier (fn, pri) do { (void)(fn); } while (0) - -static inline int register_cpu_notifier (struct notifier_block *nb) -{ -return 0 ; -} - -static inline int __register_cpu_notifier (struct notifier_block *nb) -{ -return 0 ; -} - -static inline void unregister_cpu_notifier (struct notifier_block *nb) -{ -} - -static inline void __unregister_cpu_notifier (struct notifier_block *nb) -{ -} -#endif -int cpu_up (unsigned int cpu);void notify_cpu_starting (unsigned int cpu);extern void cpu_maps_update_begin (void );extern void cpu_maps_update_done (void ); -#define cpu_notifier_register_begin cpu_maps_update_begin -#define cpu_notifier_register_done cpu_maps_update_done -#else /* CONFIG_SMP */ #define cpuhp_tasks_frozen 0 -#define cpu_notifier (fn, pri) do { (void)(fn); } while (0) -#define __cpu_notifier (fn, pri) do { (void)(fn); } while (0) - -static inline int register_cpu_notifier (struct notifier_block *nb) -{ -return 0 ; -} - -static inline int __register_cpu_notifier (struct notifier_block *nb) -{ -return 0 ; -} - -static inline void unregister_cpu_notifier (struct notifier_block *nb) -{ -} - -static inline void __unregister_cpu_notifier (struct notifier_block *nb) -{ -} -static inline void cpu_maps_update_begin (void ) { }
@@ -162,14 +93,6 @@ static inline void cpu_maps_update_done( { } -static inline void cpu_notifier_register_begin (void ) -{ -} - -static inline void cpu_notifier_register_done (void ) -{ -} -#endif /* CONFIG_SMP */ extern struct bus_type cpu_subsys;
@@ -182,12 +105,6 @@ extern void get_online_cpus(void);extern void put_online_cpus (void );extern void cpu_hotplug_disable (void );extern void cpu_hotplug_enable (void ); -#define hotcpu_notifier (fn, pri) cpu_notifier(fn, pri) -#define __hotcpu_notifier (fn, pri) __cpu_notifier(fn, pri) -#define register_hotcpu_notifier (nb) register_cpu_notifier(nb) -#define __register_hotcpu_notifier (nb) __register_cpu_notifier(nb) -#define unregister_hotcpu_notifier (nb) unregister_cpu_notifier(nb) -#define __unregister_hotcpu_notifier (nb) __unregister_cpu_notifier(nb)void clear_tasks_mm_cpumask (int cpu);int cpu_down (unsigned int cpu);
@@ -199,13 +116,6 @@ static inline void cpu_hotplug_done(void#define put_online_cpus () do { } while (0)#define cpu_hotplug_disable () do { } while (0)#define cpu_hotplug_enable () do { } while (0) -#define hotcpu_notifier (fn, pri) do { (void)(fn); } while (0) -#define __hotcpu_notifier (fn, pri) do { (void)(fn); } while (0) -/* These aren't inline functions due to a GCC bug. */ -#define register_hotcpu_notifier (nb) ({ (void)(nb); 0; }) -#define __register_hotcpu_notifier (nb) ({ (void)(nb); 0; }) -#define unregister_hotcpu_notifier (nb) ({ (void)(nb); }) -#define __unregister_hotcpu_notifier (nb) ({ (void)(nb); })#endif /* CONFIG_HOTPLUG_CPU */ #ifdef CONFIG_PM_SLEEP_SMP
include/linux/cpuhotplug.h +0 -3
@@ -59,7 +59,6 @@ enum cpuhp_state {CPUHP_POWERPC_MMU_CTX_PREPARE ,CPUHP_XEN_PREPARE ,CPUHP_XEN_EVTCHN_PREPARE , -CPUHP_NOTIFY_PREPARE ,CPUHP_ARM_SHMOBILE_SCU_PREPARE ,CPUHP_SH_SH3X_PREPARE , CPUHP_BLK_MQ_PREPARE,
@@ -74,7 +73,6 @@ enum cpuhp_state {CPUHP_KVM_PPC_BOOK3S_PREPARE ,CPUHP_ZCOMP_PREPARE ,CPUHP_TIMERS_DEAD , -CPUHP_NOTF_ERR_INJ_PREPARE ,CPUHP_MIPS_SOC_PREPARE ,CPUHP_BRINGUP_CPU , CPUHP_AP_IDLE_DEAD,
@@ -145,7 +143,6 @@ enum cpuhp_state {CPUHP_AP_PERF_ARM_L2X0_ONLINE ,CPUHP_AP_WORKQUEUE_ONLINE ,CPUHP_AP_RCUTREE_ONLINE , -CPUHP_AP_NOTIFY_ONLINE ,CPUHP_AP_ONLINE_DYN ,CPUHP_AP_ONLINE_DYN_END =CPUHP_AP_ONLINE_DYN +30 , CPUHP_AP_X86_HPET_ONLINE,
kernel/cpu.c +1 -138
218 lines not on this page · raw message
lib/Kconfig.debug +0 -24
@@ -1538,30 +1538,6 @@ config NOTIFIER_ERROR_INJECTION Say N if unsure. -config CPU_NOTIFIER_ERROR_INJECT - tristate "CPU notifier error injection module" - depends on HOTPLUG_CPU && NOTIFIER_ERROR_INJECTION - help - This option provides a kernel module that can be used to test - the error handling of the cpu notifiers by injecting artificial - errors to CPU notifier chain callbacks. It is controlled through - debugfs interface under /sys/kernel/debug/notifier-error-inject/cpu - - If the notifier call chain should be failed with some events - notified, write the error code to "actions/<notifier event>/error". - - Example: Inject CPU offline error (-1 == -EPERM) - - # cd /sys/kernel/debug/notifier-error-inject/cpu - # echo -1 > actions/CPU_DOWN_PREPARE/error - # echo 0 > /sys/devices/system/cpu/cpu1/online - bash: echo: write error: Operation not permitted - - To compile this code as a module, choose M here: the module will - be called cpu-notifier-error-inject. - - If unsure, say N. - config PM_NOTIFIER_ERROR_INJECT tristate "PM notifier error injection module" depends on PM && NOTIFIER_ERROR_INJECTION
lib/Makefile +0 -1
@@ -128,7 +128,6 @@ obj-$(CONFIG_SWIOTLB) += swiotlb.o obj-$(CONFIG_IOMMU_HELPER) += iommu-helper.o iommu-common.o obj-$(CONFIG_FAULT_INJECTION) += fault-inject.o obj-$(CONFIG_NOTIFIER_ERROR_INJECTION) += notifier-error-inject.o -obj-$(CONFIG_CPU_NOTIFIER_ERROR_INJECT) += cpu-notifier-error-inject.o obj-$(CONFIG_PM_NOTIFIER_ERROR_INJECT) += pm-notifier-error-inject.o obj-$(CONFIG_NETDEV_NOTIFIER_ERROR_INJECT) += netdev-notifier-error-inject.o obj-$(CONFIG_MEMORY_NOTIFIER_ERROR_INJECT) += memory-notifier-error-inject.o
lib/cpu-notifier-error-inject.c deleted +0 -84
84 lines not on this page · raw message
tip-bot for Thomas Gleixner
merge bot[tip:smp/urgent] cpu/hotplug: Remove obsolete cpu hotplug register/unregister functions
cpu/hotplug: Remove obsolete cpu hotplug register/unregister functions
Commit-ID: 8e38db753d952410bb0928da921885900184391b Gitweb: http://git.kernel.org/tip/8e38db753d952410bb0928da921885900184391b Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 21 Dec 2016 20:19:53 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Thu, 22 Dec 2016 11:37:55 +0100
cpu/hotplug: Remove obsolete cpu hotplug register/unregister functions
hotcpu_notifier(), cpu_notifier(), __hotcpu_notifier(), __cpu_notifier(), register_hotcpu_notifier(), register_cpu_notifier(), __register_hotcpu_notifier(), __register_cpu_notifier(), unregister_hotcpu_notifier(), unregister_cpu_notifier(), __unregister_hotcpu_notifier(), __unregister_cpu_notifier()
are unused now. Remove them and all related code.
Remove also the now pointless cpu notifier error injection mechanism. The states can be executed step by step and error rollback is the same as cpu down, so any state transition can be tested w/o requiring the notifier error injection.
Some CPU hotplug states are kept as they are (ab)used for hotplug state tracking.
--- include/linux/cpu.h | 90 -------------------------- include/linux/cpuhotplug.h | 3 - kernel/cpu.c | 139 +--------------------------------------- lib/Kconfig.debug | 24 ------- lib/Makefile | 1 - lib/cpu-notifier-error-inject.c | 84 ------------------------ 6 files changed, 1 insertion(+), 340 deletions(-)
include/linux/cpu.h +0 -90
@@ -57,9 +57,6 @@ struct notifier_block;#define CPU_ONLINE 0x0002/* CPU (unsigned)v is up */ #define CPU_UP_PREPARE 0x0003/* CPU (unsigned)v coming up */ -#define CPU_UP_CANCELED 0x0004/* CPU (unsigned)v NOT coming up */ -#define CPU_DOWN_PREPARE 0x0005/* CPU (unsigned)v going down */ -#define CPU_DOWN_FAILED 0x0006/* CPU (unsigned)v NOT going down */ #define CPU_DEAD 0x0007/* CPU (unsigned)v dead */ #define CPU_POST_DEAD 0x0009/* CPU (unsigned)v dead, cpu_hotplug * lock is dropped */
@@ -80,80 +77,14 @@ struct notifier_block;#ifdef CONFIG_SMP extern bool cpuhp_tasks_frozen; -/* Need to know about CPUs going up/down? */ -#if defined(CONFIG_HOTPLUG_CPU ) || !defined(MODULE ) -#define cpu_notifier (fn, pri) { \ - static struct notifier_block fn##_nb = \ - { .notifier_call = fn, .priority = pri }; \ - register_cpu_notifier(&fn##_nb); \ -} - -#define __cpu_notifier (fn, pri) { \ - static struct notifier_block fn##_nb = \ - { .notifier_call = fn, .priority = pri }; \ - __register_cpu_notifier(&fn##_nb); \ -} - -extern int register_cpu_notifier (struct notifier_block *nb); -extern int __register_cpu_notifier (struct notifier_block *nb); -extern void unregister_cpu_notifier (struct notifier_block *nb); -extern void __unregister_cpu_notifier (struct notifier_block *nb); - -#else /* #if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) */ -#define cpu_notifier (fn, pri) do { (void)(fn); } while (0) -#define __cpu_notifier (fn, pri) do { (void)(fn); } while (0) - -static inline int register_cpu_notifier (struct notifier_block *nb) -{ -return 0 ; -} - -static inline int __register_cpu_notifier (struct notifier_block *nb) -{ -return 0 ; -} - -static inline void unregister_cpu_notifier (struct notifier_block *nb) -{ -} - -static inline void __unregister_cpu_notifier (struct notifier_block *nb) -{ -} -#endif -int cpu_up (unsigned int cpu);void notify_cpu_starting (unsigned int cpu);extern void cpu_maps_update_begin (void );extern void cpu_maps_update_done (void ); -#define cpu_notifier_register_begin cpu_maps_update_begin -#define cpu_notifier_register_done cpu_maps_update_done -#else /* CONFIG_SMP */ #define cpuhp_tasks_frozen 0 -#define cpu_notifier (fn, pri) do { (void)(fn); } while (0) -#define __cpu_notifier (fn, pri) do { (void)(fn); } while (0) - -static inline int register_cpu_notifier (struct notifier_block *nb) -{ -return 0 ; -} - -static inline int __register_cpu_notifier (struct notifier_block *nb) -{ -return 0 ; -} - -static inline void unregister_cpu_notifier (struct notifier_block *nb) -{ -} - -static inline void __unregister_cpu_notifier (struct notifier_block *nb) -{ -} -static inline void cpu_maps_update_begin (void ) { }
@@ -162,14 +93,6 @@ static inline void cpu_maps_update_done(void) { } -static inline void cpu_notifier_register_begin (void ) -{ -} - -static inline void cpu_notifier_register_done (void ) -{ -} -#endif /* CONFIG_SMP */ extern struct bus_type cpu_subsys;
@@ -182,12 +105,6 @@ extern void get_online_cpus(void);extern void put_online_cpus (void );extern void cpu_hotplug_disable (void );extern void cpu_hotplug_enable (void ); -#define hotcpu_notifier (fn, pri) cpu_notifier(fn, pri) -#define __hotcpu_notifier (fn, pri) __cpu_notifier(fn, pri) -#define register_hotcpu_notifier (nb) register_cpu_notifier(nb) -#define __register_hotcpu_notifier (nb) __register_cpu_notifier(nb) -#define unregister_hotcpu_notifier (nb) unregister_cpu_notifier(nb) -#define __unregister_hotcpu_notifier (nb) __unregister_cpu_notifier(nb)void clear_tasks_mm_cpumask (int cpu);int cpu_down (unsigned int cpu);
@@ -199,13 +116,6 @@ static inline void cpu_hotplug_done(void) {}#define put_online_cpus () do { } while (0)#define cpu_hotplug_disable () do { } while (0)#define cpu_hotplug_enable () do { } while (0) -#define hotcpu_notifier (fn, pri) do { (void)(fn); } while (0) -#define __hotcpu_notifier (fn, pri) do { (void)(fn); } while (0) -/* These aren't inline functions due to a GCC bug. */ -#define register_hotcpu_notifier (nb) ({ (void)(nb); 0; }) -#define __register_hotcpu_notifier (nb) ({ (void)(nb); 0; }) -#define unregister_hotcpu_notifier (nb) ({ (void)(nb); }) -#define __unregister_hotcpu_notifier (nb) ({ (void)(nb); })#endif /* CONFIG_HOTPLUG_CPU */ #ifdef CONFIG_PM_SLEEP_SMP
include/linux/cpuhotplug.h +0 -3
@@ -59,7 +59,6 @@ enum cpuhp_state {CPUHP_POWERPC_MMU_CTX_PREPARE ,CPUHP_XEN_PREPARE ,CPUHP_XEN_EVTCHN_PREPARE , -CPUHP_NOTIFY_PREPARE ,CPUHP_ARM_SHMOBILE_SCU_PREPARE ,CPUHP_SH_SH3X_PREPARE , CPUHP_BLK_MQ_PREPARE,
@@ -74,7 +73,6 @@ enum cpuhp_state {CPUHP_KVM_PPC_BOOK3S_PREPARE ,CPUHP_ZCOMP_PREPARE ,CPUHP_TIMERS_DEAD , -CPUHP_NOTF_ERR_INJ_PREPARE ,CPUHP_MIPS_SOC_PREPARE ,CPUHP_BRINGUP_CPU , CPUHP_AP_IDLE_DEAD,
@@ -145,7 +143,6 @@ enum cpuhp_state {CPUHP_AP_PERF_ARM_L2X0_ONLINE ,CPUHP_AP_WORKQUEUE_ONLINE ,CPUHP_AP_RCUTREE_ONLINE , -CPUHP_AP_NOTIFY_ONLINE ,CPUHP_AP_ONLINE_DYN ,CPUHP_AP_ONLINE_DYN_END =CPUHP_AP_ONLINE_DYN +30 , CPUHP_AP_X86_HPET_ONLINE,
kernel/cpu.c +1 -138
218 lines not on this page · raw message
lib/Kconfig.debug +0 -24
@@ -1538,30 +1538,6 @@ config NOTIFIER_ERROR_INJECTION Say N if unsure. -config CPU_NOTIFIER_ERROR_INJECT - tristate "CPU notifier error injection module" - depends on HOTPLUG_CPU && NOTIFIER_ERROR_INJECTION - help - This option provides a kernel module that can be used to test - the error handling of the cpu notifiers by injecting artificial - errors to CPU notifier chain callbacks. It is controlled through - debugfs interface under /sys/kernel/debug/notifier-error-inject/cpu - - If the notifier call chain should be failed with some events - notified, write the error code to "actions/<notifier event>/error". - - Example: Inject CPU offline error (-1 == -EPERM) - - # cd /sys/kernel/debug/notifier-error-inject/cpu - # echo -1 > actions/CPU_DOWN_PREPARE/error - # echo 0 > /sys/devices/system/cpu/cpu1/online - bash: echo: write error: Operation not permitted - - To compile this code as a module, choose M here: the module will - be called cpu-notifier-error-inject. - - If unsure, say N. - config PM_NOTIFIER_ERROR_INJECT tristate "PM notifier error injection module" depends on PM && NOTIFIER_ERROR_INJECTION
lib/Makefile +0 -1
@@ -128,7 +128,6 @@ obj-$(CONFIG_SWIOTLB) += swiotlb.o obj-$(CONFIG_IOMMU_HELPER) += iommu-helper.o iommu-common.o obj-$(CONFIG_FAULT_INJECTION) += fault-inject.o obj-$(CONFIG_NOTIFIER_ERROR_INJECTION) += notifier-error-inject.o -obj-$(CONFIG_CPU_NOTIFIER_ERROR_INJECT) += cpu-notifier-error-inject.o obj-$(CONFIG_PM_NOTIFIER_ERROR_INJECT) += pm-notifier-error-inject.o obj-$(CONFIG_NETDEV_NOTIFIER_ERROR_INJECT) += netdev-notifier-error-inject.o obj-$(CONFIG_MEMORY_NOTIFIER_ERROR_INJECT) += memory-notifier-error-inject.o
lib/cpu-notifier-error-inject.c deleted +0 -84
84 lines not on this page · raw message
tip-bot for Thomas Gleixner
merge bot[tip:smp/urgent] cpu/hotplug: Remove obsolete cpu hotplug register/unregister functions
In reply to Thomas Gleixnercpu/hotplug: Remove obsolete cpu hotplug register/unregister functions
Commit-ID: 530e9b76ae8f863dfdef4a6ad0b38613d32e8c3f Gitweb: http://git.kernel.org/tip/530e9b76ae8f863dfdef4a6ad0b38613d32e8c3f Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 21 Dec 2016 20:19:53 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Sun, 25 Dec 2016 10:47:43 +0100
cpu/hotplug: Remove obsolete cpu hotplug register/unregister functions
hotcpu_notifier(), cpu_notifier(), __hotcpu_notifier(), __cpu_notifier(), register_hotcpu_notifier(), register_cpu_notifier(), __register_hotcpu_notifier(), __register_cpu_notifier(), unregister_hotcpu_notifier(), unregister_cpu_notifier(), __unregister_hotcpu_notifier(), __unregister_cpu_notifier()
are unused now. Remove them and all related code.
Remove also the now pointless cpu notifier error injection mechanism. The states can be executed step by step and error rollback is the same as cpu down, so any state transition can be tested w/o requiring the notifier error injection.
Some CPU hotplug states are kept as they are (ab)used for hotplug state tracking.
--- include/linux/cpu.h | 90 -------------------------- include/linux/cpuhotplug.h | 3 - kernel/cpu.c | 139 +--------------------------------------- lib/Kconfig.debug | 24 ------- lib/Makefile | 1 - lib/cpu-notifier-error-inject.c | 84 ------------------------ 6 files changed, 1 insertion(+), 340 deletions(-)
include/linux/cpu.h +0 -90
@@ -57,9 +57,6 @@ struct notifier_block;#define CPU_ONLINE 0x0002/* CPU (unsigned)v is up */ #define CPU_UP_PREPARE 0x0003/* CPU (unsigned)v coming up */ -#define CPU_UP_CANCELED 0x0004/* CPU (unsigned)v NOT coming up */ -#define CPU_DOWN_PREPARE 0x0005/* CPU (unsigned)v going down */ -#define CPU_DOWN_FAILED 0x0006/* CPU (unsigned)v NOT going down */ #define CPU_DEAD 0x0007/* CPU (unsigned)v dead */ #define CPU_POST_DEAD 0x0009/* CPU (unsigned)v dead, cpu_hotplug * lock is dropped */
@@ -80,80 +77,14 @@ struct notifier_block;#ifdef CONFIG_SMP extern bool cpuhp_tasks_frozen; -/* Need to know about CPUs going up/down? */ -#if defined(CONFIG_HOTPLUG_CPU ) || !defined(MODULE ) -#define cpu_notifier (fn, pri) { \ - static struct notifier_block fn##_nb = \ - { .notifier_call = fn, .priority = pri }; \ - register_cpu_notifier(&fn##_nb); \ -} - -#define __cpu_notifier (fn, pri) { \ - static struct notifier_block fn##_nb = \ - { .notifier_call = fn, .priority = pri }; \ - __register_cpu_notifier(&fn##_nb); \ -} - -extern int register_cpu_notifier (struct notifier_block *nb); -extern int __register_cpu_notifier (struct notifier_block *nb); -extern void unregister_cpu_notifier (struct notifier_block *nb); -extern void __unregister_cpu_notifier (struct notifier_block *nb); - -#else /* #if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) */ -#define cpu_notifier (fn, pri) do { (void)(fn); } while (0) -#define __cpu_notifier (fn, pri) do { (void)(fn); } while (0) - -static inline int register_cpu_notifier (struct notifier_block *nb) -{ -return 0 ; -} - -static inline int __register_cpu_notifier (struct notifier_block *nb) -{ -return 0 ; -} - -static inline void unregister_cpu_notifier (struct notifier_block *nb) -{ -} - -static inline void __unregister_cpu_notifier (struct notifier_block *nb) -{ -} -#endif -int cpu_up (unsigned int cpu);void notify_cpu_starting (unsigned int cpu);extern void cpu_maps_update_begin (void );extern void cpu_maps_update_done (void ); -#define cpu_notifier_register_begin cpu_maps_update_begin -#define cpu_notifier_register_done cpu_maps_update_done -#else /* CONFIG_SMP */ #define cpuhp_tasks_frozen 0 -#define cpu_notifier (fn, pri) do { (void)(fn); } while (0) -#define __cpu_notifier (fn, pri) do { (void)(fn); } while (0) - -static inline int register_cpu_notifier (struct notifier_block *nb) -{ -return 0 ; -} - -static inline int __register_cpu_notifier (struct notifier_block *nb) -{ -return 0 ; -} - -static inline void unregister_cpu_notifier (struct notifier_block *nb) -{ -} - -static inline void __unregister_cpu_notifier (struct notifier_block *nb) -{ -} -static inline void cpu_maps_update_begin (void ) { }
@@ -162,14 +93,6 @@ static inline void cpu_maps_update_done(void) { } -static inline void cpu_notifier_register_begin (void ) -{ -} - -static inline void cpu_notifier_register_done (void ) -{ -} -#endif /* CONFIG_SMP */ extern struct bus_type cpu_subsys;
@@ -182,12 +105,6 @@ extern void get_online_cpus(void);extern void put_online_cpus (void );extern void cpu_hotplug_disable (void );extern void cpu_hotplug_enable (void ); -#define hotcpu_notifier (fn, pri) cpu_notifier(fn, pri) -#define __hotcpu_notifier (fn, pri) __cpu_notifier(fn, pri) -#define register_hotcpu_notifier (nb) register_cpu_notifier(nb) -#define __register_hotcpu_notifier (nb) __register_cpu_notifier(nb) -#define unregister_hotcpu_notifier (nb) unregister_cpu_notifier(nb) -#define __unregister_hotcpu_notifier (nb) __unregister_cpu_notifier(nb)void clear_tasks_mm_cpumask (int cpu);int cpu_down (unsigned int cpu);
@@ -199,13 +116,6 @@ static inline void cpu_hotplug_done(void) {}#define put_online_cpus () do { } while (0)#define cpu_hotplug_disable () do { } while (0)#define cpu_hotplug_enable () do { } while (0) -#define hotcpu_notifier (fn, pri) do { (void)(fn); } while (0) -#define __hotcpu_notifier (fn, pri) do { (void)(fn); } while (0) -/* These aren't inline functions due to a GCC bug. */ -#define register_hotcpu_notifier (nb) ({ (void)(nb); 0; }) -#define __register_hotcpu_notifier (nb) ({ (void)(nb); 0; }) -#define unregister_hotcpu_notifier (nb) ({ (void)(nb); }) -#define __unregister_hotcpu_notifier (nb) ({ (void)(nb); })#endif /* CONFIG_HOTPLUG_CPU */ #ifdef CONFIG_PM_SLEEP_SMP
include/linux/cpuhotplug.h +0 -3
@@ -59,7 +59,6 @@ enum cpuhp_state {CPUHP_POWERPC_MMU_CTX_PREPARE ,CPUHP_XEN_PREPARE ,CPUHP_XEN_EVTCHN_PREPARE , -CPUHP_NOTIFY_PREPARE ,CPUHP_ARM_SHMOBILE_SCU_PREPARE ,CPUHP_SH_SH3X_PREPARE , CPUHP_BLK_MQ_PREPARE,
@@ -74,7 +73,6 @@ enum cpuhp_state {CPUHP_KVM_PPC_BOOK3S_PREPARE ,CPUHP_ZCOMP_PREPARE ,CPUHP_TIMERS_DEAD , -CPUHP_NOTF_ERR_INJ_PREPARE ,CPUHP_MIPS_SOC_PREPARE ,CPUHP_BRINGUP_CPU , CPUHP_AP_IDLE_DEAD,
@@ -145,7 +143,6 @@ enum cpuhp_state {CPUHP_AP_PERF_ARM_L2X0_ONLINE ,CPUHP_AP_WORKQUEUE_ONLINE ,CPUHP_AP_RCUTREE_ONLINE , -CPUHP_AP_NOTIFY_ONLINE ,CPUHP_AP_ONLINE_DYN ,CPUHP_AP_ONLINE_DYN_END =CPUHP_AP_ONLINE_DYN +30 , CPUHP_AP_X86_HPET_ONLINE,
kernel/cpu.c +1 -138
218 lines not on this page · raw message
lib/Kconfig.debug +0 -24
@@ -1538,30 +1538,6 @@ config NOTIFIER_ERROR_INJECTION Say N if unsure. -config CPU_NOTIFIER_ERROR_INJECT - tristate "CPU notifier error injection module" - depends on HOTPLUG_CPU && NOTIFIER_ERROR_INJECTION - help - This option provides a kernel module that can be used to test - the error handling of the cpu notifiers by injecting artificial - errors to CPU notifier chain callbacks. It is controlled through - debugfs interface under /sys/kernel/debug/notifier-error-inject/cpu - - If the notifier call chain should be failed with some events - notified, write the error code to "actions/<notifier event>/error". - - Example: Inject CPU offline error (-1 == -EPERM) - - # cd /sys/kernel/debug/notifier-error-inject/cpu - # echo -1 > actions/CPU_DOWN_PREPARE/error - # echo 0 > /sys/devices/system/cpu/cpu1/online - bash: echo: write error: Operation not permitted - - To compile this code as a module, choose M here: the module will - be called cpu-notifier-error-inject. - - If unsure, say N. - config PM_NOTIFIER_ERROR_INJECT tristate "PM notifier error injection module" depends on PM && NOTIFIER_ERROR_INJECTION
lib/Makefile +0 -1
@@ -128,7 +128,6 @@ obj-$(CONFIG_SWIOTLB) += swiotlb.o obj-$(CONFIG_IOMMU_HELPER) += iommu-helper.o iommu-common.o obj-$(CONFIG_FAULT_INJECTION) += fault-inject.o obj-$(CONFIG_NOTIFIER_ERROR_INJECTION) += notifier-error-inject.o -obj-$(CONFIG_CPU_NOTIFIER_ERROR_INJECT) += cpu-notifier-error-inject.o obj-$(CONFIG_PM_NOTIFIER_ERROR_INJECT) += pm-notifier-error-inject.o obj-$(CONFIG_NETDEV_NOTIFIER_ERROR_INJECT) += netdev-notifier-error-inject.o obj-$(CONFIG_MEMORY_NOTIFIER_ERROR_INJECT) += memory-notifier-error-inject.o
lib/cpu-notifier-error-inject.c deleted +0 -84
84 lines not on this page · raw message
PATCH 7/10 cpu/hotplug: Cleanup state names
In reply to Thomas GleixnerWhen the state names got added a script was used to add the extra argument to the calls. The script basically converted the state constant to a string, but the cleanup to convert these strings into meaningful ones did not happen.
Replace all the useless strings with 'subsys/xxx/yyy:state' strings which are used in all the other places already.
--- arch/arm/kernel/smp_twd.c | 2 +- arch/arm/mach-mvebu/coherency.c | 2 +- arch/arm/mm/cache-l2x0-pmu.c | 2 +- arch/arm/mm/cache-l2x0.c | 2 +- arch/arm/vfp/vfpmodule.c | 2 +- arch/arm/xen/enlighten.c | 2 +- arch/arm64/kernel/armv8_deprecated.c | 2 +- arch/arm64/kernel/debug-monitors.c | 2 +- arch/arm64/kernel/hw_breakpoint.c | 2 +- arch/blackfin/kernel/perf_event.c | 2 +- arch/metag/kernel/perf/perf_event.c | 2 +- arch/mips/kernel/pm-cps.c | 2 +- arch/mips/oprofile/op_model_loongson3.c | 2 +- arch/powerpc/mm/numa.c | 2 +- arch/powerpc/perf/core-book3s.c | 2 +- arch/s390/kernel/perf_cpum_cf.c | 2 +- arch/s390/kernel/perf_cpum_sf.c | 2 +- arch/x86/entry/vdso/vma.c | 2 +- arch/x86/events/amd/ibs.c | 2 +- arch/x86/events/amd/power.c | 2 +- arch/x86/events/amd/uncore.c | 6 +++--- arch/x86/events/core.c | 6 +++--- arch/x86/events/intel/cqm.c | 4 ++-- arch/x86/events/intel/cstate.c | 5 ++--- arch/x86/events/intel/rapl.c | 4 ++-- arch/x86/events/intel/uncore.c | 10 +++++----- arch/x86/kernel/apb_timer.c | 2 +- arch/x86/kernel/apic/x2apic_cluster.c | 2 +- arch/x86/kernel/hpet.c | 4 ++-- arch/x86/kernel/tboot.c | 2 +- arch/x86/kvm/x86.c | 2 +- arch/x86/xen/enlighten.c | 4 ++-- arch/xtensa/kernel/perf_event.c | 2 +- drivers/bus/arm-cci.c | 2 +- drivers/bus/arm-ccn.c | 2 +- drivers/clocksource/arc_timer.c | 2 +- drivers/clocksource/arm_arch_timer.c | 2 +- drivers/clocksource/arm_global_timer.c | 2 +- drivers/clocksource/dummy_timer.c | 2 +- drivers/clocksource/exynos_mct.c | 2 +- drivers/clocksource/jcore-pit.c | 2 +- drivers/clocksource/metag_generic.c | 2 +- drivers/clocksource/mips-gic-timer.c | 4 ++-- drivers/clocksource/qcom-timer.c | 2 +- drivers/clocksource/time-armada-370-xp.c | 2 +- drivers/clocksource/timer-atlas7.c | 2 +- drivers/hwtracing/coresight/coresight-etm3x.c | 4 ++-- drivers/hwtracing/coresight/coresight-etm4x.c | 4 ++-- drivers/irqchip/irq-armada-370-xp.c | 4 ++-- drivers/irqchip/irq-bcm2836.c | 2 +- drivers/irqchip/irq-gic-v3.c | 4 ++-- drivers/irqchip/irq-gic.c | 2 +- drivers/irqchip/irq-hip04.c | 2 +- drivers/leds/trigger/ledtrig-cpu.c | 2 +- drivers/net/virtio_net.c | 4 ++-- drivers/perf/arm_pmu.c | 2 +- drivers/xen/events/events_fifo.c | 2 +- virt/kvm/arm/arch_timer.c | 2 +- virt/kvm/arm/vgic/vgic-init.c | 2 +- virt/kvm/kvm_main.c | 2 +- 60 files changed, 79 insertions(+), 80 deletions(-)
arch/arm/kernel/smp_twd.c +1 -1
@@ -339,7 +339,7 @@ static int __init twd_local_timer_common }cpuhp_setup_state_nocalls (CPUHP_AP_ARM_TWD_STARTING , -"AP_ARM_TWD_STARTING" , +"arm/timer/twd:starting" , twd_timer_starting_cpu, twd_timer_dying_cpu);twd_get_clock (np);
arch/arm/mach-mvebu/coherency.c +1 -1
@@ -148,7 +148,7 @@ static void __init armada_370_coherency_of_node_put (cpu_config_np);cpuhp_setup_state_nocalls (CPUHP_AP_ARM_MVEBU_COHERENCY , -"AP_ARM_MVEBU_COHERENCY" , +"arm/mvebu/coherency:starting" , armada_xp_clear_l2_starting,NULL ); exit:set_cpu_coherent ();
arch/arm/mm/cache-l2x0-pmu.c +1 -1
@@ -563,7 +563,7 @@ static __init int l2x0_pmu_init(void)cpumask_set_cpu (0 , &pmu_cpu); ret =cpuhp_setup_state_nocalls (CPUHP_AP_PERF_ARM_L2X0_ONLINE , -"AP_PERF_ARM_L2X0_ONLINE" ,NULL , +"perf/arm/l2x0:online" ,NULL , l2x0_pmu_offline_cpu);if (ret) goto out_pmu;
arch/arm/mm/cache-l2x0.c +1 -1
@@ -683,7 +683,7 @@ static void __init l2c310_enable(void __if (aux &L310_AUX_CTRL_FULL_LINE_ZERO )cpuhp_setup_state (CPUHP_AP_ARM_L2X0_STARTING , -"AP_ARM_L2X0_STARTING" , l2c310_starting_cpu, +"arm/l2x0:starting" , l2c310_starting_cpu, l2c310_dying_cpu); }
arch/arm/vfp/vfpmodule.c +1 -1
@@ -799,7 +799,7 @@ static int __init vfp_init(void) }cpuhp_setup_state_nocalls (CPUHP_AP_ARM_VFP_STARTING , -"AP_ARM_VFP_STARTING" , vfp_starting_cpu, +"arm/vfp:starting" , vfp_starting_cpu, vfp_dying_cpu); vfp_vector = vfp_support_entry;
arch/arm/xen/enlighten.c +1 -1
@@ -412,7 +412,7 @@ static int __init xen_guest_init(void)pvclock_gtod_register_notifier (&xen_pvclock_gtod_notifier);return cpuhp_setup_state (CPUHP_AP_ARM_XEN_STARTING , -"AP_ARM_XEN_STARTING" , xen_starting_cpu, +"arm/xen:starting" , xen_starting_cpu, xen_dying_cpu); }early_initcall (xen_guest_init);
arch/arm64/kernel/armv8_deprecated.c +1 -1
@@ -640,7 +640,7 @@ static int __init armv8_deprecated_init( }cpuhp_setup_state_nocalls (CPUHP_AP_ARM64_ISNDEP_STARTING , -"AP_ARM64_ISNDEP_STARTING" , +"arm64/isndep:starting" , run_all_insn_set_hw_mode,NULL );register_insn_emulation_sysctl (ctl_abi);
arch/arm64/kernel/debug-monitors.c +1 -1
@@ -140,7 +140,7 @@ static int clear_os_lock(unsigned int cpstatic int debug_monitors_init (void ) {return cpuhp_setup_state (CPUHP_AP_ARM64_DEBUG_MONITORS_STARTING , -"CPUHP_AP_ARM64_DEBUG_MONITORS_STARTING" , +"arm64/debug_monitors:starting" , clear_os_lock,NULL ); }postcore_initcall (debug_monitors_init);
arch/arm64/kernel/hw_breakpoint.c +1 -1
@@ -1001,7 +1001,7 @@ static int __init arch_hw_breakpoint_ini* debugger will leave the world in a nice state for us. */ ret =cpuhp_setup_state (CPUHP_AP_PERF_ARM_HW_BREAKPOINT_STARTING , -"CPUHP_AP_PERF_ARM_HW_BREAKPOINT_STARTING" , +"perf/arm64/hw_breakpoint:starting" , hw_breakpoint_reset,NULL );if (ret)pr_err ("failed to register CPU hotplug notifier: %d\n" , ret);
arch/blackfin/kernel/perf_event.c +1 -1
@@ -475,7 +475,7 @@ static int __init bfin_pmu_init(void) ret =perf_pmu_register (&pmu,"cpu" ,PERF_TYPE_RAW );if (!ret) -cpuhp_setup_state (CPUHP_PERF_BFIN ,"PERF_BFIN" , +cpuhp_setup_state (CPUHP_PERF_BFIN ,"perf/bfin:starting" , bfin_pmu_prepare_cpu,NULL );return ret; }
arch/metag/kernel/perf/perf_event.c +1 -1
@@ -868,7 +868,7 @@ static int __init init_hw_perf_events(vometag_out32 (0 ,PERF_COUNT (1 ));cpuhp_setup_state (CPUHP_AP_PERF_METAG_STARTING , -"AP_PERF_METAG_STARTING" , metag_pmu_starting_cpu, +"perf/metag:starting" , metag_pmu_starting_cpu,NULL ); ret =perf_pmu_register (&pmu, metag_pmu->name,PERF_TYPE_RAW );
arch/mips/kernel/pm-cps.c +1 -1
@@ -713,7 +713,7 @@ static int __init cps_pm_init(void)pr_warn ("pm-cps: no CPC, clock & power gating unavailable\n" ); } -return cpuhp_setup_state (CPUHP_AP_ONLINE_DYN ,"AP_PM_CPS_CPU_ONLINE" , +return cpuhp_setup_state (CPUHP_AP_ONLINE_DYN ,"mips/cps_pm:online" , cps_pm_online_cpu,NULL ); }arch_initcall (cps_pm_init);
arch/mips/oprofile/op_model_loongson3.c +1 -1
@@ -186,7 +186,7 @@ static int __init loongson3_init(void) {on_each_cpu (reset_counters,NULL ,1 );cpuhp_setup_state_nocalls (CPUHP_AP_MIPS_OP_LOONGSON3_STARTING , -"AP_MIPS_OP_LOONGSON3_STARTING" , +"mips/oprofile/loongson3:starting" , loongson3_starting_cpu, loongson3_dying_cpu); save_perf_irq = perf_irq; perf_irq = loongson3_perfcount_handler;
arch/powerpc/mm/numa.c +1 -1
@@ -944,7 +944,7 @@ void __init initmem_init(void)* _nocalls() + manual invocation is used because cpuhp is not yet * initialized for the boot CPU. */ -cpuhp_setup_state_nocalls (CPUHP_POWER_NUMA_PREPARE ,"POWER_NUMA_PREPARE" , +cpuhp_setup_state_nocalls (CPUHP_POWER_NUMA_PREPARE ,"powerpc/numa:prepare" , ppc_numa_cpu_prepare, ppc_numa_cpu_dead);for_each_present_cpu (cpu)numa_setup_cpu (cpu);
arch/powerpc/perf/core-book3s.c +1 -1
@@ -2189,7 +2189,7 @@ int register_power_pmu(struct power_pmu#endif /* CONFIG_PPC64 */ perf_pmu_register (&power_pmu,"cpu" ,PERF_TYPE_RAW ); -cpuhp_setup_state (CPUHP_PERF_POWER ,"PERF_POWER" , +cpuhp_setup_state (CPUHP_PERF_POWER ,"perf/powerpc:prepare" , power_pmu_prepare_cpu,NULL );return 0 ; }
arch/s390/kernel/perf_cpum_cf.c +1 -1
@@ -711,7 +711,7 @@ static int __init cpumf_pmu_init(void)return rc; }return cpuhp_setup_state (CPUHP_AP_PERF_S390_CF_ONLINE , -"AP_PERF_S390_CF_ONLINE" , +"perf/s390/cf:online" , s390_pmu_online_cpu, s390_pmu_offline_cpu); }early_initcall (cpumf_pmu_init);
arch/s390/kernel/perf_cpum_sf.c +1 -1
@@ -1623,7 +1623,7 @@ static int __init init_cpum_sampling_pmu goto out; } -cpuhp_setup_state (CPUHP_AP_PERF_S390_SF_ONLINE ,"AP_PERF_S390_SF_ONLINE" , +cpuhp_setup_state (CPUHP_AP_PERF_S390_SF_ONLINE ,"perf/s390/sf:online" , s390_pmu_sf_online_cpu, s390_pmu_sf_offline_cpu); out:return err;
arch/x86/entry/vdso/vma.c +1 -1
@@ -371,7 +371,7 @@ static int __init init_vdso(void)/* notifier priority > KVM */ return cpuhp_setup_state (CPUHP_AP_X86_VDSO_VMA_ONLINE , - "AP_X86_VDSO_VMA_ONLINE", vgetcpu_online, NULL); + "x86/vdso/vma:online", vgetcpu_online, NULL); }subsys_initcall (init_vdso);#endif /* CONFIG_X86_64 */
arch/x86/events/amd/ibs.c +1 -1
@@ -1010,7 +1010,7 @@ static __init int amd_ibs_init(void)* all online cpus. */ cpuhp_setup_state (CPUHP_AP_PERF_X86_AMD_IBS_STARTING , -"AP_PERF_X86_AMD_IBS_STARTING" , +"perf/x86/amd/ibs:STARTING" , x86_pmu_amd_ibs_starting_cpu, x86_pmu_amd_ibs_dying_cpu);
arch/x86/events/amd/power.c +1 -1
@@ -291,7 +291,7 @@ static int __init amd_power_pmu_init(voicpuhp_setup_state (CPUHP_AP_PERF_X86_AMD_POWER_ONLINE , -"AP_PERF_X86_AMD_POWER_ONLINE" , +"perf/x86/amd/power:online" , power_cpu_init, power_cpu_exit); ret =perf_pmu_register (&pmu_class,"power" ,-1 );
arch/x86/events/amd/uncore.c +3 -3
@@ -527,16 +527,16 @@ static int __init amd_uncore_init(void)* Install callbacks. Core will call them for each online cpu. */ if (cpuhp_setup_state (CPUHP_PERF_X86_AMD_UNCORE_PREP , -"PERF_X86_AMD_UNCORE_PREP" , +"perf/x86/amd/uncore:prepare" , amd_uncore_cpu_up_prepare, amd_uncore_cpu_dead)) goto fail_l2;if (cpuhp_setup_state (CPUHP_AP_PERF_X86_AMD_UNCORE_STARTING , -"AP_PERF_X86_AMD_UNCORE_STARTING" , +"perf/x86/amd/uncore:starting" , amd_uncore_cpu_starting,NULL )) goto fail_prep;if (cpuhp_setup_state (CPUHP_AP_PERF_X86_AMD_UNCORE_ONLINE , -"AP_PERF_X86_AMD_UNCORE_ONLINE" , +"perf/x86/amd/uncore:online" , amd_uncore_cpu_online, amd_uncore_cpu_down_prepare)) goto fail_start;
arch/x86/events/core.c +3 -3
@@ -1820,18 +1820,18 @@ static int __init init_hw_perf_events(vo* Install callbacks. Core will call them for each online * cpu. */ - err =cpuhp_setup_state (CPUHP_PERF_X86_PREPARE ,"PERF_X86_PREPARE" , + err =cpuhp_setup_state (CPUHP_PERF_X86_PREPARE ,"perf/x86:prepare" , x86_pmu_prepare_cpu, x86_pmu_dead_cpu);if (err)return err; err =cpuhp_setup_state (CPUHP_AP_PERF_X86_STARTING , -"AP_PERF_X86_STARTING" , x86_pmu_starting_cpu, +"perf/x86:starting" , x86_pmu_starting_cpu, x86_pmu_dying_cpu);if (err) goto out; - err =cpuhp_setup_state (CPUHP_AP_PERF_X86_ONLINE ,"AP_PERF_X86_ONLINE" , + err =cpuhp_setup_state (CPUHP_AP_PERF_X86_ONLINE ,"perf/x86:online" , x86_pmu_online_cpu,NULL );if (err) goto out1;
arch/x86/events/intel/cqm.c +2 -2
@@ -1766,9 +1766,9 @@ static int __init intel_cqm_init(void)* is enabled to avoid notifier leak. */ cpuhp_setup_state (CPUHP_AP_PERF_X86_CQM_STARTING , -"AP_PERF_X86_CQM_STARTING" , +"perf/x86/cqm:starting" , intel_cqm_cpu_starting,NULL ); -cpuhp_setup_state (CPUHP_AP_PERF_X86_CQM_ONLINE ,"AP_PERF_X86_CQM_ONLINE" , +cpuhp_setup_state (CPUHP_AP_PERF_X86_CQM_ONLINE ,"perf/x86/cqm:online" ,NULL , intel_cqm_cpu_exit); out:
arch/x86/events/intel/cstate.c +2 -3
@@ -606,10 +606,9 @@ static int __init cstate_init(void)int err;cpuhp_setup_state (CPUHP_AP_PERF_X86_CSTATE_STARTING , -"AP_PERF_X86_CSTATE_STARTING" , cstate_cpu_init, -NULL ); +"perf/x86/cstate:starting" , cstate_cpu_init,NULL );cpuhp_setup_state (CPUHP_AP_PERF_X86_CSTATE_ONLINE , -"AP_PERF_X86_CSTATE_ONLINE" ,NULL , cstate_cpu_exit); +"perf/x86/cstate:online" ,NULL , cstate_cpu_exit);if (has_cstate_core) { err =perf_pmu_register (&cstate_core_pmu, cstate_core_pmu.name,-1 );
arch/x86/events/intel/rapl.c +2 -2
@@ -803,13 +803,13 @@ static int __init rapl_pmu_init(void)* Install callbacks. Core will call them for each online cpu. */ - ret =cpuhp_setup_state (CPUHP_PERF_X86_RAPL_PREP ,"PERF_X86_RAPL_PREP" , + ret =cpuhp_setup_state (CPUHP_PERF_X86_RAPL_PREP ,"perf/x86/rapl:prepare" , rapl_cpu_prepare,NULL );if (ret) goto out; ret =cpuhp_setup_state (CPUHP_AP_PERF_X86_RAPL_ONLINE , -"AP_PERF_X86_RAPL_ONLINE" , +"perf/x86/rapl:online" , rapl_cpu_online, rapl_cpu_offline);if (ret) goto out1;
arch/x86/events/intel/uncore.c +5 -5
@@ -1398,22 +1398,22 @@ static int __init intel_uncore_init(void*/ if (!cret) { ret =cpuhp_setup_state (CPUHP_PERF_X86_UNCORE_PREP , -"PERF_X86_UNCORE_PREP" , - uncore_cpu_prepare,NULL ); +"perf/x86/intel/uncore:prepare" , + uncore_cpu_prepare,NULL );if (ret) goto err; }else {cpuhp_setup_state_nocalls (CPUHP_PERF_X86_UNCORE_PREP , -"PERF_X86_UNCORE_PREP" , +"perf/x86/intel/uncore:prepare" , uncore_cpu_prepare,NULL ); } first_init =1 ;cpuhp_setup_state (CPUHP_AP_PERF_X86_UNCORE_STARTING , -"AP_PERF_X86_UNCORE_STARTING" , +"perf/x86/uncore:starting" , uncore_cpu_starting, uncore_cpu_dying); first_init =0 ;cpuhp_setup_state (CPUHP_AP_PERF_X86_UNCORE_ONLINE , -"AP_PERF_X86_UNCORE_ONLINE" , +"perf/x86/uncore:online" , uncore_event_cpu_online, uncore_event_cpu_offline);return 0 ;
arch/x86/kernel/apb_timer.c +1 -1
@@ -234,7 +234,7 @@ static __init int apbt_late_init(void)if (intel_mid_timer_options ==INTEL_MID_TIMER_LAPIC_APBT || !apb_timer_block_enabled)return 0 ; -return cpuhp_setup_state (CPUHP_X86_APB_DEAD ,"X86_APB_DEAD" ,NULL , +return cpuhp_setup_state (CPUHP_X86_APB_DEAD ,"x86/apb:dead" ,NULL , apbt_cpu_dead); }fs_initcall (apbt_late_init);
arch/x86/kernel/apic/x2apic_cluster.c +1 -1
@@ -191,7 +191,7 @@ static int x2apic_cluster_probe(void)if (!x2apic_mode)return 0 ; - ret =cpuhp_setup_state (CPUHP_X2APIC_PREPARE ,"X2APIC_PREPARE" , + ret =cpuhp_setup_state (CPUHP_X2APIC_PREPARE ,"x86/x2apic:prepare" , x2apic_prepare_cpu, x2apic_dead_cpu);if (ret <0 ) {pr_err ("Failed to register X2APIC_PREPARE\n" );
arch/x86/kernel/hpet.c +2 -2
@@ -1051,11 +1051,11 @@ static __init int hpet_late_init(void)return 0 ;/* This notifier should be called after workqueue is ready */ - ret =cpuhp_setup_state (CPUHP_AP_X86_HPET_ONLINE ,"AP_X86_HPET_ONLINE" , + ret =cpuhp_setup_state (CPUHP_AP_X86_HPET_ONLINE ,"x86/hpet:online" , hpet_cpuhp_online,NULL );if (ret)return ret; - ret =cpuhp_setup_state (CPUHP_X86_HPET_DEAD ,"X86_HPET_DEAD" ,NULL , + ret =cpuhp_setup_state (CPUHP_X86_HPET_DEAD ,"x86/hpet:dead" ,NULL , hpet_cpuhp_dead);if (ret) goto err_cpuhp;
arch/x86/kernel/tboot.c +1 -1
@@ -408,7 +408,7 @@ static __init int tboot_late_init(void)tboot_create_trampoline ();atomic_set (&ap_wfs_count,0 ); -cpuhp_setup_state (CPUHP_AP_X86_TBOOT_DYING ,"AP_X86_TBOOT_DYING" ,NULL , +cpuhp_setup_state (CPUHP_AP_X86_TBOOT_DYING ,"x86/tboot:dying" ,NULL , tboot_dying_cpu);#ifdef CONFIG_DEBUG_FS debugfs_create_file("tboot_log", S_IRUSR,
arch/x86/kvm/x86.c +1 -1
@@ -5838,7 +5838,7 @@ static void kvm_timer_init(void) }pr_debug ("kvm: max_tsc_khz = %ld\n" , max_tsc_khz); -cpuhp_setup_state (CPUHP_AP_X86_KVM_CLK_ONLINE ,"AP_X86_KVM_CLK_ONLINE" , +cpuhp_setup_state (CPUHP_AP_X86_KVM_CLK_ONLINE ,"x86/kvm/clk:online" , kvmclock_cpu_online, kvmclock_cpu_down_prep); }
arch/x86/xen/enlighten.c +2 -2
@@ -1529,11 +1529,11 @@ static int xen_cpuhp_setup(void)int rc; rc =cpuhp_setup_state_nocalls (CPUHP_XEN_PREPARE , -"XEN_HVM_GUEST_PREPARE" , +"x86/xen/hvm_guest:prepare" , xen_cpu_up_prepare, xen_cpu_dead);if (rc >=0 ) { rc =cpuhp_setup_state_nocalls (CPUHP_AP_ONLINE_DYN , -"XEN_HVM_GUEST_ONLINE" , +"x86/xen/hvm_guest:online" , xen_cpu_up_online,NULL );if (rc <0 )cpuhp_remove_state_nocalls (CPUHP_XEN_PREPARE );
arch/xtensa/kernel/perf_event.c +1 -1
@@ -422,7 +422,7 @@ static int __init xtensa_pmu_init(void)int irq =irq_create_mapping (NULL ,XCHAL_PROFILING_INTERRUPT ); ret =cpuhp_setup_state (CPUHP_AP_PERF_XTENSA_STARTING , -"AP_PERF_XTENSA_STARTING" , xtensa_pmu_setup, +"perf/xtensa:starting" , xtensa_pmu_setup,NULL );if (ret) {pr_err ("xtensa_pmu: failed to register CPU-hotplug.\n" );
drivers/bus/arm-cci.c +1 -1
@@ -1796,7 +1796,7 @@ static int __init cci_platform_init(voidint ret; ret =cpuhp_setup_state_multi (CPUHP_AP_PERF_ARM_CCI_ONLINE , -"AP_PERF_ARM_CCI_ONLINE" ,NULL , +"perf/arm/cci:online" ,NULL , cci_pmu_offline_cpu);if (ret)return ret;
drivers/bus/arm-ccn.c +1 -1
@@ -1562,7 +1562,7 @@ static int __init arm_ccn_init(void)int i, ret; ret =cpuhp_setup_state_multi (CPUHP_AP_PERF_ARM_CCN_ONLINE , -"AP_PERF_ARM_CCN_ONLINE" ,NULL , +"perf/arm/ccn:online" ,NULL , arm_ccn_pmu_offline_cpu);if (ret)return ret;
drivers/clocksource/arc_timer.c +1 -1
@@ -309,7 +309,7 @@ static int __init arc_clockevent_setup(s } ret =cpuhp_setup_state (CPUHP_AP_ARC_TIMER_STARTING , -"AP_ARC_TIMER_STARTING" , +"clockevents/arc/timer:starting" , arc_timer_starting_cpu, arc_timer_dying_cpu);if (ret) {
drivers/clocksource/arm_arch_timer.c +1 -1
@@ -738,7 +738,7 @@ static int __init arch_timer_register(vo/* Register and immediately configure the timer on the boot CPU */ err =cpuhp_setup_state (CPUHP_AP_ARM_ARCH_TIMER_STARTING , -"AP_ARM_ARCH_TIMER_STARTING" , +"clockevents/arm/arch_timer:starting" , arch_timer_starting_cpu, arch_timer_dying_cpu);if (err) goto out_unreg_cpupm;
drivers/clocksource/arm_global_timer.c +1 -1
@@ -316,7 +316,7 @@ static int __init global_timer_of_regist goto out_irq; err =cpuhp_setup_state (CPUHP_AP_ARM_GLOBAL_TIMER_STARTING , -"AP_ARM_GLOBAL_TIMER_STARTING" , +"clockevents/arm/global_timer:starting" , gt_starting_cpu, gt_dying_cpu);if (err) goto out_irq;
drivers/clocksource/dummy_timer.c +1 -1
@@ -34,7 +34,7 @@ static int dummy_timer_starting_cpu(unsistatic int __init dummy_timer_register (void ) {return cpuhp_setup_state (CPUHP_AP_DUMMY_TIMER_STARTING , -"AP_DUMMY_TIMER_STARTING" , +"clockevents/dummy_timer:starting" , dummy_timer_starting_cpu,NULL ); }early_initcall (dummy_timer_register);
drivers/clocksource/exynos_mct.c +1 -1
@@ -552,7 +552,7 @@ static int __init exynos4_timer_resource/* Install hotplug callbacks which configure the timer on this CPU */ err =cpuhp_setup_state (CPUHP_AP_EXYNOS4_MCT_TIMER_STARTING , -"AP_EXYNOS4_MCT_TIMER_STARTING" , +"clockevents/exynos4/mct_timer:starting" , exynos4_mct_starting_cpu, exynos4_mct_dying_cpu);if (err)
drivers/clocksource/jcore-pit.c +1 -1
@@ -240,7 +240,7 @@ static int __init jcore_pit_init(struct }cpuhp_setup_state (CPUHP_AP_JCORE_TIMER_STARTING , -"AP_JCORE_TIMER_STARTING" , +"clockevents/jcore:starting" , jcore_pit_local_init,NULL );return 0 ;
drivers/clocksource/metag_generic.c +1 -1
@@ -154,6 +154,6 @@ int __init metag_generic_timer_init(void/* Hook cpu boot to configure the CPU's timers */ return cpuhp_setup_state (CPUHP_AP_METAG_TIMER_STARTING , -"AP_METAG_TIMER_STARTING" , +"clockevents/metag:starting" , arch_timer_starting_cpu,NULL ); }
drivers/clocksource/mips-gic-timer.c +2 -2
@@ -120,8 +120,8 @@ static int gic_clockevent_init(void) }cpuhp_setup_state (CPUHP_AP_MIPS_GIC_TIMER_STARTING , -"AP_MIPS_GIC_TIMER_STARTING" , gic_starting_cpu, - gic_dying_cpu); +"clockevents/mips/gic/timer:starting" , + gic_starting_cpu, gic_dying_cpu);return 0 ; }
drivers/clocksource/qcom-timer.c +1 -1
@@ -182,7 +182,7 @@ static int __init msm_timer_init(u32 dgt }else {/* Install and invoke hotplug callbacks */ res =cpuhp_setup_state (CPUHP_AP_QCOM_TIMER_STARTING , -"AP_QCOM_TIMER_STARTING" , +"clockevents/qcom/timer:starting" , msm_local_timer_starting_cpu, msm_local_timer_dying_cpu);if (res) {
drivers/clocksource/time-armada-370-xp.c +1 -1
@@ -320,7 +320,7 @@ static int __init armada_370_xp_timer_co } res =cpuhp_setup_state (CPUHP_AP_ARMADA_TIMER_STARTING , -"AP_ARMADA_TIMER_STARTING" , +"clockevents/armada:starting" , armada_370_xp_timer_starting_cpu, armada_370_xp_timer_dying_cpu);if (res) {
drivers/clocksource/timer-atlas7.c +1 -1
@@ -221,7 +221,7 @@ static int __init sirfsoc_clockevent_ini/* Install and invoke hotplug callbacks */ return cpuhp_setup_state (CPUHP_AP_MARCO_TIMER_STARTING , -"AP_MARCO_TIMER_STARTING" , +"clockevents/marco:starting" , sirfsoc_local_timer_starting_cpu, sirfsoc_local_timer_dying_cpu); }
drivers/hwtracing/coresight/coresight-etm3x.c +2 -2
@@ -804,10 +804,10 @@ static int etm_probe(struct amba_deviceif (!etm_count++) {cpuhp_setup_state_nocalls (CPUHP_AP_ARM_CORESIGHT_STARTING , -"AP_ARM_CORESIGHT_STARTING" , +"arm/coresight:starting" , etm_starting_cpu, etm_dying_cpu); ret =cpuhp_setup_state_nocalls (CPUHP_AP_ONLINE_DYN , -"AP_ARM_CORESIGHT_ONLINE" , +"arm/coresight:online" , etm_online_cpu,NULL );if (ret <0 ) goto err_arch_supported;
drivers/hwtracing/coresight/coresight-etm4x.c +2 -2
@@ -987,10 +987,10 @@ static int etm4_probe(struct amba_deviceif (!etm4_count++) {cpuhp_setup_state_nocalls (CPUHP_AP_ARM_CORESIGHT4_STARTING , -"AP_ARM_CORESIGHT4_STARTING" , +"arm/coresight4:starting" , etm4_starting_cpu, etm4_dying_cpu); ret =cpuhp_setup_state_nocalls (CPUHP_AP_ONLINE_DYN , -"AP_ARM_CORESIGHT4_ONLINE" , +"arm/coresight4:online" , etm4_online_cpu,NULL );if (ret <0 ) goto err_arch_supported;
drivers/irqchip/irq-armada-370-xp.c +2 -2
@@ -578,13 +578,13 @@ static int __init armada_370_xp_mpic_of_#ifdef CONFIG_SMP set_smp_cross_call (armada_mpic_send_doorbell);cpuhp_setup_state_nocalls (CPUHP_AP_IRQ_ARMADA_XP_STARTING , -"AP_IRQ_ARMADA_XP_STARTING" , +"irqchip/armada/ipi:starting" , armada_xp_mpic_starting_cpu,NULL );#endif }else {#ifdef CONFIG_SMP cpuhp_setup_state_nocalls (CPUHP_AP_IRQ_ARMADA_CASC_STARTING , -"AP_IRQ_ARMADA_CASC_STARTING" , +"irqchip/armada/cascade:starting" , mpic_cascaded_starting_cpu,NULL );#endif irq_set_chained_handler(parent_irq,
drivers/irqchip/irq-bcm2836.c +1 -1
@@ -245,7 +245,7 @@ bcm2836_arm_irqchip_smp_init(void)#ifdef CONFIG_SMP /* Unmask IPIs to the boot CPU. */ cpuhp_setup_state (CPUHP_AP_IRQ_BCM2836_STARTING , -"AP_IRQ_BCM2836_STARTING" , bcm2836_cpu_starting, +"irqchip/bcm2836:starting" , bcm2836_cpu_starting, bcm2836_cpu_dying);set_smp_cross_call (bcm2836_arm_irqchip_send_ipi);
drivers/irqchip/irq-gic-v3.c +2 -2
@@ -633,8 +633,8 @@ static void gic_smp_init(void) {set_smp_cross_call (gic_raise_softirq);cpuhp_setup_state_nocalls (CPUHP_AP_IRQ_GICV3_STARTING , -"AP_IRQ_GICV3_STARTING" , gic_starting_cpu, -NULL ); +"irqchip/arm/gicv3:starting" , + gic_starting_cpu,NULL ); } static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val,
drivers/irqchip/irq-gic.c +1 -1
@@ -1191,7 +1191,7 @@ static int __init __gic_init_bases(strucset_smp_cross_call (gic_raise_softirq);#endif cpuhp_setup_state_nocalls (CPUHP_AP_IRQ_GIC_STARTING , -"AP_IRQ_GIC_STARTING" , +"irqchip/arm/gic:starting" , gic_starting_cpu,NULL );set_handle_irq (gic_handle_irq);if (static_key_true (&supports_deactivate))
drivers/irqchip/irq-hip04.c +1 -1
@@ -407,7 +407,7 @@ hip04_of_init(struct device_node *node,set_handle_irq (hip04_handle_irq);hip04_irq_dist_init (&hip04_data); -cpuhp_setup_state (CPUHP_AP_IRQ_HIP04_STARTING ,"AP_IRQ_HIP04_STARTING" , +cpuhp_setup_state (CPUHP_AP_IRQ_HIP04_STARTING ,"irqchip/hip04:starting" , hip04_irq_starting_cpu,NULL );return 0 ; }
drivers/leds/trigger/ledtrig-cpu.c +1 -1
@@ -127,7 +127,7 @@ static int __init ledtrig_cpu_init(void)register_syscore_ops (&ledtrig_cpu_syscore_ops); - ret =cpuhp_setup_state (CPUHP_AP_ONLINE_DYN ,"AP_LEDTRIG_STARTING" , + ret =cpuhp_setup_state (CPUHP_AP_ONLINE_DYN ,"leds/trigger:starting" , ledtrig_online_cpu, ledtrig_prepare_down_cpu);if (ret <0 ) pr_err("CPU hotplug notifier for ledtrig-cpu could not be registered: %d\n",
drivers/net/virtio_net.c +2 -2
@@ -2452,13 +2452,13 @@ static __init int virtio_net_driver_init {int ret; - ret =cpuhp_setup_state_multi (CPUHP_AP_ONLINE_DYN ,"AP_VIRT_NET_ONLINE" , + ret =cpuhp_setup_state_multi (CPUHP_AP_ONLINE_DYN ,"virtio/net:online" , virtnet_cpu_online, virtnet_cpu_down_prep);if (ret <0 ) goto out; virtionet_online = ret; - ret =cpuhp_setup_state_multi (CPUHP_VIRT_NET_DEAD ,"VIRT_NET_DEAD" , + ret =cpuhp_setup_state_multi (CPUHP_VIRT_NET_DEAD ,"virtio/net:dead" ,NULL , virtnet_cpu_dead);if (ret) goto err_dead;
drivers/perf/arm_pmu.c +1 -1
@@ -1084,7 +1084,7 @@ static int arm_pmu_hp_init(void)int ret; ret =cpuhp_setup_state_multi (CPUHP_AP_PERF_ARM_STARTING , -"AP_PERF_ARM_STARTING" , +"perf/arm/pmu:starting" , arm_perf_starting_cpu,NULL );if (ret) pr_err("CPU hotplug notifier for ARM PMU could not be registered: %d\n",
drivers/xen/events/events_fifo.c +1 -1
@@ -445,7 +445,7 @@ int __init xen_evtchn_fifo_init(void) evtchn_ops = &evtchn_ops_fifo;cpuhp_setup_state_nocalls (CPUHP_XEN_EVTCHN_PREPARE , -"CPUHP_XEN_EVTCHN_PREPARE" , +"xen/evtchn:prepare" , xen_evtchn_cpu_prepare, xen_evtchn_cpu_dead); out:put_cpu ();
virt/kvm/arm/arch_timer.c +1 -1
@@ -456,7 +456,7 @@ int kvm_timer_hyp_init(void)kvm_info ("virtual timer IRQ%d\n" , host_vtimer_irq);cpuhp_setup_state (CPUHP_AP_KVM_ARM_TIMER_STARTING , -"AP_KVM_ARM_TIMER_STARTING" , kvm_timer_starting_cpu, +"kvm/arm/timer:starting" , kvm_timer_starting_cpu, kvm_timer_dying_cpu);return err; }
virt/kvm/arm/vgic/vgic-init.c +1 -1
@@ -428,7 +428,7 @@ int kvm_vgic_hyp_init(void) } ret =cpuhp_setup_state (CPUHP_AP_KVM_ARM_VGIC_INIT_STARTING , -"AP_KVM_ARM_VGIC_INIT_STARTING" , +"kvm/arm/vgic:starting" , vgic_init_cpu_starting, vgic_init_cpu_dying);if (ret) {kvm_err ("Cannot register vgic CPU notifier\n" );
virt/kvm/kvm_main.c +1 -1
@@ -3944,7 +3944,7 @@ int kvm_init(void *opaque, unsigned vcpu goto out_free_1; } - r =cpuhp_setup_state_nocalls (CPUHP_AP_KVM_STARTING ,"AP_KVM_STARTING" , + r =cpuhp_setup_state_nocalls (CPUHP_AP_KVM_STARTING ,"kvm/cpu:starting" , kvm_starting_cpu, kvm_dying_cpu);if (r) goto out_free_2;
tip-bot for Thomas Gleixner
merge bot[tip:smp/urgent] cpu/hotplug: Cleanup state names
cpu/hotplug: Cleanup state names
Commit-ID: 8ea29129e7cd926901ee3396b963453c7f5c3c4b Gitweb: http://git.kernel.org/tip/8ea29129e7cd926901ee3396b963453c7f5c3c4b Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 21 Dec 2016 20:19:54 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Thu, 22 Dec 2016 11:37:55 +0100
cpu/hotplug: Cleanup state names
When the state names got added a script was used to add the extra argument to the calls. The script basically converted the state constant to a string, but the cleanup to convert these strings into meaningful ones did not happen.
Replace all the useless strings with 'subsys/xxx/yyy:state' strings which are used in all the other places already.
--- arch/arm/kernel/smp_twd.c | 2 +- arch/arm/mach-mvebu/coherency.c | 2 +- arch/arm/mm/cache-l2x0-pmu.c | 2 +- arch/arm/mm/cache-l2x0.c | 2 +- arch/arm/vfp/vfpmodule.c | 2 +- arch/arm/xen/enlighten.c | 2 +- arch/arm64/kernel/armv8_deprecated.c | 2 +- arch/arm64/kernel/debug-monitors.c | 2 +- arch/arm64/kernel/hw_breakpoint.c | 2 +- arch/blackfin/kernel/perf_event.c | 2 +- arch/metag/kernel/perf/perf_event.c | 2 +- arch/mips/kernel/pm-cps.c | 2 +- arch/mips/oprofile/op_model_loongson3.c | 2 +- arch/powerpc/mm/numa.c | 2 +- arch/powerpc/perf/core-book3s.c | 2 +- arch/s390/kernel/perf_cpum_cf.c | 2 +- arch/s390/kernel/perf_cpum_sf.c | 2 +- arch/x86/entry/vdso/vma.c | 2 +- arch/x86/events/amd/ibs.c | 2 +- arch/x86/events/amd/power.c | 2 +- arch/x86/events/amd/uncore.c | 6 +++--- arch/x86/events/core.c | 6 +++--- arch/x86/events/intel/cqm.c | 4 ++-- arch/x86/events/intel/rapl.c | 4 ++-- arch/x86/events/intel/uncore.c | 10 +++++----- arch/x86/kernel/apb_timer.c | 2 +- arch/x86/kernel/apic/x2apic_cluster.c | 2 +- arch/x86/kernel/hpet.c | 4 ++-- arch/x86/kernel/tboot.c | 2 +- arch/x86/kvm/x86.c | 2 +- arch/x86/xen/enlighten.c | 4 ++-- arch/xtensa/kernel/perf_event.c | 2 +- drivers/bus/arm-cci.c | 2 +- drivers/bus/arm-ccn.c | 2 +- drivers/clocksource/arc_timer.c | 2 +- drivers/clocksource/arm_arch_timer.c | 2 +- drivers/clocksource/arm_global_timer.c | 2 +- drivers/clocksource/dummy_timer.c | 2 +- drivers/clocksource/exynos_mct.c | 2 +- drivers/clocksource/jcore-pit.c | 2 +- drivers/clocksource/metag_generic.c | 2 +- drivers/clocksource/mips-gic-timer.c | 4 ++-- drivers/clocksource/qcom-timer.c | 2 +- drivers/clocksource/time-armada-370-xp.c | 2 +- drivers/clocksource/timer-atlas7.c | 2 +- drivers/hwtracing/coresight/coresight-etm3x.c | 4 ++-- drivers/hwtracing/coresight/coresight-etm4x.c | 4 ++-- drivers/irqchip/irq-armada-370-xp.c | 4 ++-- drivers/irqchip/irq-bcm2836.c | 2 +- drivers/irqchip/irq-gic-v3.c | 4 ++-- drivers/irqchip/irq-gic.c | 2 +- drivers/irqchip/irq-hip04.c | 2 +- drivers/leds/trigger/ledtrig-cpu.c | 2 +- drivers/net/virtio_net.c | 4 ++-- drivers/perf/arm_pmu.c | 2 +- drivers/xen/events/events_fifo.c | 2 +- virt/kvm/arm/arch_timer.c | 2 +- virt/kvm/arm/vgic/vgic-init.c | 2 +- virt/kvm/kvm_main.c | 2 +- 59 files changed, 77 insertions(+), 77 deletions(-)
arch/arm/kernel/smp_twd.c +1 -1
@@ -339,7 +339,7 @@ static int __init twd_local_timer_common_register(struct device_node *np) }cpuhp_setup_state_nocalls (CPUHP_AP_ARM_TWD_STARTING , -"AP_ARM_TWD_STARTING" , +"arm/timer/twd:starting" , twd_timer_starting_cpu, twd_timer_dying_cpu);twd_get_clock (np);
arch/arm/mach-mvebu/coherency.c +1 -1
@@ -148,7 +148,7 @@ static void __init armada_370_coherency_init(struct device_node *np)of_node_put (cpu_config_np);cpuhp_setup_state_nocalls (CPUHP_AP_ARM_MVEBU_COHERENCY , -"AP_ARM_MVEBU_COHERENCY" , +"arm/mvebu/coherency:starting" , armada_xp_clear_l2_starting,NULL ); exit:set_cpu_coherent ();
arch/arm/mm/cache-l2x0-pmu.c +1 -1
@@ -563,7 +563,7 @@ static __init int l2x0_pmu_init(void)cpumask_set_cpu (0 , &pmu_cpu); ret =cpuhp_setup_state_nocalls (CPUHP_AP_PERF_ARM_L2X0_ONLINE , -"AP_PERF_ARM_L2X0_ONLINE" ,NULL , +"perf/arm/l2x0:online" ,NULL , l2x0_pmu_offline_cpu);if (ret) goto out_pmu;
arch/arm/mm/cache-l2x0.c +1 -1
@@ -683,7 +683,7 @@ static void __init l2c310_enable(void __iomem *base, unsigned num_lock)if (aux &L310_AUX_CTRL_FULL_LINE_ZERO )cpuhp_setup_state (CPUHP_AP_ARM_L2X0_STARTING , -"AP_ARM_L2X0_STARTING" , l2c310_starting_cpu, +"arm/l2x0:starting" , l2c310_starting_cpu, l2c310_dying_cpu); }
arch/arm/vfp/vfpmodule.c +1 -1
@@ -799,7 +799,7 @@ static int __init vfp_init(void) }cpuhp_setup_state_nocalls (CPUHP_AP_ARM_VFP_STARTING , -"AP_ARM_VFP_STARTING" , vfp_starting_cpu, +"arm/vfp:starting" , vfp_starting_cpu, vfp_dying_cpu); vfp_vector = vfp_support_entry;
arch/arm/xen/enlighten.c +1 -1
@@ -412,7 +412,7 @@ static int __init xen_guest_init(void)pvclock_gtod_register_notifier (&xen_pvclock_gtod_notifier);return cpuhp_setup_state (CPUHP_AP_ARM_XEN_STARTING , -"AP_ARM_XEN_STARTING" , xen_starting_cpu, +"arm/xen:starting" , xen_starting_cpu, xen_dying_cpu); }early_initcall (xen_guest_init);
arch/arm64/kernel/armv8_deprecated.c +1 -1
@@ -640,7 +640,7 @@ static int __init armv8_deprecated_init(void) }cpuhp_setup_state_nocalls (CPUHP_AP_ARM64_ISNDEP_STARTING , -"AP_ARM64_ISNDEP_STARTING" , +"arm64/isndep:starting" , run_all_insn_set_hw_mode,NULL );register_insn_emulation_sysctl (ctl_abi);
arch/arm64/kernel/debug-monitors.c +1 -1
@@ -140,7 +140,7 @@ static int clear_os_lock(unsigned int cpu)static int debug_monitors_init (void ) {return cpuhp_setup_state (CPUHP_AP_ARM64_DEBUG_MONITORS_STARTING , -"CPUHP_AP_ARM64_DEBUG_MONITORS_STARTING" , +"arm64/debug_monitors:starting" , clear_os_lock,NULL ); }postcore_initcall (debug_monitors_init);
arch/arm64/kernel/hw_breakpoint.c +1 -1
@@ -1001,7 +1001,7 @@ static int __init arch_hw_breakpoint_init(void)* debugger will leave the world in a nice state for us. */ ret =cpuhp_setup_state (CPUHP_AP_PERF_ARM_HW_BREAKPOINT_STARTING , -"CPUHP_AP_PERF_ARM_HW_BREAKPOINT_STARTING" , +"perf/arm64/hw_breakpoint:starting" , hw_breakpoint_reset,NULL );if (ret)pr_err ("failed to register CPU hotplug notifier: %d\n" , ret);
arch/blackfin/kernel/perf_event.c +1 -1
@@ -475,7 +475,7 @@ static int __init bfin_pmu_init(void) ret =perf_pmu_register (&pmu,"cpu" ,PERF_TYPE_RAW );if (!ret) -cpuhp_setup_state (CPUHP_PERF_BFIN ,"PERF_BFIN" , +cpuhp_setup_state (CPUHP_PERF_BFIN ,"perf/bfin:starting" , bfin_pmu_prepare_cpu,NULL );return ret; }
arch/metag/kernel/perf/perf_event.c +1 -1
@@ -868,7 +868,7 @@ static int __init init_hw_perf_events(void)metag_out32 (0 ,PERF_COUNT (1 ));cpuhp_setup_state (CPUHP_AP_PERF_METAG_STARTING , -"AP_PERF_METAG_STARTING" , metag_pmu_starting_cpu, +"perf/metag:starting" , metag_pmu_starting_cpu,NULL ); ret =perf_pmu_register (&pmu, metag_pmu->name,PERF_TYPE_RAW );
arch/mips/kernel/pm-cps.c +1 -1
@@ -713,7 +713,7 @@ static int __init cps_pm_init(void)pr_warn ("pm-cps: no CPC, clock & power gating unavailable\n" ); } -return cpuhp_setup_state (CPUHP_AP_ONLINE_DYN ,"AP_PM_CPS_CPU_ONLINE" , +return cpuhp_setup_state (CPUHP_AP_ONLINE_DYN ,"mips/cps_pm:online" , cps_pm_online_cpu,NULL ); }arch_initcall (cps_pm_init);
arch/mips/oprofile/op_model_loongson3.c +1 -1
@@ -186,7 +186,7 @@ static int __init loongson3_init(void) {on_each_cpu (reset_counters,NULL ,1 );cpuhp_setup_state_nocalls (CPUHP_AP_MIPS_OP_LOONGSON3_STARTING , -"AP_MIPS_OP_LOONGSON3_STARTING" , +"mips/oprofile/loongson3:starting" , loongson3_starting_cpu, loongson3_dying_cpu); save_perf_irq = perf_irq; perf_irq = loongson3_perfcount_handler;
arch/powerpc/mm/numa.c +1 -1
@@ -944,7 +944,7 @@ void __init initmem_init(void)* _nocalls() + manual invocation is used because cpuhp is not yet * initialized for the boot CPU. */ -cpuhp_setup_state_nocalls (CPUHP_POWER_NUMA_PREPARE ,"POWER_NUMA_PREPARE" , +cpuhp_setup_state_nocalls (CPUHP_POWER_NUMA_PREPARE ,"powerpc/numa:prepare" , ppc_numa_cpu_prepare, ppc_numa_cpu_dead);for_each_present_cpu (cpu)numa_setup_cpu (cpu);
arch/powerpc/perf/core-book3s.c +1 -1
@@ -2189,7 +2189,7 @@ int register_power_pmu(struct power_pmu *pmu)#endif /* CONFIG_PPC64 */ perf_pmu_register (&power_pmu,"cpu" ,PERF_TYPE_RAW ); -cpuhp_setup_state (CPUHP_PERF_POWER ,"PERF_POWER" , +cpuhp_setup_state (CPUHP_PERF_POWER ,"perf/powerpc:prepare" , power_pmu_prepare_cpu,NULL );return 0 ; }
arch/s390/kernel/perf_cpum_cf.c +1 -1
@@ -711,7 +711,7 @@ static int __init cpumf_pmu_init(void)return rc; }return cpuhp_setup_state (CPUHP_AP_PERF_S390_CF_ONLINE , -"AP_PERF_S390_CF_ONLINE" , +"perf/s390/cf:online" , s390_pmu_online_cpu, s390_pmu_offline_cpu); }early_initcall (cpumf_pmu_init);
arch/s390/kernel/perf_cpum_sf.c +1 -1
@@ -1623,7 +1623,7 @@ static int __init init_cpum_sampling_pmu(void) goto out; } -cpuhp_setup_state (CPUHP_AP_PERF_S390_SF_ONLINE ,"AP_PERF_S390_SF_ONLINE" , +cpuhp_setup_state (CPUHP_AP_PERF_S390_SF_ONLINE ,"perf/s390/sf:online" , s390_pmu_sf_online_cpu, s390_pmu_sf_offline_cpu); out:return err;
arch/x86/entry/vdso/vma.c +1 -1
@@ -371,7 +371,7 @@ static int __init init_vdso(void)/* notifier priority > KVM */ return cpuhp_setup_state (CPUHP_AP_X86_VDSO_VMA_ONLINE , - "AP_X86_VDSO_VMA_ONLINE", vgetcpu_online, NULL); + "x86/vdso/vma:online", vgetcpu_online, NULL); }subsys_initcall (init_vdso);#endif /* CONFIG_X86_64 */
arch/x86/events/amd/ibs.c +1 -1
@@ -1010,7 +1010,7 @@ static __init int amd_ibs_init(void)* all online cpus. */ cpuhp_setup_state (CPUHP_AP_PERF_X86_AMD_IBS_STARTING , -"AP_PERF_X86_AMD_IBS_STARTING" , +"perf/x86/amd/ibs:STARTING" , x86_pmu_amd_ibs_starting_cpu, x86_pmu_amd_ibs_dying_cpu);
arch/x86/events/amd/power.c +1 -1
@@ -291,7 +291,7 @@ static int __init amd_power_pmu_init(void)cpuhp_setup_state (CPUHP_AP_PERF_X86_AMD_POWER_ONLINE , -"AP_PERF_X86_AMD_POWER_ONLINE" , +"perf/x86/amd/power:online" , power_cpu_init, power_cpu_exit); ret =perf_pmu_register (&pmu_class,"power" ,-1 );
arch/x86/events/amd/uncore.c +3 -3
@@ -527,16 +527,16 @@ static int __init amd_uncore_init(void)* Install callbacks. Core will call them for each online cpu. */ if (cpuhp_setup_state (CPUHP_PERF_X86_AMD_UNCORE_PREP , -"PERF_X86_AMD_UNCORE_PREP" , +"perf/x86/amd/uncore:prepare" , amd_uncore_cpu_up_prepare, amd_uncore_cpu_dead)) goto fail_l2;if (cpuhp_setup_state (CPUHP_AP_PERF_X86_AMD_UNCORE_STARTING , -"AP_PERF_X86_AMD_UNCORE_STARTING" , +"perf/x86/amd/uncore:starting" , amd_uncore_cpu_starting,NULL )) goto fail_prep;if (cpuhp_setup_state (CPUHP_AP_PERF_X86_AMD_UNCORE_ONLINE , -"AP_PERF_X86_AMD_UNCORE_ONLINE" , +"perf/x86/amd/uncore:online" , amd_uncore_cpu_online, amd_uncore_cpu_down_prepare)) goto fail_start;
arch/x86/events/core.c +3 -3
@@ -1820,18 +1820,18 @@ static int __init init_hw_perf_events(void)* Install callbacks. Core will call them for each online * cpu. */ - err =cpuhp_setup_state (CPUHP_PERF_X86_PREPARE ,"PERF_X86_PREPARE" , + err =cpuhp_setup_state (CPUHP_PERF_X86_PREPARE ,"perf/x86:prepare" , x86_pmu_prepare_cpu, x86_pmu_dead_cpu);if (err)return err; err =cpuhp_setup_state (CPUHP_AP_PERF_X86_STARTING , -"AP_PERF_X86_STARTING" , x86_pmu_starting_cpu, +"perf/x86:starting" , x86_pmu_starting_cpu, x86_pmu_dying_cpu);if (err) goto out; - err =cpuhp_setup_state (CPUHP_AP_PERF_X86_ONLINE ,"AP_PERF_X86_ONLINE" , + err =cpuhp_setup_state (CPUHP_AP_PERF_X86_ONLINE ,"perf/x86:online" , x86_pmu_online_cpu,NULL );if (err) goto out1;
arch/x86/events/intel/cqm.c +2 -2
@@ -1766,9 +1766,9 @@ static int __init intel_cqm_init(void)* is enabled to avoid notifier leak. */ cpuhp_setup_state (CPUHP_AP_PERF_X86_CQM_STARTING , -"AP_PERF_X86_CQM_STARTING" , +"perf/x86/cqm:starting" , intel_cqm_cpu_starting,NULL ); -cpuhp_setup_state (CPUHP_AP_PERF_X86_CQM_ONLINE ,"AP_PERF_X86_CQM_ONLINE" , +cpuhp_setup_state (CPUHP_AP_PERF_X86_CQM_ONLINE ,"perf/x86/cqm:online" ,NULL , intel_cqm_cpu_exit); out:
arch/x86/events/intel/rapl.c +2 -2
@@ -803,13 +803,13 @@ static int __init rapl_pmu_init(void)* Install callbacks. Core will call them for each online cpu. */ - ret =cpuhp_setup_state (CPUHP_PERF_X86_RAPL_PREP ,"PERF_X86_RAPL_PREP" , + ret =cpuhp_setup_state (CPUHP_PERF_X86_RAPL_PREP ,"perf/x86/rapl:prepare" , rapl_cpu_prepare,NULL );if (ret) goto out; ret =cpuhp_setup_state (CPUHP_AP_PERF_X86_RAPL_ONLINE , -"AP_PERF_X86_RAPL_ONLINE" , +"perf/x86/rapl:online" , rapl_cpu_online, rapl_cpu_offline);if (ret) goto out1;
arch/x86/events/intel/uncore.c +5 -5
@@ -1398,22 +1398,22 @@ static int __init intel_uncore_init(void)*/ if (!cret) { ret =cpuhp_setup_state (CPUHP_PERF_X86_UNCORE_PREP , -"PERF_X86_UNCORE_PREP" , - uncore_cpu_prepare,NULL ); +"perf/x86/intel/uncore:prepare" , + uncore_cpu_prepare,NULL );if (ret) goto err; }else {cpuhp_setup_state_nocalls (CPUHP_PERF_X86_UNCORE_PREP , -"PERF_X86_UNCORE_PREP" , +"perf/x86/intel/uncore:prepare" , uncore_cpu_prepare,NULL ); } first_init =1 ;cpuhp_setup_state (CPUHP_AP_PERF_X86_UNCORE_STARTING , -"AP_PERF_X86_UNCORE_STARTING" , +"perf/x86/uncore:starting" , uncore_cpu_starting, uncore_cpu_dying); first_init =0 ;cpuhp_setup_state (CPUHP_AP_PERF_X86_UNCORE_ONLINE , -"AP_PERF_X86_UNCORE_ONLINE" , +"perf/x86/uncore:online" , uncore_event_cpu_online, uncore_event_cpu_offline);return 0 ;
arch/x86/kernel/apb_timer.c +1 -1
@@ -234,7 +234,7 @@ static __init int apbt_late_init(void)if (intel_mid_timer_options ==INTEL_MID_TIMER_LAPIC_APBT || !apb_timer_block_enabled)return 0 ; -return cpuhp_setup_state (CPUHP_X86_APB_DEAD ,"X86_APB_DEAD" ,NULL , +return cpuhp_setup_state (CPUHP_X86_APB_DEAD ,"x86/apb:dead" ,NULL , apbt_cpu_dead); }fs_initcall (apbt_late_init);
arch/x86/kernel/apic/x2apic_cluster.c +1 -1
@@ -191,7 +191,7 @@ static int x2apic_cluster_probe(void)if (!x2apic_mode)return 0 ; - ret =cpuhp_setup_state (CPUHP_X2APIC_PREPARE ,"X2APIC_PREPARE" , + ret =cpuhp_setup_state (CPUHP_X2APIC_PREPARE ,"x86/x2apic:prepare" , x2apic_prepare_cpu, x2apic_dead_cpu);if (ret <0 ) {pr_err ("Failed to register X2APIC_PREPARE\n" );
arch/x86/kernel/hpet.c +2 -2
@@ -1051,11 +1051,11 @@ static __init int hpet_late_init(void)return 0 ;/* This notifier should be called after workqueue is ready */ - ret =cpuhp_setup_state (CPUHP_AP_X86_HPET_ONLINE ,"AP_X86_HPET_ONLINE" , + ret =cpuhp_setup_state (CPUHP_AP_X86_HPET_ONLINE ,"x86/hpet:online" , hpet_cpuhp_online,NULL );if (ret)return ret; - ret =cpuhp_setup_state (CPUHP_X86_HPET_DEAD ,"X86_HPET_DEAD" ,NULL , + ret =cpuhp_setup_state (CPUHP_X86_HPET_DEAD ,"x86/hpet:dead" ,NULL , hpet_cpuhp_dead);if (ret) goto err_cpuhp;
arch/x86/kernel/tboot.c +1 -1
@@ -408,7 +408,7 @@ static __init int tboot_late_init(void)tboot_create_trampoline ();atomic_set (&ap_wfs_count,0 ); -cpuhp_setup_state (CPUHP_AP_X86_TBOOT_DYING ,"AP_X86_TBOOT_DYING" ,NULL , +cpuhp_setup_state (CPUHP_AP_X86_TBOOT_DYING ,"x86/tboot:dying" ,NULL , tboot_dying_cpu);#ifdef CONFIG_DEBUG_FS debugfs_create_file("tboot_log", S_IRUSR,
arch/x86/kvm/x86.c +1 -1
@@ -5838,7 +5838,7 @@ static void kvm_timer_init(void) }pr_debug ("kvm: max_tsc_khz = %ld\n" , max_tsc_khz); -cpuhp_setup_state (CPUHP_AP_X86_KVM_CLK_ONLINE ,"AP_X86_KVM_CLK_ONLINE" , +cpuhp_setup_state (CPUHP_AP_X86_KVM_CLK_ONLINE ,"x86/kvm/clk:online" , kvmclock_cpu_online, kvmclock_cpu_down_prep); }
arch/x86/xen/enlighten.c +2 -2
@@ -1529,11 +1529,11 @@ static int xen_cpuhp_setup(void)int rc; rc =cpuhp_setup_state_nocalls (CPUHP_XEN_PREPARE , -"XEN_HVM_GUEST_PREPARE" , +"x86/xen/hvm_guest:prepare" , xen_cpu_up_prepare, xen_cpu_dead);if (rc >=0 ) { rc =cpuhp_setup_state_nocalls (CPUHP_AP_ONLINE_DYN , -"XEN_HVM_GUEST_ONLINE" , +"x86/xen/hvm_guest:online" , xen_cpu_up_online,NULL );if (rc <0 )cpuhp_remove_state_nocalls (CPUHP_XEN_PREPARE );
arch/xtensa/kernel/perf_event.c +1 -1
@@ -422,7 +422,7 @@ static int __init xtensa_pmu_init(void)int irq =irq_create_mapping (NULL ,XCHAL_PROFILING_INTERRUPT ); ret =cpuhp_setup_state (CPUHP_AP_PERF_XTENSA_STARTING , -"AP_PERF_XTENSA_STARTING" , xtensa_pmu_setup, +"perf/xtensa:starting" , xtensa_pmu_setup,NULL );if (ret) {pr_err ("xtensa_pmu: failed to register CPU-hotplug.\n" );
drivers/bus/arm-cci.c +1 -1
@@ -1796,7 +1796,7 @@ static int __init cci_platform_init(void)int ret; ret =cpuhp_setup_state_multi (CPUHP_AP_PERF_ARM_CCI_ONLINE , -"AP_PERF_ARM_CCI_ONLINE" ,NULL , +"perf/arm/cci:online" ,NULL , cci_pmu_offline_cpu);if (ret)return ret;
drivers/bus/arm-ccn.c +1 -1
@@ -1562,7 +1562,7 @@ static int __init arm_ccn_init(void)int i, ret; ret =cpuhp_setup_state_multi (CPUHP_AP_PERF_ARM_CCN_ONLINE , -"AP_PERF_ARM_CCN_ONLINE" ,NULL , +"perf/arm/ccn:online" ,NULL , arm_ccn_pmu_offline_cpu);if (ret)return ret;
drivers/clocksource/arc_timer.c +1 -1
@@ -309,7 +309,7 @@ static int __init arc_clockevent_setup(struct device_node *node) } ret =cpuhp_setup_state (CPUHP_AP_ARC_TIMER_STARTING , -"AP_ARC_TIMER_STARTING" , +"clockevents/arc/timer:starting" , arc_timer_starting_cpu, arc_timer_dying_cpu);if (ret) {
drivers/clocksource/arm_arch_timer.c +1 -1
@@ -738,7 +738,7 @@ static int __init arch_timer_register(void)/* Register and immediately configure the timer on the boot CPU */ err =cpuhp_setup_state (CPUHP_AP_ARM_ARCH_TIMER_STARTING , -"AP_ARM_ARCH_TIMER_STARTING" , +"clockevents/arm/arch_timer:starting" , arch_timer_starting_cpu, arch_timer_dying_cpu);if (err) goto out_unreg_cpupm;
drivers/clocksource/arm_global_timer.c +1 -1
@@ -316,7 +316,7 @@ static int __init global_timer_of_register(struct device_node *np) goto out_irq; err =cpuhp_setup_state (CPUHP_AP_ARM_GLOBAL_TIMER_STARTING , -"AP_ARM_GLOBAL_TIMER_STARTING" , +"clockevents/arm/global_timer:starting" , gt_starting_cpu, gt_dying_cpu);if (err) goto out_irq;
drivers/clocksource/dummy_timer.c +1 -1
@@ -34,7 +34,7 @@ static int dummy_timer_starting_cpu(unsigned int cpu)static int __init dummy_timer_register (void ) {return cpuhp_setup_state (CPUHP_AP_DUMMY_TIMER_STARTING , -"AP_DUMMY_TIMER_STARTING" , +"clockevents/dummy_timer:starting" , dummy_timer_starting_cpu,NULL ); }early_initcall (dummy_timer_register);
drivers/clocksource/exynos_mct.c +1 -1
@@ -552,7 +552,7 @@ static int __init exynos4_timer_resources(struct device_node *np, void __iomem */* Install hotplug callbacks which configure the timer on this CPU */ err =cpuhp_setup_state (CPUHP_AP_EXYNOS4_MCT_TIMER_STARTING , -"AP_EXYNOS4_MCT_TIMER_STARTING" , +"clockevents/exynos4/mct_timer:starting" , exynos4_mct_starting_cpu, exynos4_mct_dying_cpu);if (err)
drivers/clocksource/jcore-pit.c +1 -1
@@ -240,7 +240,7 @@ static int __init jcore_pit_init(struct device_node *node) }cpuhp_setup_state (CPUHP_AP_JCORE_TIMER_STARTING , -"AP_JCORE_TIMER_STARTING" , +"clockevents/jcore:starting" , jcore_pit_local_init,NULL );return 0 ;
drivers/clocksource/metag_generic.c +1 -1
@@ -154,6 +154,6 @@ int __init metag_generic_timer_init(void)/* Hook cpu boot to configure the CPU's timers */ return cpuhp_setup_state (CPUHP_AP_METAG_TIMER_STARTING , -"AP_METAG_TIMER_STARTING" , +"clockevents/metag:starting" , arch_timer_starting_cpu,NULL ); }
drivers/clocksource/mips-gic-timer.c +2 -2
@@ -120,8 +120,8 @@ static int gic_clockevent_init(void) }cpuhp_setup_state (CPUHP_AP_MIPS_GIC_TIMER_STARTING , -"AP_MIPS_GIC_TIMER_STARTING" , gic_starting_cpu, - gic_dying_cpu); +"clockevents/mips/gic/timer:starting" , + gic_starting_cpu, gic_dying_cpu);return 0 ; }
drivers/clocksource/qcom-timer.c +1 -1
@@ -182,7 +182,7 @@ static int __init msm_timer_init(u32 dgt_hz, int sched_bits, int irq, }else {/* Install and invoke hotplug callbacks */ res =cpuhp_setup_state (CPUHP_AP_QCOM_TIMER_STARTING , -"AP_QCOM_TIMER_STARTING" , +"clockevents/qcom/timer:starting" , msm_local_timer_starting_cpu, msm_local_timer_dying_cpu);if (res) {
drivers/clocksource/time-armada-370-xp.c +1 -1
@@ -320,7 +320,7 @@ static int __init armada_370_xp_timer_common_init(struct device_node *np) } res =cpuhp_setup_state (CPUHP_AP_ARMADA_TIMER_STARTING , -"AP_ARMADA_TIMER_STARTING" , +"clockevents/armada:starting" , armada_370_xp_timer_starting_cpu, armada_370_xp_timer_dying_cpu);if (res) {
drivers/clocksource/timer-atlas7.c +1 -1
@@ -221,7 +221,7 @@ static int __init sirfsoc_clockevent_init(void)/* Install and invoke hotplug callbacks */ return cpuhp_setup_state (CPUHP_AP_MARCO_TIMER_STARTING , -"AP_MARCO_TIMER_STARTING" , +"clockevents/marco:starting" , sirfsoc_local_timer_starting_cpu, sirfsoc_local_timer_dying_cpu); }
drivers/hwtracing/coresight/coresight-etm3x.c +2 -2
@@ -804,10 +804,10 @@ static int etm_probe(struct amba_device *adev, const struct amba_id *id)if (!etm_count++) {cpuhp_setup_state_nocalls (CPUHP_AP_ARM_CORESIGHT_STARTING , -"AP_ARM_CORESIGHT_STARTING" , +"arm/coresight:starting" , etm_starting_cpu, etm_dying_cpu); ret =cpuhp_setup_state_nocalls (CPUHP_AP_ONLINE_DYN , -"AP_ARM_CORESIGHT_ONLINE" , +"arm/coresight:online" , etm_online_cpu,NULL );if (ret <0 ) goto err_arch_supported;
drivers/hwtracing/coresight/coresight-etm4x.c +2 -2
@@ -987,10 +987,10 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id)if (!etm4_count++) {cpuhp_setup_state_nocalls (CPUHP_AP_ARM_CORESIGHT4_STARTING , -"AP_ARM_CORESIGHT4_STARTING" , +"arm/coresight4:starting" , etm4_starting_cpu, etm4_dying_cpu); ret =cpuhp_setup_state_nocalls (CPUHP_AP_ONLINE_DYN , -"AP_ARM_CORESIGHT4_ONLINE" , +"arm/coresight4:online" , etm4_online_cpu,NULL );if (ret <0 ) goto err_arch_supported;
drivers/irqchip/irq-armada-370-xp.c +2 -2
@@ -578,13 +578,13 @@ static int __init armada_370_xp_mpic_of_init(struct device_node *node,#ifdef CONFIG_SMP set_smp_cross_call (armada_mpic_send_doorbell);cpuhp_setup_state_nocalls (CPUHP_AP_IRQ_ARMADA_XP_STARTING , -"AP_IRQ_ARMADA_XP_STARTING" , +"irqchip/armada/ipi:starting" , armada_xp_mpic_starting_cpu,NULL );#endif }else {#ifdef CONFIG_SMP cpuhp_setup_state_nocalls (CPUHP_AP_IRQ_ARMADA_CASC_STARTING , -"AP_IRQ_ARMADA_CASC_STARTING" , +"irqchip/armada/cascade:starting" , mpic_cascaded_starting_cpu,NULL );#endif irq_set_chained_handler(parent_irq,
drivers/irqchip/irq-bcm2836.c +1 -1
@@ -245,7 +245,7 @@ bcm2836_arm_irqchip_smp_init(void)#ifdef CONFIG_SMP /* Unmask IPIs to the boot CPU. */ cpuhp_setup_state (CPUHP_AP_IRQ_BCM2836_STARTING , -"AP_IRQ_BCM2836_STARTING" , bcm2836_cpu_starting, +"irqchip/bcm2836:starting" , bcm2836_cpu_starting, bcm2836_cpu_dying);set_smp_cross_call (bcm2836_arm_irqchip_send_ipi);
drivers/irqchip/irq-gic-v3.c +2 -2
@@ -633,8 +633,8 @@ static void gic_smp_init(void) {set_smp_cross_call (gic_raise_softirq);cpuhp_setup_state_nocalls (CPUHP_AP_IRQ_GICV3_STARTING , -"AP_IRQ_GICV3_STARTING" , gic_starting_cpu, -NULL ); +"irqchip/arm/gicv3:starting" , + gic_starting_cpu,NULL ); } static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val,
drivers/irqchip/irq-gic.c +1 -1
@@ -1191,7 +1191,7 @@ static int __init __gic_init_bases(struct gic_chip_data *gic,set_smp_cross_call (gic_raise_softirq);#endif cpuhp_setup_state_nocalls (CPUHP_AP_IRQ_GIC_STARTING , -"AP_IRQ_GIC_STARTING" , +"irqchip/arm/gic:starting" , gic_starting_cpu,NULL );set_handle_irq (gic_handle_irq);if (static_key_true (&supports_deactivate))
drivers/irqchip/irq-hip04.c +1 -1
@@ -407,7 +407,7 @@ hip04_of_init(struct device_node *node, struct device_node *parent)set_handle_irq (hip04_handle_irq);hip04_irq_dist_init (&hip04_data); -cpuhp_setup_state (CPUHP_AP_IRQ_HIP04_STARTING ,"AP_IRQ_HIP04_STARTING" , +cpuhp_setup_state (CPUHP_AP_IRQ_HIP04_STARTING ,"irqchip/hip04:starting" , hip04_irq_starting_cpu,NULL );return 0 ; }
drivers/leds/trigger/ledtrig-cpu.c +1 -1
@@ -127,7 +127,7 @@ static int __init ledtrig_cpu_init(void)register_syscore_ops (&ledtrig_cpu_syscore_ops); - ret =cpuhp_setup_state (CPUHP_AP_ONLINE_DYN ,"AP_LEDTRIG_STARTING" , + ret =cpuhp_setup_state (CPUHP_AP_ONLINE_DYN ,"leds/trigger:starting" , ledtrig_online_cpu, ledtrig_prepare_down_cpu);if (ret <0 ) pr_err("CPU hotplug notifier for ledtrig-cpu could not be registered: %d\n",
drivers/net/virtio_net.c +2 -2
@@ -2452,13 +2452,13 @@ static __init int virtio_net_driver_init(void) {int ret; - ret =cpuhp_setup_state_multi (CPUHP_AP_ONLINE_DYN ,"AP_VIRT_NET_ONLINE" , + ret =cpuhp_setup_state_multi (CPUHP_AP_ONLINE_DYN ,"virtio/net:online" , virtnet_cpu_online, virtnet_cpu_down_prep);if (ret <0 ) goto out; virtionet_online = ret; - ret =cpuhp_setup_state_multi (CPUHP_VIRT_NET_DEAD ,"VIRT_NET_DEAD" , + ret =cpuhp_setup_state_multi (CPUHP_VIRT_NET_DEAD ,"virtio/net:dead" ,NULL , virtnet_cpu_dead);if (ret) goto err_dead;
drivers/perf/arm_pmu.c +1 -1
@@ -1084,7 +1084,7 @@ static int arm_pmu_hp_init(void)int ret; ret =cpuhp_setup_state_multi (CPUHP_AP_PERF_ARM_STARTING , -"AP_PERF_ARM_STARTING" , +"perf/arm/pmu:starting" , arm_perf_starting_cpu,NULL );if (ret) pr_err("CPU hotplug notifier for ARM PMU could not be registered: %d\n",
drivers/xen/events/events_fifo.c +1 -1
@@ -445,7 +445,7 @@ int __init xen_evtchn_fifo_init(void) evtchn_ops = &evtchn_ops_fifo;cpuhp_setup_state_nocalls (CPUHP_XEN_EVTCHN_PREPARE , -"CPUHP_XEN_EVTCHN_PREPARE" , +"xen/evtchn:prepare" , xen_evtchn_cpu_prepare, xen_evtchn_cpu_dead); out:put_cpu ();
virt/kvm/arm/arch_timer.c +1 -1
@@ -456,7 +456,7 @@ int kvm_timer_hyp_init(void)kvm_info ("virtual timer IRQ%d\n" , host_vtimer_irq);cpuhp_setup_state (CPUHP_AP_KVM_ARM_TIMER_STARTING , -"AP_KVM_ARM_TIMER_STARTING" , kvm_timer_starting_cpu, +"kvm/arm/timer:starting" , kvm_timer_starting_cpu, kvm_timer_dying_cpu);return err; }
virt/kvm/arm/vgic/vgic-init.c +1 -1
@@ -428,7 +428,7 @@ int kvm_vgic_hyp_init(void) } ret =cpuhp_setup_state (CPUHP_AP_KVM_ARM_VGIC_INIT_STARTING , -"AP_KVM_ARM_VGIC_INIT_STARTING" , +"kvm/arm/vgic:starting" , vgic_init_cpu_starting, vgic_init_cpu_dying);if (ret) {kvm_err ("Cannot register vgic CPU notifier\n" );
virt/kvm/kvm_main.c +1 -1
@@ -3944,7 +3944,7 @@ int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align, goto out_free_1; } - r =cpuhp_setup_state_nocalls (CPUHP_AP_KVM_STARTING ,"AP_KVM_STARTING" , + r =cpuhp_setup_state_nocalls (CPUHP_AP_KVM_STARTING ,"kvm/cpu:starting" , kvm_starting_cpu, kvm_dying_cpu);if (r) goto out_free_2;
tip-bot for Thomas Gleixner
merge bot[tip:smp/urgent] cpu/hotplug: Cleanup state names
In reply to Thomas Gleixnercpu/hotplug: Cleanup state names
Commit-ID: 73c1b41e63f040e92669e61a02c7893933bfe743 Gitweb: http://git.kernel.org/tip/73c1b41e63f040e92669e61a02c7893933bfe743 Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 21 Dec 2016 20:19:54 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Sun, 25 Dec 2016 10:47:44 +0100
cpu/hotplug: Cleanup state names
When the state names got added a script was used to add the extra argument to the calls. The script basically converted the state constant to a string, but the cleanup to convert these strings into meaningful ones did not happen.
Replace all the useless strings with 'subsys/xxx/yyy:state' strings which are used in all the other places already.
--- arch/arm/kernel/smp_twd.c | 2 +- arch/arm/mach-mvebu/coherency.c | 2 +- arch/arm/mm/cache-l2x0-pmu.c | 2 +- arch/arm/mm/cache-l2x0.c | 2 +- arch/arm/vfp/vfpmodule.c | 2 +- arch/arm/xen/enlighten.c | 2 +- arch/arm64/kernel/armv8_deprecated.c | 2 +- arch/arm64/kernel/debug-monitors.c | 2 +- arch/arm64/kernel/hw_breakpoint.c | 2 +- arch/blackfin/kernel/perf_event.c | 2 +- arch/metag/kernel/perf/perf_event.c | 2 +- arch/mips/kernel/pm-cps.c | 2 +- arch/mips/oprofile/op_model_loongson3.c | 2 +- arch/powerpc/mm/numa.c | 2 +- arch/powerpc/perf/core-book3s.c | 2 +- arch/s390/kernel/perf_cpum_cf.c | 2 +- arch/s390/kernel/perf_cpum_sf.c | 2 +- arch/x86/entry/vdso/vma.c | 2 +- arch/x86/events/amd/ibs.c | 2 +- arch/x86/events/amd/power.c | 2 +- arch/x86/events/amd/uncore.c | 6 +++--- arch/x86/events/core.c | 6 +++--- arch/x86/events/intel/cqm.c | 4 ++-- arch/x86/events/intel/rapl.c | 4 ++-- arch/x86/events/intel/uncore.c | 10 +++++----- arch/x86/kernel/apb_timer.c | 2 +- arch/x86/kernel/apic/x2apic_cluster.c | 2 +- arch/x86/kernel/hpet.c | 4 ++-- arch/x86/kernel/tboot.c | 2 +- arch/x86/kvm/x86.c | 2 +- arch/x86/xen/enlighten.c | 4 ++-- arch/xtensa/kernel/perf_event.c | 2 +- drivers/bus/arm-cci.c | 2 +- drivers/bus/arm-ccn.c | 2 +- drivers/clocksource/arc_timer.c | 2 +- drivers/clocksource/arm_arch_timer.c | 2 +- drivers/clocksource/arm_global_timer.c | 2 +- drivers/clocksource/dummy_timer.c | 2 +- drivers/clocksource/exynos_mct.c | 2 +- drivers/clocksource/jcore-pit.c | 2 +- drivers/clocksource/metag_generic.c | 2 +- drivers/clocksource/mips-gic-timer.c | 4 ++-- drivers/clocksource/qcom-timer.c | 2 +- drivers/clocksource/time-armada-370-xp.c | 2 +- drivers/clocksource/timer-atlas7.c | 2 +- drivers/hwtracing/coresight/coresight-etm3x.c | 4 ++-- drivers/hwtracing/coresight/coresight-etm4x.c | 4 ++-- drivers/irqchip/irq-armada-370-xp.c | 4 ++-- drivers/irqchip/irq-bcm2836.c | 2 +- drivers/irqchip/irq-gic-v3.c | 4 ++-- drivers/irqchip/irq-gic.c | 2 +- drivers/irqchip/irq-hip04.c | 2 +- drivers/leds/trigger/ledtrig-cpu.c | 2 +- drivers/net/virtio_net.c | 4 ++-- drivers/perf/arm_pmu.c | 2 +- drivers/xen/events/events_fifo.c | 2 +- virt/kvm/arm/arch_timer.c | 2 +- virt/kvm/arm/vgic/vgic-init.c | 2 +- virt/kvm/kvm_main.c | 2 +- 59 files changed, 77 insertions(+), 77 deletions(-)
arch/arm/kernel/smp_twd.c +1 -1
@@ -339,7 +339,7 @@ static int __init twd_local_timer_common_register(struct device_node *np) }cpuhp_setup_state_nocalls (CPUHP_AP_ARM_TWD_STARTING , -"AP_ARM_TWD_STARTING" , +"arm/timer/twd:starting" , twd_timer_starting_cpu, twd_timer_dying_cpu);twd_get_clock (np);
arch/arm/mach-mvebu/coherency.c +1 -1
@@ -148,7 +148,7 @@ static void __init armada_370_coherency_init(struct device_node *np)of_node_put (cpu_config_np);cpuhp_setup_state_nocalls (CPUHP_AP_ARM_MVEBU_COHERENCY , -"AP_ARM_MVEBU_COHERENCY" , +"arm/mvebu/coherency:starting" , armada_xp_clear_l2_starting,NULL ); exit:set_cpu_coherent ();
arch/arm/mm/cache-l2x0-pmu.c +1 -1
@@ -563,7 +563,7 @@ static __init int l2x0_pmu_init(void)cpumask_set_cpu (0 , &pmu_cpu); ret =cpuhp_setup_state_nocalls (CPUHP_AP_PERF_ARM_L2X0_ONLINE , -"AP_PERF_ARM_L2X0_ONLINE" ,NULL , +"perf/arm/l2x0:online" ,NULL , l2x0_pmu_offline_cpu);if (ret) goto out_pmu;
arch/arm/mm/cache-l2x0.c +1 -1
@@ -683,7 +683,7 @@ static void __init l2c310_enable(void __iomem *base, unsigned num_lock)if (aux &L310_AUX_CTRL_FULL_LINE_ZERO )cpuhp_setup_state (CPUHP_AP_ARM_L2X0_STARTING , -"AP_ARM_L2X0_STARTING" , l2c310_starting_cpu, +"arm/l2x0:starting" , l2c310_starting_cpu, l2c310_dying_cpu); }
arch/arm/vfp/vfpmodule.c +1 -1
@@ -799,7 +799,7 @@ static int __init vfp_init(void) }cpuhp_setup_state_nocalls (CPUHP_AP_ARM_VFP_STARTING , -"AP_ARM_VFP_STARTING" , vfp_starting_cpu, +"arm/vfp:starting" , vfp_starting_cpu, vfp_dying_cpu); vfp_vector = vfp_support_entry;
arch/arm/xen/enlighten.c +1 -1
@@ -412,7 +412,7 @@ static int __init xen_guest_init(void)pvclock_gtod_register_notifier (&xen_pvclock_gtod_notifier);return cpuhp_setup_state (CPUHP_AP_ARM_XEN_STARTING , -"AP_ARM_XEN_STARTING" , xen_starting_cpu, +"arm/xen:starting" , xen_starting_cpu, xen_dying_cpu); }early_initcall (xen_guest_init);
arch/arm64/kernel/armv8_deprecated.c +1 -1
@@ -640,7 +640,7 @@ static int __init armv8_deprecated_init(void) }cpuhp_setup_state_nocalls (CPUHP_AP_ARM64_ISNDEP_STARTING , -"AP_ARM64_ISNDEP_STARTING" , +"arm64/isndep:starting" , run_all_insn_set_hw_mode,NULL );register_insn_emulation_sysctl (ctl_abi);
arch/arm64/kernel/debug-monitors.c +1 -1
@@ -140,7 +140,7 @@ static int clear_os_lock(unsigned int cpu)static int debug_monitors_init (void ) {return cpuhp_setup_state (CPUHP_AP_ARM64_DEBUG_MONITORS_STARTING , -"CPUHP_AP_ARM64_DEBUG_MONITORS_STARTING" , +"arm64/debug_monitors:starting" , clear_os_lock,NULL ); }postcore_initcall (debug_monitors_init);
arch/arm64/kernel/hw_breakpoint.c +1 -1
@@ -1001,7 +1001,7 @@ static int __init arch_hw_breakpoint_init(void)* debugger will leave the world in a nice state for us. */ ret =cpuhp_setup_state (CPUHP_AP_PERF_ARM_HW_BREAKPOINT_STARTING , -"CPUHP_AP_PERF_ARM_HW_BREAKPOINT_STARTING" , +"perf/arm64/hw_breakpoint:starting" , hw_breakpoint_reset,NULL );if (ret)pr_err ("failed to register CPU hotplug notifier: %d\n" , ret);
arch/blackfin/kernel/perf_event.c +1 -1
@@ -475,7 +475,7 @@ static int __init bfin_pmu_init(void) ret =perf_pmu_register (&pmu,"cpu" ,PERF_TYPE_RAW );if (!ret) -cpuhp_setup_state (CPUHP_PERF_BFIN ,"PERF_BFIN" , +cpuhp_setup_state (CPUHP_PERF_BFIN ,"perf/bfin:starting" , bfin_pmu_prepare_cpu,NULL );return ret; }
arch/metag/kernel/perf/perf_event.c +1 -1
@@ -868,7 +868,7 @@ static int __init init_hw_perf_events(void)metag_out32 (0 ,PERF_COUNT (1 ));cpuhp_setup_state (CPUHP_AP_PERF_METAG_STARTING , -"AP_PERF_METAG_STARTING" , metag_pmu_starting_cpu, +"perf/metag:starting" , metag_pmu_starting_cpu,NULL ); ret =perf_pmu_register (&pmu, metag_pmu->name,PERF_TYPE_RAW );
arch/mips/kernel/pm-cps.c +1 -1
@@ -713,7 +713,7 @@ static int __init cps_pm_init(void)pr_warn ("pm-cps: no CPC, clock & power gating unavailable\n" ); } -return cpuhp_setup_state (CPUHP_AP_ONLINE_DYN ,"AP_PM_CPS_CPU_ONLINE" , +return cpuhp_setup_state (CPUHP_AP_ONLINE_DYN ,"mips/cps_pm:online" , cps_pm_online_cpu,NULL ); }arch_initcall (cps_pm_init);
arch/mips/oprofile/op_model_loongson3.c +1 -1
@@ -186,7 +186,7 @@ static int __init loongson3_init(void) {on_each_cpu (reset_counters,NULL ,1 );cpuhp_setup_state_nocalls (CPUHP_AP_MIPS_OP_LOONGSON3_STARTING , -"AP_MIPS_OP_LOONGSON3_STARTING" , +"mips/oprofile/loongson3:starting" , loongson3_starting_cpu, loongson3_dying_cpu); save_perf_irq = perf_irq; perf_irq = loongson3_perfcount_handler;
arch/powerpc/mm/numa.c +1 -1
@@ -944,7 +944,7 @@ void __init initmem_init(void)* _nocalls() + manual invocation is used because cpuhp is not yet * initialized for the boot CPU. */ -cpuhp_setup_state_nocalls (CPUHP_POWER_NUMA_PREPARE ,"POWER_NUMA_PREPARE" , +cpuhp_setup_state_nocalls (CPUHP_POWER_NUMA_PREPARE ,"powerpc/numa:prepare" , ppc_numa_cpu_prepare, ppc_numa_cpu_dead);for_each_present_cpu (cpu)numa_setup_cpu (cpu);
arch/powerpc/perf/core-book3s.c +1 -1
@@ -2189,7 +2189,7 @@ int register_power_pmu(struct power_pmu *pmu)#endif /* CONFIG_PPC64 */ perf_pmu_register (&power_pmu,"cpu" ,PERF_TYPE_RAW ); -cpuhp_setup_state (CPUHP_PERF_POWER ,"PERF_POWER" , +cpuhp_setup_state (CPUHP_PERF_POWER ,"perf/powerpc:prepare" , power_pmu_prepare_cpu,NULL );return 0 ; }
arch/s390/kernel/perf_cpum_cf.c +1 -1
@@ -711,7 +711,7 @@ static int __init cpumf_pmu_init(void)return rc; }return cpuhp_setup_state (CPUHP_AP_PERF_S390_CF_ONLINE , -"AP_PERF_S390_CF_ONLINE" , +"perf/s390/cf:online" , s390_pmu_online_cpu, s390_pmu_offline_cpu); }early_initcall (cpumf_pmu_init);
arch/s390/kernel/perf_cpum_sf.c +1 -1
@@ -1623,7 +1623,7 @@ static int __init init_cpum_sampling_pmu(void) goto out; } -cpuhp_setup_state (CPUHP_AP_PERF_S390_SF_ONLINE ,"AP_PERF_S390_SF_ONLINE" , +cpuhp_setup_state (CPUHP_AP_PERF_S390_SF_ONLINE ,"perf/s390/sf:online" , s390_pmu_sf_online_cpu, s390_pmu_sf_offline_cpu); out:return err;
arch/x86/entry/vdso/vma.c +1 -1
@@ -371,7 +371,7 @@ static int __init init_vdso(void)/* notifier priority > KVM */ return cpuhp_setup_state (CPUHP_AP_X86_VDSO_VMA_ONLINE , - "AP_X86_VDSO_VMA_ONLINE", vgetcpu_online, NULL); + "x86/vdso/vma:online", vgetcpu_online, NULL); }subsys_initcall (init_vdso);#endif /* CONFIG_X86_64 */
arch/x86/events/amd/ibs.c +1 -1
@@ -1010,7 +1010,7 @@ static __init int amd_ibs_init(void)* all online cpus. */ cpuhp_setup_state (CPUHP_AP_PERF_X86_AMD_IBS_STARTING , -"AP_PERF_X86_AMD_IBS_STARTING" , +"perf/x86/amd/ibs:STARTING" , x86_pmu_amd_ibs_starting_cpu, x86_pmu_amd_ibs_dying_cpu);
arch/x86/events/amd/power.c +1 -1
@@ -291,7 +291,7 @@ static int __init amd_power_pmu_init(void)cpuhp_setup_state (CPUHP_AP_PERF_X86_AMD_POWER_ONLINE , -"AP_PERF_X86_AMD_POWER_ONLINE" , +"perf/x86/amd/power:online" , power_cpu_init, power_cpu_exit); ret =perf_pmu_register (&pmu_class,"power" ,-1 );
arch/x86/events/amd/uncore.c +3 -3
@@ -527,16 +527,16 @@ static int __init amd_uncore_init(void)* Install callbacks. Core will call them for each online cpu. */ if (cpuhp_setup_state (CPUHP_PERF_X86_AMD_UNCORE_PREP , -"PERF_X86_AMD_UNCORE_PREP" , +"perf/x86/amd/uncore:prepare" , amd_uncore_cpu_up_prepare, amd_uncore_cpu_dead)) goto fail_l2;if (cpuhp_setup_state (CPUHP_AP_PERF_X86_AMD_UNCORE_STARTING , -"AP_PERF_X86_AMD_UNCORE_STARTING" , +"perf/x86/amd/uncore:starting" , amd_uncore_cpu_starting,NULL )) goto fail_prep;if (cpuhp_setup_state (CPUHP_AP_PERF_X86_AMD_UNCORE_ONLINE , -"AP_PERF_X86_AMD_UNCORE_ONLINE" , +"perf/x86/amd/uncore:online" , amd_uncore_cpu_online, amd_uncore_cpu_down_prepare)) goto fail_start;
arch/x86/events/core.c +3 -3
@@ -1820,18 +1820,18 @@ static int __init init_hw_perf_events(void)* Install callbacks. Core will call them for each online * cpu. */ - err =cpuhp_setup_state (CPUHP_PERF_X86_PREPARE ,"PERF_X86_PREPARE" , + err =cpuhp_setup_state (CPUHP_PERF_X86_PREPARE ,"perf/x86:prepare" , x86_pmu_prepare_cpu, x86_pmu_dead_cpu);if (err)return err; err =cpuhp_setup_state (CPUHP_AP_PERF_X86_STARTING , -"AP_PERF_X86_STARTING" , x86_pmu_starting_cpu, +"perf/x86:starting" , x86_pmu_starting_cpu, x86_pmu_dying_cpu);if (err) goto out; - err =cpuhp_setup_state (CPUHP_AP_PERF_X86_ONLINE ,"AP_PERF_X86_ONLINE" , + err =cpuhp_setup_state (CPUHP_AP_PERF_X86_ONLINE ,"perf/x86:online" , x86_pmu_online_cpu,NULL );if (err) goto out1;
arch/x86/events/intel/cqm.c +2 -2
@@ -1747,9 +1747,9 @@ static int __init intel_cqm_init(void)* is enabled to avoid notifier leak. */ cpuhp_setup_state (CPUHP_AP_PERF_X86_CQM_STARTING , -"AP_PERF_X86_CQM_STARTING" , +"perf/x86/cqm:starting" , intel_cqm_cpu_starting,NULL ); -cpuhp_setup_state (CPUHP_AP_PERF_X86_CQM_ONLINE ,"AP_PERF_X86_CQM_ONLINE" , +cpuhp_setup_state (CPUHP_AP_PERF_X86_CQM_ONLINE ,"perf/x86/cqm:online" ,NULL , intel_cqm_cpu_exit); out:
arch/x86/events/intel/rapl.c +2 -2
@@ -803,13 +803,13 @@ static int __init rapl_pmu_init(void)* Install callbacks. Core will call them for each online cpu. */ - ret =cpuhp_setup_state (CPUHP_PERF_X86_RAPL_PREP ,"PERF_X86_RAPL_PREP" , + ret =cpuhp_setup_state (CPUHP_PERF_X86_RAPL_PREP ,"perf/x86/rapl:prepare" , rapl_cpu_prepare,NULL );if (ret) goto out; ret =cpuhp_setup_state (CPUHP_AP_PERF_X86_RAPL_ONLINE , -"AP_PERF_X86_RAPL_ONLINE" , +"perf/x86/rapl:online" , rapl_cpu_online, rapl_cpu_offline);if (ret) goto out1;
arch/x86/events/intel/uncore.c +5 -5
@@ -1398,22 +1398,22 @@ static int __init intel_uncore_init(void)*/ if (!cret) { ret =cpuhp_setup_state (CPUHP_PERF_X86_UNCORE_PREP , -"PERF_X86_UNCORE_PREP" , - uncore_cpu_prepare,NULL ); +"perf/x86/intel/uncore:prepare" , + uncore_cpu_prepare,NULL );if (ret) goto err; }else {cpuhp_setup_state_nocalls (CPUHP_PERF_X86_UNCORE_PREP , -"PERF_X86_UNCORE_PREP" , +"perf/x86/intel/uncore:prepare" , uncore_cpu_prepare,NULL ); } first_init =1 ;cpuhp_setup_state (CPUHP_AP_PERF_X86_UNCORE_STARTING , -"AP_PERF_X86_UNCORE_STARTING" , +"perf/x86/uncore:starting" , uncore_cpu_starting, uncore_cpu_dying); first_init =0 ;cpuhp_setup_state (CPUHP_AP_PERF_X86_UNCORE_ONLINE , -"AP_PERF_X86_UNCORE_ONLINE" , +"perf/x86/uncore:online" , uncore_event_cpu_online, uncore_event_cpu_offline);return 0 ;
arch/x86/kernel/apb_timer.c +1 -1
@@ -234,7 +234,7 @@ static __init int apbt_late_init(void)if (intel_mid_timer_options ==INTEL_MID_TIMER_LAPIC_APBT || !apb_timer_block_enabled)return 0 ; -return cpuhp_setup_state (CPUHP_X86_APB_DEAD ,"X86_APB_DEAD" ,NULL , +return cpuhp_setup_state (CPUHP_X86_APB_DEAD ,"x86/apb:dead" ,NULL , apbt_cpu_dead); }fs_initcall (apbt_late_init);
arch/x86/kernel/apic/x2apic_cluster.c +1 -1
@@ -191,7 +191,7 @@ static int x2apic_cluster_probe(void)if (!x2apic_mode)return 0 ; - ret =cpuhp_setup_state (CPUHP_X2APIC_PREPARE ,"X2APIC_PREPARE" , + ret =cpuhp_setup_state (CPUHP_X2APIC_PREPARE ,"x86/x2apic:prepare" , x2apic_prepare_cpu, x2apic_dead_cpu);if (ret <0 ) {pr_err ("Failed to register X2APIC_PREPARE\n" );
arch/x86/kernel/hpet.c +2 -2
@@ -1051,11 +1051,11 @@ static __init int hpet_late_init(void)return 0 ;/* This notifier should be called after workqueue is ready */ - ret =cpuhp_setup_state (CPUHP_AP_X86_HPET_ONLINE ,"AP_X86_HPET_ONLINE" , + ret =cpuhp_setup_state (CPUHP_AP_X86_HPET_ONLINE ,"x86/hpet:online" , hpet_cpuhp_online,NULL );if (ret)return ret; - ret =cpuhp_setup_state (CPUHP_X86_HPET_DEAD ,"X86_HPET_DEAD" ,NULL , + ret =cpuhp_setup_state (CPUHP_X86_HPET_DEAD ,"x86/hpet:dead" ,NULL , hpet_cpuhp_dead);if (ret) goto err_cpuhp;
arch/x86/kernel/tboot.c +1 -1
@@ -408,7 +408,7 @@ static __init int tboot_late_init(void)tboot_create_trampoline ();atomic_set (&ap_wfs_count,0 ); -cpuhp_setup_state (CPUHP_AP_X86_TBOOT_DYING ,"AP_X86_TBOOT_DYING" ,NULL , +cpuhp_setup_state (CPUHP_AP_X86_TBOOT_DYING ,"x86/tboot:dying" ,NULL , tboot_dying_cpu);#ifdef CONFIG_DEBUG_FS debugfs_create_file("tboot_log", S_IRUSR,
arch/x86/kvm/x86.c +1 -1
@@ -5855,7 +5855,7 @@ static void kvm_timer_init(void) }pr_debug ("kvm: max_tsc_khz = %ld\n" , max_tsc_khz); -cpuhp_setup_state (CPUHP_AP_X86_KVM_CLK_ONLINE ,"AP_X86_KVM_CLK_ONLINE" , +cpuhp_setup_state (CPUHP_AP_X86_KVM_CLK_ONLINE ,"x86/kvm/clk:online" , kvmclock_cpu_online, kvmclock_cpu_down_prep); }
arch/x86/xen/enlighten.c +2 -2
@@ -1529,11 +1529,11 @@ static int xen_cpuhp_setup(void)int rc; rc =cpuhp_setup_state_nocalls (CPUHP_XEN_PREPARE , -"XEN_HVM_GUEST_PREPARE" , +"x86/xen/hvm_guest:prepare" , xen_cpu_up_prepare, xen_cpu_dead);if (rc >=0 ) { rc =cpuhp_setup_state_nocalls (CPUHP_AP_ONLINE_DYN , -"XEN_HVM_GUEST_ONLINE" , +"x86/xen/hvm_guest:online" , xen_cpu_up_online,NULL );if (rc <0 )cpuhp_remove_state_nocalls (CPUHP_XEN_PREPARE );
arch/xtensa/kernel/perf_event.c +1 -1
@@ -422,7 +422,7 @@ static int __init xtensa_pmu_init(void)int irq =irq_create_mapping (NULL ,XCHAL_PROFILING_INTERRUPT ); ret =cpuhp_setup_state (CPUHP_AP_PERF_XTENSA_STARTING , -"AP_PERF_XTENSA_STARTING" , xtensa_pmu_setup, +"perf/xtensa:starting" , xtensa_pmu_setup,NULL );if (ret) {pr_err ("xtensa_pmu: failed to register CPU-hotplug.\n" );
drivers/bus/arm-cci.c +1 -1
@@ -1796,7 +1796,7 @@ static int __init cci_platform_init(void)int ret; ret =cpuhp_setup_state_multi (CPUHP_AP_PERF_ARM_CCI_ONLINE , -"AP_PERF_ARM_CCI_ONLINE" ,NULL , +"perf/arm/cci:online" ,NULL , cci_pmu_offline_cpu);if (ret)return ret;
drivers/bus/arm-ccn.c +1 -1
@@ -1562,7 +1562,7 @@ static int __init arm_ccn_init(void)int i, ret; ret =cpuhp_setup_state_multi (CPUHP_AP_PERF_ARM_CCN_ONLINE , -"AP_PERF_ARM_CCN_ONLINE" ,NULL , +"perf/arm/ccn:online" ,NULL , arm_ccn_pmu_offline_cpu);if (ret)return ret;
drivers/clocksource/arc_timer.c +1 -1
@@ -309,7 +309,7 @@ static int __init arc_clockevent_setup(struct device_node *node) } ret =cpuhp_setup_state (CPUHP_AP_ARC_TIMER_STARTING , -"AP_ARC_TIMER_STARTING" , +"clockevents/arc/timer:starting" , arc_timer_starting_cpu, arc_timer_dying_cpu);if (ret) {
drivers/clocksource/arm_arch_timer.c +1 -1
@@ -738,7 +738,7 @@ static int __init arch_timer_register(void)/* Register and immediately configure the timer on the boot CPU */ err =cpuhp_setup_state (CPUHP_AP_ARM_ARCH_TIMER_STARTING , -"AP_ARM_ARCH_TIMER_STARTING" , +"clockevents/arm/arch_timer:starting" , arch_timer_starting_cpu, arch_timer_dying_cpu);if (err) goto out_unreg_cpupm;
drivers/clocksource/arm_global_timer.c +1 -1
@@ -316,7 +316,7 @@ static int __init global_timer_of_register(struct device_node *np) goto out_irq; err =cpuhp_setup_state (CPUHP_AP_ARM_GLOBAL_TIMER_STARTING , -"AP_ARM_GLOBAL_TIMER_STARTING" , +"clockevents/arm/global_timer:starting" , gt_starting_cpu, gt_dying_cpu);if (err) goto out_irq;
drivers/clocksource/dummy_timer.c +1 -1
@@ -34,7 +34,7 @@ static int dummy_timer_starting_cpu(unsigned int cpu)static int __init dummy_timer_register (void ) {return cpuhp_setup_state (CPUHP_AP_DUMMY_TIMER_STARTING , -"AP_DUMMY_TIMER_STARTING" , +"clockevents/dummy_timer:starting" , dummy_timer_starting_cpu,NULL ); }early_initcall (dummy_timer_register);
drivers/clocksource/exynos_mct.c +1 -1
@@ -552,7 +552,7 @@ static int __init exynos4_timer_resources(struct device_node *np, void __iomem */* Install hotplug callbacks which configure the timer on this CPU */ err =cpuhp_setup_state (CPUHP_AP_EXYNOS4_MCT_TIMER_STARTING , -"AP_EXYNOS4_MCT_TIMER_STARTING" , +"clockevents/exynos4/mct_timer:starting" , exynos4_mct_starting_cpu, exynos4_mct_dying_cpu);if (err)
drivers/clocksource/jcore-pit.c +1 -1
@@ -240,7 +240,7 @@ static int __init jcore_pit_init(struct device_node *node) }cpuhp_setup_state (CPUHP_AP_JCORE_TIMER_STARTING , -"AP_JCORE_TIMER_STARTING" , +"clockevents/jcore:starting" , jcore_pit_local_init,NULL );return 0 ;
drivers/clocksource/metag_generic.c +1 -1
@@ -154,6 +154,6 @@ int __init metag_generic_timer_init(void)/* Hook cpu boot to configure the CPU's timers */ return cpuhp_setup_state (CPUHP_AP_METAG_TIMER_STARTING , -"AP_METAG_TIMER_STARTING" , +"clockevents/metag:starting" , arch_timer_starting_cpu,NULL ); }
drivers/clocksource/mips-gic-timer.c +2 -2
@@ -120,8 +120,8 @@ static int gic_clockevent_init(void) }cpuhp_setup_state (CPUHP_AP_MIPS_GIC_TIMER_STARTING , -"AP_MIPS_GIC_TIMER_STARTING" , gic_starting_cpu, - gic_dying_cpu); +"clockevents/mips/gic/timer:starting" , + gic_starting_cpu, gic_dying_cpu);return 0 ; }
drivers/clocksource/qcom-timer.c +1 -1
@@ -182,7 +182,7 @@ static int __init msm_timer_init(u32 dgt_hz, int sched_bits, int irq, }else {/* Install and invoke hotplug callbacks */ res =cpuhp_setup_state (CPUHP_AP_QCOM_TIMER_STARTING , -"AP_QCOM_TIMER_STARTING" , +"clockevents/qcom/timer:starting" , msm_local_timer_starting_cpu, msm_local_timer_dying_cpu);if (res) {
drivers/clocksource/time-armada-370-xp.c +1 -1
@@ -320,7 +320,7 @@ static int __init armada_370_xp_timer_common_init(struct device_node *np) } res =cpuhp_setup_state (CPUHP_AP_ARMADA_TIMER_STARTING , -"AP_ARMADA_TIMER_STARTING" , +"clockevents/armada:starting" , armada_370_xp_timer_starting_cpu, armada_370_xp_timer_dying_cpu);if (res) {
drivers/clocksource/timer-atlas7.c +1 -1
@@ -221,7 +221,7 @@ static int __init sirfsoc_clockevent_init(void)/* Install and invoke hotplug callbacks */ return cpuhp_setup_state (CPUHP_AP_MARCO_TIMER_STARTING , -"AP_MARCO_TIMER_STARTING" , +"clockevents/marco:starting" , sirfsoc_local_timer_starting_cpu, sirfsoc_local_timer_dying_cpu); }
drivers/hwtracing/coresight/coresight-etm3x.c +2 -2
@@ -804,10 +804,10 @@ static int etm_probe(struct amba_device *adev, const struct amba_id *id)if (!etm_count++) {cpuhp_setup_state_nocalls (CPUHP_AP_ARM_CORESIGHT_STARTING , -"AP_ARM_CORESIGHT_STARTING" , +"arm/coresight:starting" , etm_starting_cpu, etm_dying_cpu); ret =cpuhp_setup_state_nocalls (CPUHP_AP_ONLINE_DYN , -"AP_ARM_CORESIGHT_ONLINE" , +"arm/coresight:online" , etm_online_cpu,NULL );if (ret <0 ) goto err_arch_supported;
drivers/hwtracing/coresight/coresight-etm4x.c +2 -2
@@ -987,10 +987,10 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id)if (!etm4_count++) {cpuhp_setup_state_nocalls (CPUHP_AP_ARM_CORESIGHT4_STARTING , -"AP_ARM_CORESIGHT4_STARTING" , +"arm/coresight4:starting" , etm4_starting_cpu, etm4_dying_cpu); ret =cpuhp_setup_state_nocalls (CPUHP_AP_ONLINE_DYN , -"AP_ARM_CORESIGHT4_ONLINE" , +"arm/coresight4:online" , etm4_online_cpu,NULL );if (ret <0 ) goto err_arch_supported;
drivers/irqchip/irq-armada-370-xp.c +2 -2
@@ -578,13 +578,13 @@ static int __init armada_370_xp_mpic_of_init(struct device_node *node,#ifdef CONFIG_SMP set_smp_cross_call (armada_mpic_send_doorbell);cpuhp_setup_state_nocalls (CPUHP_AP_IRQ_ARMADA_XP_STARTING , -"AP_IRQ_ARMADA_XP_STARTING" , +"irqchip/armada/ipi:starting" , armada_xp_mpic_starting_cpu,NULL );#endif }else {#ifdef CONFIG_SMP cpuhp_setup_state_nocalls (CPUHP_AP_IRQ_ARMADA_CASC_STARTING , -"AP_IRQ_ARMADA_CASC_STARTING" , +"irqchip/armada/cascade:starting" , mpic_cascaded_starting_cpu,NULL );#endif irq_set_chained_handler(parent_irq,
drivers/irqchip/irq-bcm2836.c +1 -1
@@ -245,7 +245,7 @@ bcm2836_arm_irqchip_smp_init(void)#ifdef CONFIG_SMP /* Unmask IPIs to the boot CPU. */ cpuhp_setup_state (CPUHP_AP_IRQ_BCM2836_STARTING , -"AP_IRQ_BCM2836_STARTING" , bcm2836_cpu_starting, +"irqchip/bcm2836:starting" , bcm2836_cpu_starting, bcm2836_cpu_dying);set_smp_cross_call (bcm2836_arm_irqchip_send_ipi);
drivers/irqchip/irq-gic-v3.c +2 -2
@@ -633,8 +633,8 @@ static void gic_smp_init(void) {set_smp_cross_call (gic_raise_softirq);cpuhp_setup_state_nocalls (CPUHP_AP_IRQ_GICV3_STARTING , -"AP_IRQ_GICV3_STARTING" , gic_starting_cpu, -NULL ); +"irqchip/arm/gicv3:starting" , + gic_starting_cpu,NULL ); } static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val,
drivers/irqchip/irq-gic.c +1 -1
@@ -1191,7 +1191,7 @@ static int __init __gic_init_bases(struct gic_chip_data *gic,set_smp_cross_call (gic_raise_softirq);#endif cpuhp_setup_state_nocalls (CPUHP_AP_IRQ_GIC_STARTING , -"AP_IRQ_GIC_STARTING" , +"irqchip/arm/gic:starting" , gic_starting_cpu,NULL );set_handle_irq (gic_handle_irq);if (static_key_true (&supports_deactivate))
drivers/irqchip/irq-hip04.c +1 -1
@@ -407,7 +407,7 @@ hip04_of_init(struct device_node *node, struct device_node *parent)set_handle_irq (hip04_handle_irq);hip04_irq_dist_init (&hip04_data); -cpuhp_setup_state (CPUHP_AP_IRQ_HIP04_STARTING ,"AP_IRQ_HIP04_STARTING" , +cpuhp_setup_state (CPUHP_AP_IRQ_HIP04_STARTING ,"irqchip/hip04:starting" , hip04_irq_starting_cpu,NULL );return 0 ; }
drivers/leds/trigger/ledtrig-cpu.c +1 -1
@@ -127,7 +127,7 @@ static int __init ledtrig_cpu_init(void)register_syscore_ops (&ledtrig_cpu_syscore_ops); - ret =cpuhp_setup_state (CPUHP_AP_ONLINE_DYN ,"AP_LEDTRIG_STARTING" , + ret =cpuhp_setup_state (CPUHP_AP_ONLINE_DYN ,"leds/trigger:starting" , ledtrig_online_cpu, ledtrig_prepare_down_cpu);if (ret <0 ) pr_err("CPU hotplug notifier for ledtrig-cpu could not be registered: %d\n",
drivers/net/virtio_net.c +2 -2
@@ -2484,13 +2484,13 @@ static __init int virtio_net_driver_init(void) {int ret; - ret =cpuhp_setup_state_multi (CPUHP_AP_ONLINE_DYN ,"AP_VIRT_NET_ONLINE" , + ret =cpuhp_setup_state_multi (CPUHP_AP_ONLINE_DYN ,"virtio/net:online" , virtnet_cpu_online, virtnet_cpu_down_prep);if (ret <0 ) goto out; virtionet_online = ret; - ret =cpuhp_setup_state_multi (CPUHP_VIRT_NET_DEAD ,"VIRT_NET_DEAD" , + ret =cpuhp_setup_state_multi (CPUHP_VIRT_NET_DEAD ,"virtio/net:dead" ,NULL , virtnet_cpu_dead);if (ret) goto err_dead;
drivers/perf/arm_pmu.c +1 -1
@@ -1084,7 +1084,7 @@ static int arm_pmu_hp_init(void)int ret; ret =cpuhp_setup_state_multi (CPUHP_AP_PERF_ARM_STARTING , -"AP_PERF_ARM_STARTING" , +"perf/arm/pmu:starting" , arm_perf_starting_cpu,NULL );if (ret) pr_err("CPU hotplug notifier for ARM PMU could not be registered: %d\n",
drivers/xen/events/events_fifo.c +1 -1
@@ -445,7 +445,7 @@ int __init xen_evtchn_fifo_init(void) evtchn_ops = &evtchn_ops_fifo;cpuhp_setup_state_nocalls (CPUHP_XEN_EVTCHN_PREPARE , -"CPUHP_XEN_EVTCHN_PREPARE" , +"xen/evtchn:prepare" , xen_evtchn_cpu_prepare, xen_evtchn_cpu_dead); out:put_cpu ();
virt/kvm/arm/arch_timer.c +1 -1
@@ -456,7 +456,7 @@ int kvm_timer_hyp_init(void)kvm_info ("virtual timer IRQ%d\n" , host_vtimer_irq);cpuhp_setup_state (CPUHP_AP_KVM_ARM_TIMER_STARTING , -"AP_KVM_ARM_TIMER_STARTING" , kvm_timer_starting_cpu, +"kvm/arm/timer:starting" , kvm_timer_starting_cpu, kvm_timer_dying_cpu);return err; }
virt/kvm/arm/vgic/vgic-init.c +1 -1
@@ -428,7 +428,7 @@ int kvm_vgic_hyp_init(void) } ret =cpuhp_setup_state (CPUHP_AP_KVM_ARM_VGIC_INIT_STARTING , -"AP_KVM_ARM_VGIC_INIT_STARTING" , +"kvm/arm/vgic:starting" , vgic_init_cpu_starting, vgic_init_cpu_dying);if (ret) {kvm_err ("Cannot register vgic CPU notifier\n" );
virt/kvm/kvm_main.c +1 -1
@@ -3944,7 +3944,7 @@ int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align, goto out_free_1; } - r =cpuhp_setup_state_nocalls (CPUHP_AP_KVM_STARTING ,"AP_KVM_STARTING" , + r =cpuhp_setup_state_nocalls (CPUHP_AP_KVM_STARTING ,"kvm/cpu:starting" , kvm_starting_cpu, kvm_dying_cpu);if (r) goto out_free_2;
PATCH 8/10 coresight: etm3/4x: Consolidate hotplug state space
In reply to Thomas GleixnerEven if both drivers are compiled in only one instance can run on a given system depending on the available tracer cell.
So having seperate hotplug states for them is pointless.
--- drivers/hwtracing/coresight/coresight-etm4x.c | 4 ++-- include/linux/cpuhotplug.h | 1 - 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/hwtracing/coresight/coresight-etm4x.c +2 -2
@@ -986,7 +986,7 @@ static int etm4_probe(struct amba_devicedev_err (dev,"ETM arch init failed\n" );if (!etm4_count++) { -cpuhp_setup_state_nocalls (CPUHP_AP_ARM_CORESIGHT4_STARTING , +cpuhp_setup_state_nocalls (CPUHP_AP_ARM_CORESIGHT_STARTING ,"arm/coresight4:starting" , etm4_starting_cpu, etm4_dying_cpu); ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN,
@@ -1037,7 +1037,7 @@ static int etm4_probe(struct amba_device err_arch_supported:if (--etm4_count ==0 ) { -cpuhp_remove_state_nocalls (CPUHP_AP_ARM_CORESIGHT4_STARTING ); +cpuhp_remove_state_nocalls (CPUHP_AP_ARM_CORESIGHT_STARTING );if (hp_online)cpuhp_remove_state_nocalls (hp_online); }
include/linux/cpuhotplug.h +0 -1
@@ -119,7 +119,6 @@ enum cpuhp_state {CPUHP_AP_DUMMY_TIMER_STARTING ,CPUHP_AP_ARM_XEN_STARTING ,CPUHP_AP_ARM_CORESIGHT_STARTING , -CPUHP_AP_ARM_CORESIGHT4_STARTING ,CPUHP_AP_ARM64_ISNDEP_STARTING ,CPUHP_AP_SMPCFD_DYING , CPUHP_AP_X86_TBOOT_DYING,
Re: [patch 08/10] coresight: etm3/4x: Consolidate hotplug state space
Quoted 4 lines · Thomas Gleixner
Even if both drivers are compiled in only one instance can run on a given system depending on the available tracer cell.
From a HW point of view both ETM 3x and 4x can be found on the same
system but that wouldn't be practical. As such,
Quoted 42 lines
So having seperate hotplug states for them is pointless.
Signed-off-by Thomas Gleixner <[email protected]>Cc Mathieu Poirier <[email protected]>--- drivers/hwtracing/coresight/coresight-etm4x.c | 4 ++-- include/linux/cpuhotplug.h | 1 - 2 files changed, 2 insertions(+), 3 deletions(-)drivers/hwtracing/coresight/coresight-etm4x.c +2
-2@@ -986,7 +986,7 @@ static int etm4_probe(struct amba_devicedev_err (dev,"ETM arch init failed\n" );if (!etm4_count++) { -cpuhp_setup_state_nocalls (CPUHP_AP_ARM_CORESIGHT4_STARTING , +cpuhp_setup_state_nocalls (CPUHP_AP_ARM_CORESIGHT_STARTING ,"arm/coresight4:starting" , etm4_starting_cpu, etm4_dying_cpu); ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN,@@ -1037,7 +1037,7 @@ static int etm4_probe(struct amba_device err_arch_supported:if (--etm4_count ==0 ) { -cpuhp_remove_state_nocalls (CPUHP_AP_ARM_CORESIGHT4_STARTING ); +cpuhp_remove_state_nocalls (CPUHP_AP_ARM_CORESIGHT_STARTING );if (hp_online)cpuhp_remove_state_nocalls (hp_online); }include/linux/cpuhotplug.h +0
-1@@ -119,7 +119,6 @@ enum cpuhp_state {CPUHP_AP_DUMMY_TIMER_STARTING ,CPUHP_AP_ARM_XEN_STARTING ,CPUHP_AP_ARM_CORESIGHT_STARTING , -CPUHP_AP_ARM_CORESIGHT4_STARTING ,CPUHP_AP_ARM64_ISNDEP_STARTING ,CPUHP_AP_SMPCFD_DYING , CPUHP_AP_X86_TBOOT_DYING,
tip-bot for Thomas Gleixner
merge bot[tip:smp/urgent] coresight/etm3/4x: Consolidate hotplug state space
In reply to Thomas Gleixnercoresight/etm3/4x: Consolidate hotplug state space
Commit-ID: 3ee93ef2527389b5e83039239e2a754dabd3a5e5 Gitweb: http://git.kernel.org/tip/3ee93ef2527389b5e83039239e2a754dabd3a5e5 Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 21 Dec 2016 20:19:55 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Thu, 22 Dec 2016 11:37:56 +0100
coresight/etm3/4x: Consolidate hotplug state space
Even if both drivers are compiled in only one instance can run on a given system depending on the available tracer cell.
So having seperate hotplug states for them is pointless.
--- drivers/hwtracing/coresight/coresight-etm4x.c | 4 ++-- include/linux/cpuhotplug.h | 1 - 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/hwtracing/coresight/coresight-etm4x.c +2 -2
@@ -986,7 +986,7 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id)dev_err (dev,"ETM arch init failed\n" );if (!etm4_count++) { -cpuhp_setup_state_nocalls (CPUHP_AP_ARM_CORESIGHT4_STARTING , +cpuhp_setup_state_nocalls (CPUHP_AP_ARM_CORESIGHT_STARTING ,"arm/coresight4:starting" , etm4_starting_cpu, etm4_dying_cpu); ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN,
@@ -1037,7 +1037,7 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) err_arch_supported:if (--etm4_count ==0 ) { -cpuhp_remove_state_nocalls (CPUHP_AP_ARM_CORESIGHT4_STARTING ); +cpuhp_remove_state_nocalls (CPUHP_AP_ARM_CORESIGHT_STARTING );if (hp_online)cpuhp_remove_state_nocalls (hp_online); }
include/linux/cpuhotplug.h +0 -1
@@ -119,7 +119,6 @@ enum cpuhp_state {CPUHP_AP_DUMMY_TIMER_STARTING ,CPUHP_AP_ARM_XEN_STARTING ,CPUHP_AP_ARM_CORESIGHT_STARTING , -CPUHP_AP_ARM_CORESIGHT4_STARTING ,CPUHP_AP_ARM64_ISNDEP_STARTING ,CPUHP_AP_SMPCFD_DYING , CPUHP_AP_X86_TBOOT_DYING,
tip-bot for Thomas Gleixner
merge bot[tip:smp/urgent] coresight/etm3/4x: Consolidate hotplug state space
In reply to Thomas Gleixnercoresight/etm3/4x: Consolidate hotplug state space
Commit-ID: 36e5b0e39194b09a10f19697fb9ea4ccc44eb166 Gitweb: http://git.kernel.org/tip/36e5b0e39194b09a10f19697fb9ea4ccc44eb166 Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 21 Dec 2016 20:19:55 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Sun, 25 Dec 2016 10:47:44 +0100
coresight/etm3/4x: Consolidate hotplug state space
Even if both drivers are compiled in only one instance can run on a given system depending on the available tracer cell.
So having seperate hotplug states for them is pointless.
--- drivers/hwtracing/coresight/coresight-etm4x.c | 4 ++-- include/linux/cpuhotplug.h | 1 - 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/hwtracing/coresight/coresight-etm4x.c +2 -2
@@ -986,7 +986,7 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id)dev_err (dev,"ETM arch init failed\n" );if (!etm4_count++) { -cpuhp_setup_state_nocalls (CPUHP_AP_ARM_CORESIGHT4_STARTING , +cpuhp_setup_state_nocalls (CPUHP_AP_ARM_CORESIGHT_STARTING ,"arm/coresight4:starting" , etm4_starting_cpu, etm4_dying_cpu); ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN,
@@ -1037,7 +1037,7 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) err_arch_supported:if (--etm4_count ==0 ) { -cpuhp_remove_state_nocalls (CPUHP_AP_ARM_CORESIGHT4_STARTING ); +cpuhp_remove_state_nocalls (CPUHP_AP_ARM_CORESIGHT_STARTING );if (hp_online)cpuhp_remove_state_nocalls (hp_online); }
include/linux/cpuhotplug.h +0 -1
@@ -119,7 +119,6 @@ enum cpuhp_state {CPUHP_AP_DUMMY_TIMER_STARTING ,CPUHP_AP_ARM_XEN_STARTING ,CPUHP_AP_ARM_CORESIGHT_STARTING , -CPUHP_AP_ARM_CORESIGHT4_STARTING ,CPUHP_AP_ARM64_ISNDEP_STARTING ,CPUHP_AP_SMPCFD_DYING , CPUHP_AP_X86_TBOOT_DYING,
PATCH 9/10 irqchip/gic: Consolidate hotplug state space
In reply to Thomas GleixnerEven if both drivers are compiled in only one instance can run on a given system depending on the available GIC version.
So having seperate hotplug states for them is pointless.
--- drivers/irqchip/irq-gic-v3.c | 2 +- include/linux/cpuhotplug.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/irqchip/irq-gic-v3.c +1 -1
@@ -632,7 +632,7 @@ static void gic_raise_softirq(const strustatic void gic_smp_init (void ) {set_smp_cross_call (gic_raise_softirq); -cpuhp_setup_state_nocalls (CPUHP_AP_IRQ_GICV3_STARTING , +cpuhp_setup_state_nocalls (CPUHP_AP_IRQ_GIC_STARTING ,"irqchip/arm/gicv3:starting" , gic_starting_cpu,NULL ); }
include/linux/cpuhotplug.h +0 -1
@@ -80,7 +80,6 @@ enum cpuhp_state {CPUHP_AP_SCHED_STARTING ,CPUHP_AP_RCUTREE_DYING ,CPUHP_AP_IRQ_GIC_STARTING , -CPUHP_AP_IRQ_GICV3_STARTING ,CPUHP_AP_IRQ_HIP04_STARTING ,CPUHP_AP_IRQ_ARMADA_XP_STARTING , CPUHP_AP_IRQ_ARMADA_CASC_STARTING,
tip-bot for Thomas Gleixner
merge bot[tip:smp/urgent] irqchip/gic: Consolidate hotplug state space
irqchip/gic: Consolidate hotplug state space
Commit-ID: 8fe1c3c1b44a5afe44279178afec705fad55c8c4 Gitweb: http://git.kernel.org/tip/8fe1c3c1b44a5afe44279178afec705fad55c8c4 Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 21 Dec 2016 20:19:56 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Thu, 22 Dec 2016 11:37:56 +0100
irqchip/gic: Consolidate hotplug state space
Even if both drivers are compiled in only one instance can run on a given system depending on the available GIC version.
So having seperate hotplug states for them is pointless.
--- drivers/irqchip/irq-gic-v3.c | 2 +- include/linux/cpuhotplug.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/irqchip/irq-gic-v3.c +1 -1
@@ -632,7 +632,7 @@ static void gic_raise_softirq(const struct cpumask *mask, unsigned int irq)static void gic_smp_init (void ) {set_smp_cross_call (gic_raise_softirq); -cpuhp_setup_state_nocalls (CPUHP_AP_IRQ_GICV3_STARTING , +cpuhp_setup_state_nocalls (CPUHP_AP_IRQ_GIC_STARTING ,"irqchip/arm/gicv3:starting" , gic_starting_cpu,NULL ); }
include/linux/cpuhotplug.h +0 -1
@@ -80,7 +80,6 @@ enum cpuhp_state {CPUHP_AP_SCHED_STARTING ,CPUHP_AP_RCUTREE_DYING ,CPUHP_AP_IRQ_GIC_STARTING , -CPUHP_AP_IRQ_GICV3_STARTING ,CPUHP_AP_IRQ_HIP04_STARTING ,CPUHP_AP_IRQ_ARMADA_XP_STARTING , CPUHP_AP_IRQ_ARMADA_CASC_STARTING,
tip-bot for Thomas Gleixner
merge bot[tip:smp/urgent] irqchip/gic: Consolidate hotplug state space
In reply to Thomas Gleixnerirqchip/gic: Consolidate hotplug state space
Commit-ID: 6896bcd198df04777820cab4acc70142e87d5ce0 Gitweb: http://git.kernel.org/tip/6896bcd198df04777820cab4acc70142e87d5ce0 Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 21 Dec 2016 20:19:56 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Sun, 25 Dec 2016 10:47:44 +0100
irqchip/gic: Consolidate hotplug state space
Even if both drivers are compiled in only one instance can run on a given system depending on the available GIC version.
So having seperate hotplug states for them is pointless.
--- drivers/irqchip/irq-gic-v3.c | 2 +- include/linux/cpuhotplug.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/irqchip/irq-gic-v3.c +1 -1
@@ -632,7 +632,7 @@ static void gic_raise_softirq(const struct cpumask *mask, unsigned int irq)static void gic_smp_init (void ) {set_smp_cross_call (gic_raise_softirq); -cpuhp_setup_state_nocalls (CPUHP_AP_IRQ_GICV3_STARTING , +cpuhp_setup_state_nocalls (CPUHP_AP_IRQ_GIC_STARTING ,"irqchip/arm/gicv3:starting" , gic_starting_cpu,NULL ); }
include/linux/cpuhotplug.h +0 -1
@@ -80,7 +80,6 @@ enum cpuhp_state {CPUHP_AP_SCHED_STARTING ,CPUHP_AP_RCUTREE_DYING ,CPUHP_AP_IRQ_GIC_STARTING , -CPUHP_AP_IRQ_GICV3_STARTING ,CPUHP_AP_IRQ_HIP04_STARTING ,CPUHP_AP_IRQ_ARMADA_XP_STARTING , CPUHP_AP_IRQ_ARMADA_CASC_STARTING,
PATCH 10/10 irqchip/armada-xp: Consolidate hotplug state space
In reply to Thomas GleixnerThe mpic is either the main interrupt controller or sits behind a GIC. But there is no way that both variants are available on the same system.
Share the cpu hotplug state.
--- drivers/irqchip/irq-armada-370-xp.c | 2 +- include/linux/cpuhotplug.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/irqchip/irq-armada-370-xp.c +1 -1
@@ -583,7 +583,7 @@ static int __init armada_370_xp_mpic_of_#endif }else {#ifdef CONFIG_SMP -cpuhp_setup_state_nocalls (CPUHP_AP_IRQ_ARMADA_CASC_STARTING , +cpuhp_setup_state_nocalls (CPUHP_AP_IRQ_ARMADA_XP_STARTING ,"irqchip/armada/cascade:starting" , mpic_cascaded_starting_cpu,NULL );#endif
include/linux/cpuhotplug.h +0 -1
@@ -82,7 +82,6 @@ enum cpuhp_state {CPUHP_AP_IRQ_GIC_STARTING ,CPUHP_AP_IRQ_HIP04_STARTING ,CPUHP_AP_IRQ_ARMADA_XP_STARTING , -CPUHP_AP_IRQ_ARMADA_CASC_STARTING ,CPUHP_AP_IRQ_BCM2836_STARTING ,CPUHP_AP_ARM_MVEBU_COHERENCY , CPUHP_AP_PERF_X86_UNCORE_STARTING,
Re: [patch 10/10] irqchip/armada-xp: Consolidate hotplug state space
Hello,
Quoted 2 lines · Thomas Gleixner
The mpic is either the main interrupt controller or sits behind a GIC. But there is no way that both variants are available on the same system.
By "both variants", you mean the MPIC acting as the main interrupt controller on one side, and the MPIC acting as a "cascaded" controller, child of the GIC on the other side ?
If that's what you meant, then indeed it's correct.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
Re: [patch 10/10] irqchip/armada-xp: Consolidate hotplug state space
Quoted 9 lines · Thomas Petazzoni
Quoted 2 lines · Thomas Gleixner
The mpic is either the main interrupt controller or sits behind a GIC. But there is no way that both variants are available on the same system.
By "both variants", you mean the MPIC acting as the main interrupt controller on one side, and the MPIC acting as a "cascaded" controller, child of the GIC on the other side ?
If that's what you meant, then indeed it's correct.
Yes. I'll rephrase that.
Thanks,
tglx
tip-bot for Thomas Gleixner
merge bot[tip:smp/urgent] irqchip/armada-xp: Consolidate hotplug state space
In reply to Thomas Gleixnerirqchip/armada-xp: Consolidate hotplug state space
Commit-ID: 504dcba246a5bc451bd7f37d8da3de11310cad71 Gitweb: http://git.kernel.org/tip/504dcba246a5bc451bd7f37d8da3de11310cad71 Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 21 Dec 2016 20:19:57 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Thu, 22 Dec 2016 11:37:56 +0100
irqchip/armada-xp: Consolidate hotplug state space
The mpic is either the main interrupt controller or is cascaded behind a GIC. The mpic is single instance and the modes are mutually exclusive, so there is no reason to have seperate cpu hotplug states.
--- drivers/irqchip/irq-armada-370-xp.c | 2 +- include/linux/cpuhotplug.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/irqchip/irq-armada-370-xp.c +1 -1
@@ -583,7 +583,7 @@ static int __init armada_370_xp_mpic_of_init(struct device_node *node,#endif }else {#ifdef CONFIG_SMP -cpuhp_setup_state_nocalls (CPUHP_AP_IRQ_ARMADA_CASC_STARTING , +cpuhp_setup_state_nocalls (CPUHP_AP_IRQ_ARMADA_XP_STARTING ,"irqchip/armada/cascade:starting" , mpic_cascaded_starting_cpu,NULL );#endif
include/linux/cpuhotplug.h +0 -1
@@ -82,7 +82,6 @@ enum cpuhp_state {CPUHP_AP_IRQ_GIC_STARTING ,CPUHP_AP_IRQ_HIP04_STARTING ,CPUHP_AP_IRQ_ARMADA_XP_STARTING , -CPUHP_AP_IRQ_ARMADA_CASC_STARTING ,CPUHP_AP_IRQ_BCM2836_STARTING ,CPUHP_AP_ARM_MVEBU_COHERENCY , CPUHP_AP_PERF_X86_UNCORE_STARTING,
tip-bot for Thomas Gleixner
merge bot[tip:smp/urgent] irqchip/armada-xp: Consolidate hotplug state space
In reply to Thomas Gleixnerirqchip/armada-xp: Consolidate hotplug state space
Commit-ID: 008b69e4d52f2cbee3ed0d0502edd78155000b1a Gitweb: http://git.kernel.org/tip/008b69e4d52f2cbee3ed0d0502edd78155000b1a Author: Thomas Gleixner <[email protected]> AuthorDate: Wed, 21 Dec 2016 20:19:57 +0100 Committer: Thomas Gleixner <[email protected]> CommitDate: Sun, 25 Dec 2016 10:47:44 +0100
irqchip/armada-xp: Consolidate hotplug state space
The mpic is either the main interrupt controller or is cascaded behind a GIC. The mpic is single instance and the modes are mutually exclusive, so there is no reason to have seperate cpu hotplug states.
--- drivers/irqchip/irq-armada-370-xp.c | 2 +- include/linux/cpuhotplug.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/irqchip/irq-armada-370-xp.c +1 -1
@@ -583,7 +583,7 @@ static int __init armada_370_xp_mpic_of_init(struct device_node *node,#endif }else {#ifdef CONFIG_SMP -cpuhp_setup_state_nocalls (CPUHP_AP_IRQ_ARMADA_CASC_STARTING , +cpuhp_setup_state_nocalls (CPUHP_AP_IRQ_ARMADA_XP_STARTING ,"irqchip/armada/cascade:starting" , mpic_cascaded_starting_cpu,NULL );#endif
include/linux/cpuhotplug.h +0 -1
@@ -82,7 +82,6 @@ enum cpuhp_state {CPUHP_AP_IRQ_GIC_STARTING ,CPUHP_AP_IRQ_HIP04_STARTING ,CPUHP_AP_IRQ_ARMADA_XP_STARTING , -CPUHP_AP_IRQ_ARMADA_CASC_STARTING ,CPUHP_AP_IRQ_BCM2836_STARTING ,CPUHP_AP_ARM_MVEBU_COHERENCY , CPUHP_AP_PERF_X86_UNCORE_STARTING,
Re: [patch 00/10] cpu/hotplug: Final cleanup
In reply to Thomas GleixnerHi Thomas.
Quoted 1 line · Thomas Gleixner
The following series completes the cpuhotplug rework stage ONE.
Just curious - what is the stage TWO (and onwards) plan? lwn had some coverage of this work but I assume the article is somewhat outdated.
Sam
Re: [patch 00/10] cpu/hotplug: Final cleanup
Quoted 8 lines · Sam Ravnborg
Hi Thomas.
Quoted 1 line · Thomas Gleixner
The following series completes the cpuhotplug rework stage ONE.
Just curious - what is the stage TWO (and onwards) plan? lwn had some coverage of this work but I assume the article is somewhat outdated.
Stage 2 is to consolidate all the archictecture code, i.e. reduce it to really arch specific callbacks and keep all the other things (synchronization, state settings etc.) in the core code.
After that we can do smart things like speed up the boot hotplug process:
prepare CPU1
kick CPU1
prepare CPU2
kick CPU2
....
prepare CPUN
kick CPUN
check CPU1 alive
bringup CPU1
...
check CPUN alive
bringup CPUN
That saves ~200ms per CPU on x86, which we now spend busy waiting for the CPU to come alive.
There is more stuff which we can do in the long run like synchrounosly letting CPUs bring up themself after the basic init/sync checks, but that needs lot of surgery all over the place.
Thanks,
tglx
Re: [patch 00/10] cpu/hotplug: Final cleanup
Quoted 29 lines
Quoted 3 lines
Just curious - what is the stage TWO (and onwards) plan? lwn had some coverage of this work but I assume the article is somewhat outdated.
Stage 2 is to consolidate all the archictecture code, i.e. reduce it to really arch specific callbacks and keep all the other things (synchronization, state settings etc.) in the core code.
After that we can do smart things like speed up the boot hotplug process:
prepare CPU1
kick CPU1prepare CPU2
kick CPU2....
prepare CPUN
kick CPUNcheck CPU1 alive
bringup CPU1...
check CPUN alive
bringup CPUN
Quoted 6 lines
That saves ~200ms per CPU on x86, which we now spend busy waiting for the CPU to come alive.
There is more stuff which we can do in the long run like synchrounosly letting CPUs bring up themself after the basic init/sync checks, but that needs lot of surgery all over the place.
Thanks for the update - looking forward to follow this great clean-up!
Sam