* [PATCH 14/25] ia64/err-inject: Convert to hotplug state machine
[not found] <20161103145021.28528-1-bigeasy@linutronix.de>
@ 2016-11-03 14:50 ` Sebastian Andrzej Siewior
2016-11-03 14:50 ` [PATCH 15/25] ia64/palinfo: " Sebastian Andrzej Siewior
` (2 subsequent siblings)
3 siblings, 0 replies; 9+ messages in thread
From: Sebastian Andrzej Siewior @ 2016-11-03 14:50 UTC (permalink / raw)
To: linux-kernel
Cc: rt, Sebastian Andrzej Siewior, Tony Luck, Fenghua Yu, linux-ia64,
Thomas Gleixner
Install the callbacks via the state machine and let the core invoke
the callbacks on the already online CPUs.
The removal of the files happens now in the prepare down stage as there is
no reason to keep them around until the cpu has actually died.
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: linux-ia64@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
arch/ia64/kernel/err_inject.c | 78 +++++++++++--------------------------------
1 file changed, 19 insertions(+), 59 deletions(-)
diff --git a/arch/ia64/kernel/err_inject.c b/arch/ia64/kernel/err_inject.c
index 5ed0ea92c5bf..85bba43e7d5d 100644
--- a/arch/ia64/kernel/err_inject.c
+++ b/arch/ia64/kernel/err_inject.c
@@ -224,85 +224,45 @@ static struct attribute_group err_inject_attr_group = {
.name = "err_inject"
};
/* Add/Remove err_inject interface for CPU device */
-static int err_inject_add_dev(struct device *sys_dev)
+static int err_inject_add_dev(unsigned int cpu)
{
+ struct device *sys_dev = get_cpu_device(cpu);
+
return sysfs_create_group(&sys_dev->kobj, &err_inject_attr_group);
}
-static int err_inject_remove_dev(struct device *sys_dev)
+static int err_inject_remove_dev(unsigned int cpu)
{
+ struct device *sys_dev = get_cpu_device(cpu);
+
sysfs_remove_group(&sys_dev->kobj, &err_inject_attr_group);
return 0;
}
-static int err_inject_cpu_callback(struct notifier_block *nfb,
- unsigned long action, void *hcpu)
+
+static enum cpuhp_state hp_online;
+
+static int __init err_inject_init(void)
{
- unsigned int cpu = (unsigned long)hcpu;
- struct device *sys_dev;
-
- sys_dev = get_cpu_device(cpu);
- switch (action) {
- case CPU_ONLINE:
- case CPU_ONLINE_FROZEN:
- err_inject_add_dev(sys_dev);
- break;
- case CPU_DEAD:
- case CPU_DEAD_FROZEN:
- err_inject_remove_dev(sys_dev);
- break;
- }
-
- return NOTIFY_OK;
-}
-
-static struct notifier_block err_inject_cpu_notifier =
-{
- .notifier_call = err_inject_cpu_callback,
-};
-
-static int __init
-err_inject_init(void)
-{
- int i;
-
+ int ret;
#ifdef ERR_INJ_DEBUG
printk(KERN_INFO "Enter error injection driver.\n");
#endif
- cpu_notifier_register_begin();
-
- for_each_online_cpu(i) {
- err_inject_cpu_callback(&err_inject_cpu_notifier, CPU_ONLINE,
- (void *)(long)i);
+ ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "ia64/err_inj:online",
+ err_inject_add_dev, err_inject_remove_dev);
+ if (ret >= 0) {
+ hp_online = ret;
+ ret = 0;
}
-
- __register_hotcpu_notifier(&err_inject_cpu_notifier);
-
- cpu_notifier_register_done();
-
- return 0;
+ return ret;
}
-static void __exit
-err_inject_exit(void)
+static void __exit err_inject_exit(void)
{
- int i;
- struct device *sys_dev;
-
#ifdef ERR_INJ_DEBUG
printk(KERN_INFO "Exit error injection driver.\n");
#endif
-
- cpu_notifier_register_begin();
-
- for_each_online_cpu(i) {
- sys_dev = get_cpu_device(i);
- sysfs_remove_group(&sys_dev->kobj, &err_inject_attr_group);
- }
-
- __unregister_hotcpu_notifier(&err_inject_cpu_notifier);
-
- cpu_notifier_register_done();
+ cpuhp_remove_state(hp_online);
}
module_init(err_inject_init);
--
2.10.2
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 15/25] ia64/palinfo: Convert to hotplug state machine
[not found] <20161103145021.28528-1-bigeasy@linutronix.de>
2016-11-03 14:50 ` [PATCH 14/25] ia64/err-inject: Convert to hotplug state machine Sebastian Andrzej Siewior
@ 2016-11-03 14:50 ` Sebastian Andrzej Siewior
2016-11-03 14:50 ` [PATCH 16/25] ia64/salinfo: " Sebastian Andrzej Siewior
2016-11-03 14:50 ` [PATCH 17/25] ia64/topology: " Sebastian Andrzej Siewior
3 siblings, 0 replies; 9+ messages in thread
From: Sebastian Andrzej Siewior @ 2016-11-03 14:50 UTC (permalink / raw)
To: linux-kernel
Cc: rt, Sebastian Andrzej Siewior, Tony Luck, Fenghua Yu, linux-ia64,
Thomas Gleixner
Install the callbacks via the state machine and let the core invoke
the callbacks on the already online CPUs.
The removal of the files happens now in the prepare down stage as there is
no reason to keep them around until the cpu has actually died.
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: linux-ia64@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
arch/ia64/kernel/palinfo.c | 60 +++++++++++++---------------------------------
1 file changed, 16 insertions(+), 44 deletions(-)
diff --git a/arch/ia64/kernel/palinfo.c b/arch/ia64/kernel/palinfo.c
index c39c3cd3ac34..b6e597860888 100644
--- a/arch/ia64/kernel/palinfo.c
+++ b/arch/ia64/kernel/palinfo.c
@@ -932,8 +932,7 @@ static const struct file_operations proc_palinfo_fops = {
.release = single_release,
};
-static void
-create_palinfo_proc_entries(unsigned int cpu)
+static int palinfo_add_proc(unsigned int cpu)
{
pal_func_cpu_u_t f;
struct proc_dir_entry *cpu_dir;
@@ -943,7 +942,7 @@ create_palinfo_proc_entries(unsigned int cpu)
cpu_dir = proc_mkdir(cpustr, palinfo_dir);
if (!cpu_dir)
- return;
+ return -EINVAL;
f.req_cpu = cpu;
@@ -952,42 +951,21 @@ create_palinfo_proc_entries(unsigned int cpu)
proc_create_data(palinfo_entries[j].name, 0, cpu_dir,
&proc_palinfo_fops, (void *)f.value);
}
+ return 0;
}
-static void
-remove_palinfo_proc_entries(unsigned int hcpu)
+static int palinfo_del_proc(unsigned int hcpu)
{
char cpustr[3+4+1]; /* cpu numbers are up to 4095 on itanic */
+
sprintf(cpustr, "cpu%d", hcpu);
remove_proc_subtree(cpustr, palinfo_dir);
+ return 0;
}
-static int palinfo_cpu_callback(struct notifier_block *nfb,
- unsigned long action, void *hcpu)
-{
- unsigned int hotcpu = (unsigned long)hcpu;
+static enum cpuhp_state hp_online;
- switch (action) {
- case CPU_ONLINE:
- case CPU_ONLINE_FROZEN:
- create_palinfo_proc_entries(hotcpu);
- break;
- case CPU_DEAD:
- case CPU_DEAD_FROZEN:
- remove_palinfo_proc_entries(hotcpu);
- break;
- }
- return NOTIFY_OK;
-}
-
-static struct notifier_block __refdata palinfo_cpu_notifier =
-{
- .notifier_call = palinfo_cpu_callback,
- .priority = 0,
-};
-
-static int __init
-palinfo_init(void)
+static int __init palinfo_init(void)
{
int i = 0;
@@ -996,25 +974,19 @@ palinfo_init(void)
if (!palinfo_dir)
return -ENOMEM;
- cpu_notifier_register_begin();
-
- /* Create palinfo dirs in /proc for all online cpus */
- for_each_online_cpu(i) {
- create_palinfo_proc_entries(i);
+ i = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "ia64/palinfo:online",
+ palinfo_add_proc, palinfo_del_proc);
+ if (i < 0) {
+ remove_proc_subtree("pal", NULL);
+ return i;
}
-
- /* Register for future delivery via notify registration */
- __register_hotcpu_notifier(&palinfo_cpu_notifier);
-
- cpu_notifier_register_done();
-
+ hp_online = i;
return 0;
}
-static void __exit
-palinfo_exit(void)
+static void __exit palinfo_exit(void)
{
- unregister_hotcpu_notifier(&palinfo_cpu_notifier);
+ cpuhp_remove_state(hp_online);
remove_proc_subtree("pal", NULL);
}
--
2.10.2
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 16/25] ia64/salinfo: Convert to hotplug state machine
[not found] <20161103145021.28528-1-bigeasy@linutronix.de>
2016-11-03 14:50 ` [PATCH 14/25] ia64/err-inject: Convert to hotplug state machine Sebastian Andrzej Siewior
2016-11-03 14:50 ` [PATCH 15/25] ia64/palinfo: " Sebastian Andrzej Siewior
@ 2016-11-03 14:50 ` Sebastian Andrzej Siewior
2016-11-03 15:45 ` kbuild test robot
2016-11-03 16:22 ` [PATCH 16/25] " kbuild test robot
2016-11-03 14:50 ` [PATCH 17/25] ia64/topology: " Sebastian Andrzej Siewior
3 siblings, 2 replies; 9+ messages in thread
From: Sebastian Andrzej Siewior @ 2016-11-03 14:50 UTC (permalink / raw)
To: linux-kernel
Cc: rt, Sebastian Andrzej Siewior, Tony Luck, Fenghua Yu, linux-ia64,
Thomas Gleixner
Install the callbacks via the state machine and let the core invoke
the callbacks on the already online CPUs.
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: linux-ia64@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
arch/ia64/kernel/salinfo.c | 83 ++++++++++++++++++----------------------------
1 file changed, 32 insertions(+), 51 deletions(-)
diff --git a/arch/ia64/kernel/salinfo.c b/arch/ia64/kernel/salinfo.c
index 5313007d5423..bfbf07ed38dd 100644
--- a/arch/ia64/kernel/salinfo.c
+++ b/arch/ia64/kernel/salinfo.c
@@ -550,52 +550,40 @@ static const struct file_operations salinfo_data_fops = {
.llseek = default_llseek,
};
-static int
-salinfo_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
+static int salinfo_cpu_online(unsigned int cpu)
{
- unsigned int i, cpu = (unsigned long)hcpu;
- unsigned long flags;
+ unsigned int i, end = ARRAY_SIZE(salinfo_data);
struct salinfo_data *data;
- switch (action) {
- case CPU_ONLINE:
- case CPU_ONLINE_FROZEN:
- spin_lock_irqsave(&data_saved_lock, flags);
- for (i = 0, data = salinfo_data;
- i < ARRAY_SIZE(salinfo_data);
- ++i, ++data) {
- cpumask_set_cpu(cpu, &data->cpu_event);
- wake_up_interruptible(&data->read_wait);
- }
- spin_unlock_irqrestore(&data_saved_lock, flags);
- break;
- case CPU_DEAD:
- case CPU_DEAD_FROZEN:
- spin_lock_irqsave(&data_saved_lock, flags);
- for (i = 0, data = salinfo_data;
- i < ARRAY_SIZE(salinfo_data);
- ++i, ++data) {
- struct salinfo_data_saved *data_saved;
- int j;
- for (j = ARRAY_SIZE(data->data_saved) - 1, data_saved = data->data_saved + j;
- j >= 0;
- --j, --data_saved) {
- if (data_saved->buffer && data_saved->cpu == cpu) {
- shift1_data_saved(data, j);
- }
- }
- cpumask_clear_cpu(cpu, &data->cpu_event);
- }
- spin_unlock_irqrestore(&data_saved_lock, flags);
- break;
+
+ spin_lock_irq(&data_saved_lock);
+ for (i = 0, data = salinfo_data; i < end; ++i, ++data) {
+ cpumask_set_cpu(cpu, &data->cpu_event);
+ wake_up_interruptible(&data->read_wait);
}
- return NOTIFY_OK;
+ spin_unlock_irq(&data_saved_lock);
+ return 0;
}
-static struct notifier_block salinfo_cpu_notifier =
+static int salinfo_cpu_pre_down(unsigned int cpu)
{
- .notifier_call = salinfo_cpu_callback,
- .priority = 0,
-};
+ unsigned int i, end = ARRAY_SIZE(salinfo_data);
+ struct salinfo_data *data;
+
+ spin_lock_irqsave(&data_saved_lock, flags);
+ for (i = 0, data = salinfo_data; i < end; ++i, ++data) {
+ struct salinfo_data_saved *data_saved;
+ int j = ARRAY_SIZE(data->data_saved) - 1;
+
+ for (data_saved = data->data_saved + j; j >= 0;
+ --j, --data_saved) {
+ if (data_saved->buffer && data_saved->cpu == cpu)
+ shift1_data_saved(data, j);
+ }
+ cpumask_clear_cpu(cpu, &data->cpu_event);
+ }
+ spin_unlock_irqrestore(&data_saved_lock, flags);
+ return 0;
+}
static int __init
salinfo_init(void)
@@ -604,7 +592,7 @@ salinfo_init(void)
struct proc_dir_entry **sdir = salinfo_proc_entries; /* keeps track of every entry */
struct proc_dir_entry *dir, *entry;
struct salinfo_data *data;
- int i, j;
+ int i;
salinfo_dir = proc_mkdir("sal", NULL);
if (!salinfo_dir)
@@ -617,8 +605,6 @@ salinfo_init(void)
(void *)salinfo_entries[i].feature);
}
- cpu_notifier_register_begin();
-
for (i = 0; i < ARRAY_SIZE(salinfo_log_name); i++) {
data = salinfo_data + i;
data->type = i;
@@ -639,10 +625,6 @@ salinfo_init(void)
continue;
*sdir++ = entry;
- /* we missed any events before now */
- for_each_online_cpu(j)
- cpumask_set_cpu(j, &data->cpu_event);
-
*sdir++ = dir;
}
@@ -653,10 +635,9 @@ salinfo_init(void)
salinfo_timer.function = &salinfo_timeout;
add_timer(&salinfo_timer);
- __register_hotcpu_notifier(&salinfo_cpu_notifier);
-
- cpu_notifier_register_done();
-
+ i = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "ia64/salinfo:online",
+ salinfo_cpu_online, salinfo_cpu_pre_down);
+ WARN_ON(i < 0);
return 0;
}
--
2.10.2
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH 16/25] ia64/salinfo: Convert to hotplug state machine
2016-11-03 14:50 ` [PATCH 16/25] ia64/salinfo: " Sebastian Andrzej Siewior
@ 2016-11-03 15:45 ` kbuild test robot
2016-11-03 17:31 ` [PATCH 16/25 v2] " Sebastian Andrzej Siewior
2016-11-03 16:22 ` [PATCH 16/25] " kbuild test robot
1 sibling, 1 reply; 9+ messages in thread
From: kbuild test robot @ 2016-11-03 15:45 UTC (permalink / raw)
To: linux-ia64
[-- Attachment #1: Type: text/plain, Size: 4385 bytes --]
Hi Sebastian,
[auto build test ERROR on linus/master]
[also build test ERROR on v4.9-rc3]
[cannot apply to next-20161028]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Sebastian-Andrzej-Siewior/fs-buffer-Convert-to-hotplug-state-machine/20161103-230222
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 6.2.0
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=ia64
All error/warnings (new ones prefixed by >>):
In file included from include/linux/kernel.h:12:0,
from include/linux/list.h:8,
from include/linux/kobject.h:20,
from include/linux/device.h:17,
from include/linux/node.h:17,
from include/linux/cpu.h:16,
from arch/ia64/kernel/salinfo.c:40:
arch/ia64/kernel/salinfo.c: In function 'salinfo_cpu_pre_down':
>> arch/ia64/kernel/salinfo.c:572:38: error: 'flags' undeclared (first use in this function)
spin_lock_irqsave(&data_saved_lock, flags);
^
include/linux/typecheck.h:10:9: note: in definition of macro 'typecheck'
typeof(x) __dummy2; \
^
include/linux/spinlock.h:337:2: note: in expansion of macro 'raw_spin_lock_irqsave'
raw_spin_lock_irqsave(spinlock_check(lock), flags); \
^~~~~~~~~~~~~~~~~~~~~
>> arch/ia64/kernel/salinfo.c:572:2: note: in expansion of macro 'spin_lock_irqsave'
spin_lock_irqsave(&data_saved_lock, flags);
^~~~~~~~~~~~~~~~~
arch/ia64/kernel/salinfo.c:572:38: note: each undeclared identifier is reported only once for each function it appears in
spin_lock_irqsave(&data_saved_lock, flags);
^
include/linux/typecheck.h:10:9: note: in definition of macro 'typecheck'
typeof(x) __dummy2; \
^
include/linux/spinlock.h:337:2: note: in expansion of macro 'raw_spin_lock_irqsave'
raw_spin_lock_irqsave(spinlock_check(lock), flags); \
^~~~~~~~~~~~~~~~~~~~~
>> arch/ia64/kernel/salinfo.c:572:2: note: in expansion of macro 'spin_lock_irqsave'
spin_lock_irqsave(&data_saved_lock, flags);
^~~~~~~~~~~~~~~~~
>> include/linux/typecheck.h:11:18: warning: comparison of distinct pointer types lacks a cast
(void)(&__dummy == &__dummy2); \
^
>> include/linux/spinlock.h:207:3: note: in expansion of macro 'typecheck'
typecheck(unsigned long, flags); \
^~~~~~~~~
include/linux/spinlock.h:337:2: note: in expansion of macro 'raw_spin_lock_irqsave'
raw_spin_lock_irqsave(spinlock_check(lock), flags); \
^~~~~~~~~~~~~~~~~~~~~
>> arch/ia64/kernel/salinfo.c:572:2: note: in expansion of macro 'spin_lock_irqsave'
spin_lock_irqsave(&data_saved_lock, flags);
^~~~~~~~~~~~~~~~~
vim +/flags +572 arch/ia64/kernel/salinfo.c
f0c5b094 Sebastian Andrzej Siewior 2016-11-03 566
f0c5b094 Sebastian Andrzej Siewior 2016-11-03 567 static int salinfo_cpu_pre_down(unsigned int cpu)
f0c5b094 Sebastian Andrzej Siewior 2016-11-03 568 {
f0c5b094 Sebastian Andrzej Siewior 2016-11-03 569 unsigned int i, end = ARRAY_SIZE(salinfo_data);
f0c5b094 Sebastian Andrzej Siewior 2016-11-03 570 struct salinfo_data *data;
f0c5b094 Sebastian Andrzej Siewior 2016-11-03 571
e026cca0 Keith Owens 2006-01-06 @572 spin_lock_irqsave(&data_saved_lock, flags);
f0c5b094 Sebastian Andrzej Siewior 2016-11-03 573 for (i = 0, data = salinfo_data; i < end; ++i, ++data) {
e026cca0 Keith Owens 2006-01-06 574 struct salinfo_data_saved *data_saved;
f0c5b094 Sebastian Andrzej Siewior 2016-11-03 575 int j = ARRAY_SIZE(data->data_saved) - 1;
:::::: The code at line 572 was first introduced by commit
:::::: e026cca0f2c09c4c28c902db6384fd8a412671d6 [IA64] Add hotplug cpu to salinfo.c, replace semaphore with mutex
:::::: TO: Keith Owens <kaos@sgi.com>
:::::: CC: Tony Luck <tony.luck@intel.com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 45092 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH 16/25 v2] ia64/salinfo: Convert to hotplug state machine
2016-11-03 15:45 ` kbuild test robot
@ 2016-11-03 17:31 ` Sebastian Andrzej Siewior
0 siblings, 0 replies; 9+ messages in thread
From: Sebastian Andrzej Siewior @ 2016-11-03 17:31 UTC (permalink / raw)
To: kbuild test robot
Cc: kbuild-all, linux-kernel, rt, Tony Luck, Fenghua Yu, linux-ia64,
Thomas Gleixner
Install the callbacks via the state machine and let the core invoke
the callbacks on the already online CPUs.
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: linux-ia64@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
v1…v2: non the save version. Noticed by kbuild test robot
arch/ia64/kernel/salinfo.c | 83 ++++++++++++++++++----------------------------
1 file changed, 32 insertions(+), 51 deletions(-)
diff --git a/arch/ia64/kernel/salinfo.c b/arch/ia64/kernel/salinfo.c
index 5313007d5423..aaf74f36cfa1 100644
--- a/arch/ia64/kernel/salinfo.c
+++ b/arch/ia64/kernel/salinfo.c
@@ -550,52 +550,40 @@ static const struct file_operations salinfo_data_fops = {
.llseek = default_llseek,
};
-static int
-salinfo_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
+static int salinfo_cpu_online(unsigned int cpu)
{
- unsigned int i, cpu = (unsigned long)hcpu;
- unsigned long flags;
+ unsigned int i, end = ARRAY_SIZE(salinfo_data);
struct salinfo_data *data;
- switch (action) {
- case CPU_ONLINE:
- case CPU_ONLINE_FROZEN:
- spin_lock_irqsave(&data_saved_lock, flags);
- for (i = 0, data = salinfo_data;
- i < ARRAY_SIZE(salinfo_data);
- ++i, ++data) {
- cpumask_set_cpu(cpu, &data->cpu_event);
- wake_up_interruptible(&data->read_wait);
- }
- spin_unlock_irqrestore(&data_saved_lock, flags);
- break;
- case CPU_DEAD:
- case CPU_DEAD_FROZEN:
- spin_lock_irqsave(&data_saved_lock, flags);
- for (i = 0, data = salinfo_data;
- i < ARRAY_SIZE(salinfo_data);
- ++i, ++data) {
- struct salinfo_data_saved *data_saved;
- int j;
- for (j = ARRAY_SIZE(data->data_saved) - 1, data_saved = data->data_saved + j;
- j >= 0;
- --j, --data_saved) {
- if (data_saved->buffer && data_saved->cpu = cpu) {
- shift1_data_saved(data, j);
- }
- }
- cpumask_clear_cpu(cpu, &data->cpu_event);
- }
- spin_unlock_irqrestore(&data_saved_lock, flags);
- break;
+
+ spin_lock_irq(&data_saved_lock);
+ for (i = 0, data = salinfo_data; i < end; ++i, ++data) {
+ cpumask_set_cpu(cpu, &data->cpu_event);
+ wake_up_interruptible(&data->read_wait);
}
- return NOTIFY_OK;
+ spin_unlock_irq(&data_saved_lock);
+ return 0;
}
-static struct notifier_block salinfo_cpu_notifier +static int salinfo_cpu_pre_down(unsigned int cpu)
{
- .notifier_call = salinfo_cpu_callback,
- .priority = 0,
-};
+ unsigned int i, end = ARRAY_SIZE(salinfo_data);
+ struct salinfo_data *data;
+
+ spin_lock_irq(&data_saved_lock);
+ for (i = 0, data = salinfo_data; i < end; ++i, ++data) {
+ struct salinfo_data_saved *data_saved;
+ int j = ARRAY_SIZE(data->data_saved) - 1;
+
+ for (data_saved = data->data_saved + j; j >= 0;
+ --j, --data_saved) {
+ if (data_saved->buffer && data_saved->cpu = cpu)
+ shift1_data_saved(data, j);
+ }
+ cpumask_clear_cpu(cpu, &data->cpu_event);
+ }
+ spin_unlock_irq(&data_saved_lock);
+ return 0;
+}
static int __init
salinfo_init(void)
@@ -604,7 +592,7 @@ salinfo_init(void)
struct proc_dir_entry **sdir = salinfo_proc_entries; /* keeps track of every entry */
struct proc_dir_entry *dir, *entry;
struct salinfo_data *data;
- int i, j;
+ int i;
salinfo_dir = proc_mkdir("sal", NULL);
if (!salinfo_dir)
@@ -617,8 +605,6 @@ salinfo_init(void)
(void *)salinfo_entries[i].feature);
}
- cpu_notifier_register_begin();
-
for (i = 0; i < ARRAY_SIZE(salinfo_log_name); i++) {
data = salinfo_data + i;
data->type = i;
@@ -639,10 +625,6 @@ salinfo_init(void)
continue;
*sdir++ = entry;
- /* we missed any events before now */
- for_each_online_cpu(j)
- cpumask_set_cpu(j, &data->cpu_event);
-
*sdir++ = dir;
}
@@ -653,10 +635,9 @@ salinfo_init(void)
salinfo_timer.function = &salinfo_timeout;
add_timer(&salinfo_timer);
- __register_hotcpu_notifier(&salinfo_cpu_notifier);
-
- cpu_notifier_register_done();
-
+ i = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "ia64/salinfo:online",
+ salinfo_cpu_online, salinfo_cpu_pre_down);
+ WARN_ON(i < 0);
return 0;
}
--
2.10.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 16/25] ia64/salinfo: Convert to hotplug state machine
2016-11-03 14:50 ` [PATCH 16/25] ia64/salinfo: " Sebastian Andrzej Siewior
2016-11-03 15:45 ` kbuild test robot
@ 2016-11-03 16:22 ` kbuild test robot
1 sibling, 0 replies; 9+ messages in thread
From: kbuild test robot @ 2016-11-03 16:22 UTC (permalink / raw)
To: linux-ia64
[-- Attachment #1: Type: text/plain, Size: 6622 bytes --]
Hi Sebastian,
[auto build test WARNING on linus/master]
[also build test WARNING on v4.9-rc3]
[cannot apply to next-20161028]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Sebastian-Andrzej-Siewior/fs-buffer-Convert-to-hotplug-state-machine/20161103-230222
config: ia64-allnoconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 6.2.0
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=ia64
All warnings (new ones prefixed by >>):
In file included from include/linux/kernel.h:12:0,
from include/linux/list.h:8,
from include/linux/kobject.h:20,
from include/linux/device.h:17,
from include/linux/node.h:17,
from include/linux/cpu.h:16,
from arch/ia64/kernel/salinfo.c:40:
arch/ia64/kernel/salinfo.c: In function 'salinfo_cpu_pre_down':
arch/ia64/kernel/salinfo.c:572:38: error: 'flags' undeclared (first use in this function)
spin_lock_irqsave(&data_saved_lock, flags);
^
include/linux/typecheck.h:10:9: note: in definition of macro 'typecheck'
typeof(x) __dummy2; \
^
include/linux/spinlock.h:337:2: note: in expansion of macro 'raw_spin_lock_irqsave'
raw_spin_lock_irqsave(spinlock_check(lock), flags); \
^~~~~~~~~~~~~~~~~~~~~
arch/ia64/kernel/salinfo.c:572:2: note: in expansion of macro 'spin_lock_irqsave'
spin_lock_irqsave(&data_saved_lock, flags);
^~~~~~~~~~~~~~~~~
arch/ia64/kernel/salinfo.c:572:38: note: each undeclared identifier is reported only once for each function it appears in
spin_lock_irqsave(&data_saved_lock, flags);
^
include/linux/typecheck.h:10:9: note: in definition of macro 'typecheck'
typeof(x) __dummy2; \
^
include/linux/spinlock.h:337:2: note: in expansion of macro 'raw_spin_lock_irqsave'
raw_spin_lock_irqsave(spinlock_check(lock), flags); \
^~~~~~~~~~~~~~~~~~~~~
arch/ia64/kernel/salinfo.c:572:2: note: in expansion of macro 'spin_lock_irqsave'
spin_lock_irqsave(&data_saved_lock, flags);
^~~~~~~~~~~~~~~~~
include/linux/typecheck.h:11:18: warning: comparison of distinct pointer types lacks a cast
(void)(&__dummy == &__dummy2); \
^
include/linux/spinlock.h:229:3: note: in expansion of macro 'typecheck'
typecheck(unsigned long, flags); \
^~~~~~~~~
include/linux/spinlock.h:337:2: note: in expansion of macro 'raw_spin_lock_irqsave'
raw_spin_lock_irqsave(spinlock_check(lock), flags); \
^~~~~~~~~~~~~~~~~~~~~
arch/ia64/kernel/salinfo.c:572:2: note: in expansion of macro 'spin_lock_irqsave'
spin_lock_irqsave(&data_saved_lock, flags);
^~~~~~~~~~~~~~~~~
include/linux/typecheck.h:11:18: warning: comparison of distinct pointer types lacks a cast
(void)(&__dummy == &__dummy2); \
^
>> include/linux/irqflags.h:63:3: note: in expansion of macro 'typecheck'
typecheck(unsigned long, flags); \
^~~~~~~~~
include/linux/irqflags.h:124:3: note: in expansion of macro 'raw_local_irq_save'
raw_local_irq_save(flags); \
^~~~~~~~~~~~~~~~~~
include/linux/spinlock_api_up.h:40:8: note: in expansion of macro 'local_irq_save'
do { local_irq_save(flags); __LOCK(lock); } while (0)
^~~~~~~~~~~~~~
include/linux/spinlock_api_up.h:69:45: note: in expansion of macro '__LOCK_IRQSAVE'
#define _raw_spin_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags)
^~~~~~~~~~~~~~
include/linux/spinlock.h:230:3: note: in expansion of macro '_raw_spin_lock_irqsave'
_raw_spin_lock_irqsave(lock, flags); \
^~~~~~~~~~~~~~~~~~~~~~
include/linux/spinlock.h:337:2: note: in expansion of macro 'raw_spin_lock_irqsave'
raw_spin_lock_irqsave(spinlock_check(lock), flags); \
^~~~~~~~~~~~~~~~~~~~~
arch/ia64/kernel/salinfo.c:572:2: note: in expansion of macro 'spin_lock_irqsave'
spin_lock_irqsave(&data_saved_lock, flags);
^~~~~~~~~~~~~~~~~
vim +/typecheck +63 include/linux/irqflags.h
6cd8a4bb Steven Rostedt 2008-05-12 47 #if defined(CONFIG_IRQSOFF_TRACER) || \
6cd8a4bb Steven Rostedt 2008-05-12 48 defined(CONFIG_PREEMPT_TRACER)
81d68a96 Steven Rostedt 2008-05-12 49 extern void stop_critical_timings(void);
81d68a96 Steven Rostedt 2008-05-12 50 extern void start_critical_timings(void);
81d68a96 Steven Rostedt 2008-05-12 51 #else
81d68a96 Steven Rostedt 2008-05-12 52 # define stop_critical_timings() do { } while (0)
81d68a96 Steven Rostedt 2008-05-12 53 # define start_critical_timings() do { } while (0)
81d68a96 Steven Rostedt 2008-05-12 54 #endif
81d68a96 Steven Rostedt 2008-05-12 55
df9ee292 David Howells 2010-10-07 56 /*
df9ee292 David Howells 2010-10-07 57 * Wrap the arch provided IRQ routines to provide appropriate checks.
df9ee292 David Howells 2010-10-07 58 */
df9ee292 David Howells 2010-10-07 59 #define raw_local_irq_disable() arch_local_irq_disable()
df9ee292 David Howells 2010-10-07 60 #define raw_local_irq_enable() arch_local_irq_enable()
df9ee292 David Howells 2010-10-07 61 #define raw_local_irq_save(flags) \
df9ee292 David Howells 2010-10-07 62 do { \
df9ee292 David Howells 2010-10-07 @63 typecheck(unsigned long, flags); \
df9ee292 David Howells 2010-10-07 64 flags = arch_local_irq_save(); \
df9ee292 David Howells 2010-10-07 65 } while (0)
df9ee292 David Howells 2010-10-07 66 #define raw_local_irq_restore(flags) \
df9ee292 David Howells 2010-10-07 67 do { \
df9ee292 David Howells 2010-10-07 68 typecheck(unsigned long, flags); \
df9ee292 David Howells 2010-10-07 69 arch_local_irq_restore(flags); \
df9ee292 David Howells 2010-10-07 70 } while (0)
df9ee292 David Howells 2010-10-07 71 #define raw_local_save_flags(flags) \
:::::: The code at line 63 was first introduced by commit
:::::: df9ee29270c11dba7d0fe0b83ce47a4d8e8d2101 Fix IRQ flag handling naming
:::::: TO: David Howells <dhowells@redhat.com>
:::::: CC: David Howells <dhowells@redhat.com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 5715 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 17/25] ia64/topology: Convert to hotplug state machine
[not found] <20161103145021.28528-1-bigeasy@linutronix.de>
` (2 preceding siblings ...)
2016-11-03 14:50 ` [PATCH 16/25] ia64/salinfo: " Sebastian Andrzej Siewior
@ 2016-11-03 14:50 ` Sebastian Andrzej Siewior
2016-11-03 15:53 ` kbuild test robot
3 siblings, 1 reply; 9+ messages in thread
From: Sebastian Andrzej Siewior @ 2016-11-03 14:50 UTC (permalink / raw)
To: linux-kernel
Cc: rt, Sebastian Andrzej Siewior, Tony Luck, Fenghua Yu, linux-ia64,
Thomas Gleixner
Install the callbacks via the state machine and let the core invoke
the callbacks on the already online CPUs.
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: linux-ia64@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
arch/ia64/kernel/topology.c | 55 +++++++--------------------------------------
1 file changed, 8 insertions(+), 47 deletions(-)
diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c
index c01fe8991244..9102cad408b8 100644
--- a/arch/ia64/kernel/topology.c
+++ b/arch/ia64/kernel/topology.c
@@ -349,9 +349,9 @@ static int cpu_cache_sysfs_init(unsigned int cpu)
}
/* Add cache interface for CPU device */
-static int cache_add_dev(struct device *sys_dev)
+static int cache_add_dev(unsigned int cpu)
{
- unsigned int cpu = sys_dev->id;
+ struct device *sys_dev = get_cpu_device(cpu);
unsigned long i, j;
struct cache_info *this_object;
int retval = 0;
@@ -399,9 +399,9 @@ static int cache_add_dev(struct device *sys_dev)
}
/* Remove cache interface for CPU device */
-static int cache_remove_dev(struct device *sys_dev)
+static int cache_remove_dev(unsigned int cpu)
{
- unsigned int cpu = sys_dev->id;
+ struct device *sys_dev = get_cpu_device(cpu);
unsigned long i;
for (i = 0; i < all_cpu_cache_info[cpu].num_cache_leaves; i++)
@@ -419,52 +419,13 @@ static int cache_remove_dev(struct device *sys_dev)
return 0;
}
-/*
- * When a cpu is hot-plugged, do a check and initiate
- * cache kobject if necessary
- */
-static int cache_cpu_callback(struct notifier_block *nfb,
- unsigned long action, void *hcpu)
-{
- unsigned int cpu = (unsigned long)hcpu;
- struct device *sys_dev;
-
- sys_dev = get_cpu_device(cpu);
- switch (action) {
- case CPU_ONLINE:
- case CPU_ONLINE_FROZEN:
- cache_add_dev(sys_dev);
- break;
- case CPU_DEAD:
- case CPU_DEAD_FROZEN:
- cache_remove_dev(sys_dev);
- break;
- }
- return NOTIFY_OK;
-}
-
-static struct notifier_block cache_cpu_notifier =
-{
- .notifier_call = cache_cpu_callback
-};
-
static int __init cache_sysfs_init(void)
{
- int i;
-
- cpu_notifier_register_begin();
-
- for_each_online_cpu(i) {
- struct device *sys_dev = get_cpu_device((unsigned int)i);
- cache_add_dev(sys_dev);
- }
-
- __register_hotcpu_notifier(&cache_cpu_notifier);
-
- cpu_notifier_register_done();
+ int ret;
+ ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "ia64/topology:online",
+ cache_add_dev, cache_remove_dev);
+ WARN_ON(ret < 0);
return 0;
}
-
device_initcall(cache_sysfs_init);
-
--
2.10.2
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH 17/25] ia64/topology: Convert to hotplug state machine
2016-11-03 14:50 ` [PATCH 17/25] ia64/topology: " Sebastian Andrzej Siewior
@ 2016-11-03 15:53 ` kbuild test robot
2016-11-03 17:33 ` [PATCH 17/25 v2] " Sebastian Andrzej Siewior
0 siblings, 1 reply; 9+ messages in thread
From: kbuild test robot @ 2016-11-03 15:53 UTC (permalink / raw)
To: linux-ia64
[-- Attachment #1: Type: text/plain, Size: 2075 bytes --]
Hi Sebastian,
[auto build test WARNING on linus/master]
[also build test WARNING on v4.9-rc3]
[cannot apply to next-20161028]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Sebastian-Andrzej-Siewior/fs-buffer-Convert-to-hotplug-state-machine/20161103-230222
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 6.2.0
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=ia64
All warnings (new ones prefixed by >>):
arch/ia64/kernel/topology.c: In function 'cache_remove_dev':
>> arch/ia64/kernel/topology.c:404:17: warning: unused variable 'sys_dev' [-Wunused-variable]
struct device *sys_dev = get_cpu_device(cpu);
^~~~~~~
vim +/sys_dev +404 arch/ia64/kernel/topology.c
388 for (j = 0; j < i; j++) {
389 kobject_put(&(LEAF_KOBJECT_PTR(cpu,j)->kobj));
390 }
391 kobject_put(&all_cpu_cache_info[cpu].kobj);
392 cpu_cache_sysfs_exit(cpu);
393 return retval;
394 }
395 kobject_uevent(&(this_object->kobj), KOBJ_ADD);
396 }
397 kobject_uevent(&all_cpu_cache_info[cpu].kobj, KOBJ_ADD);
398 return retval;
399 }
400
401 /* Remove cache interface for CPU device */
402 static int cache_remove_dev(unsigned int cpu)
403 {
> 404 struct device *sys_dev = get_cpu_device(cpu);
405 unsigned long i;
406
407 for (i = 0; i < all_cpu_cache_info[cpu].num_cache_leaves; i++)
408 kobject_put(&(LEAF_KOBJECT_PTR(cpu,i)->kobj));
409
410 if (all_cpu_cache_info[cpu].kobj.parent) {
411 kobject_put(&all_cpu_cache_info[cpu].kobj);
412 memset(&all_cpu_cache_info[cpu].kobj,
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 45092 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH 17/25 v2] ia64/topology: Convert to hotplug state machine
2016-11-03 15:53 ` kbuild test robot
@ 2016-11-03 17:33 ` Sebastian Andrzej Siewior
0 siblings, 0 replies; 9+ messages in thread
From: Sebastian Andrzej Siewior @ 2016-11-03 17:33 UTC (permalink / raw)
To: kbuild test robot
Cc: kbuild-all, linux-kernel, rt, Tony Luck, Fenghua Yu, linux-ia64,
Thomas Gleixner
Install the callbacks via the state machine and let the core invoke
the callbacks on the already online CPUs.
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: linux-ia64@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
v1…v2: remove unused variable. Noticed by kbuild test robot
arch/ia64/kernel/topology.c | 54 ++++++---------------------------------------
1 file changed, 7 insertions(+), 47 deletions(-)
diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c
index c01fe8991244..1a68f012a6dc 100644
--- a/arch/ia64/kernel/topology.c
+++ b/arch/ia64/kernel/topology.c
@@ -349,9 +349,9 @@ static int cpu_cache_sysfs_init(unsigned int cpu)
}
/* Add cache interface for CPU device */
-static int cache_add_dev(struct device *sys_dev)
+static int cache_add_dev(unsigned int cpu)
{
- unsigned int cpu = sys_dev->id;
+ struct device *sys_dev = get_cpu_device(cpu);
unsigned long i, j;
struct cache_info *this_object;
int retval = 0;
@@ -399,9 +399,8 @@ static int cache_add_dev(struct device *sys_dev)
}
/* Remove cache interface for CPU device */
-static int cache_remove_dev(struct device *sys_dev)
+static int cache_remove_dev(unsigned int cpu)
{
- unsigned int cpu = sys_dev->id;
unsigned long i;
for (i = 0; i < all_cpu_cache_info[cpu].num_cache_leaves; i++)
@@ -419,52 +418,13 @@ static int cache_remove_dev(struct device *sys_dev)
return 0;
}
-/*
- * When a cpu is hot-plugged, do a check and initiate
- * cache kobject if necessary
- */
-static int cache_cpu_callback(struct notifier_block *nfb,
- unsigned long action, void *hcpu)
-{
- unsigned int cpu = (unsigned long)hcpu;
- struct device *sys_dev;
-
- sys_dev = get_cpu_device(cpu);
- switch (action) {
- case CPU_ONLINE:
- case CPU_ONLINE_FROZEN:
- cache_add_dev(sys_dev);
- break;
- case CPU_DEAD:
- case CPU_DEAD_FROZEN:
- cache_remove_dev(sys_dev);
- break;
- }
- return NOTIFY_OK;
-}
-
-static struct notifier_block cache_cpu_notifier -{
- .notifier_call = cache_cpu_callback
-};
-
static int __init cache_sysfs_init(void)
{
- int i;
-
- cpu_notifier_register_begin();
-
- for_each_online_cpu(i) {
- struct device *sys_dev = get_cpu_device((unsigned int)i);
- cache_add_dev(sys_dev);
- }
-
- __register_hotcpu_notifier(&cache_cpu_notifier);
-
- cpu_notifier_register_done();
+ int ret;
+ ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "ia64/topology:online",
+ cache_add_dev, cache_remove_dev);
+ WARN_ON(ret < 0);
return 0;
}
-
device_initcall(cache_sysfs_init);
-
--
2.10.2
^ permalink raw reply related [flat|nested] 9+ messages in thread