Release 4.7 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 | alex nixon | 26 | 89.66% | 1 | 33.33% |
rusty russell | rusty russell | 2 | 6.90% | 1 | 33.33% |
stefano stabellini | 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 | alex nixon | 25 | 49.02% | 1 | 25.00% |
stefano stabellini | stefano stabellini | 24 | 47.06% | 2 | 50.00% |
rusty russell | 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 | alex nixon | 76 | 67.86% | 1 | 20.00% |
ian campbell | ian campbell | 23 | 20.54% | 1 | 20.00% |
konrad rzeszutek wilk | konrad rzeszutek wilk | 6 | 5.36% | 1 | 20.00% |
joe perches | joe perches | 4 | 3.57% | 1 | 20.00% |
jan beulich | 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 | ian campbell | 40 | 83.33% | 1 | 50.00% |
alex nixon | 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 **vec, unsigned int len)
{
unsigned int cpu;
char *cpustr;
const char *node = vec[XS_WATCH_PATH];
cpustr = strstr(node, "cpu/");
if (cpustr != NULL) {
sscanf(cpustr, "cpu/%u", &cpu);
vcpu_hotplug(cpu);
}
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
alex nixon | alex nixon | 71 | 100.00% | 1 | 100.00% |
| Total | 71 | 100.00% | 1 | 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 | alex nixon | 48 | 57.83% | 1 | 33.33% |
ian campbell | ian campbell | 33 | 39.76% | 1 | 33.33% |
rusty russell | 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())
#else
if (!xen_domain())
#endif
return -ENODEV;
register_xenstore_notifier(&xsn_cpu);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
alex nixon | alex nixon | 40 | 75.47% | 2 | 66.67% |
stefano stabellini | stefano stabellini | 13 | 24.53% | 1 | 33.33% |
| Total | 53 | 100.00% | 3 | 100.00% |
arch_initcall(setup_vcpu_hotplug_event);
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
alex nixon | alex nixon | 310 | 65.40% | 2 | 16.67% |
ian campbell | ian campbell | 96 | 20.25% | 1 | 8.33% |
stefano stabellini | stefano stabellini | 38 | 8.02% | 2 | 16.67% |
joe perches | joe perches | 11 | 2.32% | 1 | 8.33% |
konrad rzeszutek wilk | konrad rzeszutek wilk | 6 | 1.27% | 1 | 8.33% |
rusty russell | rusty russell | 6 | 1.27% | 2 | 16.67% |
jeremy fitzhardinge | jeremy fitzhardinge | 3 | 0.63% | 1 | 8.33% |
jan beulich | jan beulich | 3 | 0.63% | 1 | 8.33% |
al viro | al viro | 1 | 0.21% | 1 | 8.33% |
| Total | 474 | 100.00% | 12 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.