Release 4.11 drivers/xen/cpu_hotplug.c
#define pr_fmt(fmt) "xen:" KBUILD_MODNAME ": " fmt
#include <linux/notifier.h>
#include <xen/xen.h>
#include <xen/xenbus.h>
#include <asm/xen/hypervisor.h>
#include <asm/cpu.h>
static void enable_hotplug_cpu(int cpu)
{
if (!cpu_present(cpu))
xen_arch_register_cpu(cpu);
set_cpu_present(cpu, true);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Alex Nixon | 26 | 89.66% | 1 | 33.33% |
Rusty Russell | 2 | 6.90% | 1 | 33.33% |
Stefano Stabellini | 1 | 3.45% | 1 | 33.33% |
Total | 29 | 100.00% | 3 | 100.00% |
static void disable_hotplug_cpu(int cpu)
{
if (cpu_online(cpu)) {
lock_device_hotplug();
device_offline(get_cpu_device(cpu));
unlock_device_hotplug();
}
if (cpu_present(cpu))
xen_arch_unregister_cpu(cpu);
set_cpu_present(cpu, false);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Alex Nixon | 25 | 49.02% | 1 | 25.00% |
Stefano Stabellini | 24 | 47.06% | 2 | 50.00% |
Rusty Russell | 2 | 3.92% | 1 | 25.00% |
Total | 51 | 100.00% | 4 | 100.00% |
static int vcpu_online(unsigned int cpu)
{
int err;
char dir[16], state[16];
sprintf(dir, "cpu/%u", cpu);
err = xenbus_scanf(XBT_NIL, dir, "availability", "%15s", state);
if (err != 1) {
if (!xen_initial_domain())
pr_err("Unable to read cpu state\n");
return err;
}
if (strcmp(state, "online") == 0)
return 1;
else if (strcmp(state, "offline") == 0)
return 0;
pr_err("unknown state(%s) on CPU%d\n", state, cpu);
return -EINVAL;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Alex Nixon | 76 | 67.86% | 1 | 20.00% |
Ian Campbell | 23 | 20.54% | 1 | 20.00% |
Konrad Rzeszutek Wilk | 6 | 5.36% | 1 | 20.00% |
Joe Perches | 4 | 3.57% | 1 | 20.00% |
Jan Beulich | 3 | 2.68% | 1 | 20.00% |
Total | 112 | 100.00% | 5 | 100.00% |
static void vcpu_hotplug(unsigned int cpu)
{
if (!cpu_possible(cpu))
return;
switch (vcpu_online(cpu)) {
case 1:
enable_hotplug_cpu(cpu);
break;
case 0:
disable_hotplug_cpu(cpu);
break;
default:
break;
}
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Ian Campbell | 40 | 83.33% | 1 | 50.00% |
Alex Nixon | 8 | 16.67% | 1 | 50.00% |
Total | 48 | 100.00% | 2 | 100.00% |
static void handle_vcpu_hotplug_event(struct xenbus_watch *watch,
const char *path, const char *token)
{
unsigned int cpu;
char *cpustr;
cpustr = strstr(path, "cpu/");
if (cpustr != NULL) {
sscanf(cpustr, "cpu/%u", &cpu);
vcpu_hotplug(cpu);
}
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Alex Nixon | 55 | 90.16% | 1 | 50.00% |
Juergen Gross | 6 | 9.84% | 1 | 50.00% |
Total | 61 | 100.00% | 2 | 100.00% |
static int setup_cpu_watcher(struct notifier_block *notifier,
unsigned long event, void *data)
{
int cpu;
static struct xenbus_watch cpu_watch = {
.node = "cpu",
.callback = handle_vcpu_hotplug_event};
(void)register_xenbus_watch(&cpu_watch);
for_each_possible_cpu(cpu) {
if (vcpu_online(cpu) == 0) {
(void)cpu_down(cpu);
set_cpu_present(cpu, false);
}
}
return NOTIFY_DONE;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Alex Nixon | 48 | 57.83% | 1 | 33.33% |
Ian Campbell | 33 | 39.76% | 1 | 33.33% |
Rusty Russell | 2 | 2.41% | 1 | 33.33% |
Total | 83 | 100.00% | 3 | 100.00% |
static int __init setup_vcpu_hotplug_event(void)
{
static struct notifier_block xsn_cpu = {
.notifier_call = setup_cpu_watcher };
#ifdef CONFIG_X86
if (!xen_pv_domain() && !xen_pvh_domain())
#else
if (!xen_domain())
#endif
return -ENODEV;
register_xenstore_notifier(&xsn_cpu);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Alex Nixon | 40 | 70.18% | 2 | 50.00% |
Stefano Stabellini | 13 | 22.81% | 1 | 25.00% |
Boris Ostrovsky | 4 | 7.02% | 1 | 25.00% |
Total | 57 | 100.00% | 4 | 100.00% |
arch_initcall(setup_vcpu_hotplug_event);
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Alex Nixon | 294 | 62.82% | 2 | 14.29% |
Ian Campbell | 96 | 20.51% | 1 | 7.14% |
Stefano Stabellini | 38 | 8.12% | 2 | 14.29% |
Joe Perches | 11 | 2.35% | 1 | 7.14% |
Konrad Rzeszutek Wilk | 6 | 1.28% | 1 | 7.14% |
Juergen Gross | 6 | 1.28% | 1 | 7.14% |
Rusty Russell | 6 | 1.28% | 2 | 14.29% |
Boris Ostrovsky | 4 | 0.85% | 1 | 7.14% |
Jan Beulich | 3 | 0.64% | 1 | 7.14% |
Jeremy Fitzhardinge | 3 | 0.64% | 1 | 7.14% |
Al Viro | 1 | 0.21% | 1 | 7.14% |
Total | 468 | 100.00% | 14 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.