#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/sched.h>
+#include <linux/kobject.h>
#include <linux/notifier.h>
#include <linux/cpu.h>
#include <xen/cpu_hotplug.h>
return (current->mm != NULL);
}
-static void vcpu_hotplug(unsigned int cpu)
+static void vcpu_hotplug(unsigned int cpu, struct sys_device *dev)
{
int err;
char dir[32], state[32];
if (strcmp(state, "online") == 0) {
cpu_set(cpu, xenbus_allowed_cpumask);
- (void)cpu_up(cpu);
+ if (!cpu_up(cpu) && dev)
+ kobject_uevent(&dev->kobj, KOBJ_ONLINE);
} else if (strcmp(state, "offline") == 0) {
cpu_clear(cpu, xenbus_allowed_cpumask);
- (void)cpu_down(cpu);
+ if (!cpu_down(cpu) && dev)
+ kobject_uevent(&dev->kobj, KOBJ_OFFLINE);
} else {
printk(KERN_ERR "XENBUS: unknown state(%s) on CPU%d\n",
state, cpu);
if ((cpustr = strstr(node, "cpu/")) != NULL) {
sscanf(cpustr, "cpu/%u", &cpu);
- vcpu_hotplug(cpu);
+ vcpu_hotplug(cpu, get_cpu_sysdev(cpu));
}
}
if (!is_initial_xendomain()) {
for_each_possible_cpu(i)
- vcpu_hotplug(i);
+ vcpu_hotplug(i, get_cpu_sysdev(i));
printk(KERN_INFO "Brought up %ld CPUs\n",
(long)num_online_cpus());
}
printk(KERN_CRIT "Failed to take all CPUs "
"down: %d.\n", err);
for_each_possible_cpu(cpu)
- vcpu_hotplug(cpu);
+ vcpu_hotplug(cpu, NULL);
return err;
}
}
for_each_possible_cpu(cpu) {
if (cpu == 0)
continue;
- vcpu_hotplug(cpu);
+ vcpu_hotplug(cpu, NULL);
}
}