Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 125297
b: refs/heads/master
c: 7f59f49
h: refs/heads/master
i:
  125295: ef99836
v: v3
  • Loading branch information
Rusty Russell authored and Avi Kivity committed Dec 31, 2008
1 parent d19032b commit 212818c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6ef7a1bc45f80fe0a263119d404688c596ea5031
refs/heads/master: 7f59f492da722eb3551bbe1f8f4450a21896f05d
20 changes: 14 additions & 6 deletions trunk/virt/kvm/kvm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ module_param(msi2intx, bool, 0);
DEFINE_SPINLOCK(kvm_lock);
LIST_HEAD(vm_list);

static cpumask_t cpus_hardware_enabled;
static cpumask_var_t cpus_hardware_enabled;

struct kmem_cache *kvm_vcpu_cache;
EXPORT_SYMBOL_GPL(kvm_vcpu_cache);
Expand Down Expand Up @@ -1965,19 +1965,19 @@ static void hardware_enable(void *junk)
{
int cpu = raw_smp_processor_id();

if (cpu_isset(cpu, cpus_hardware_enabled))
if (cpumask_test_cpu(cpu, cpus_hardware_enabled))
return;
cpu_set(cpu, cpus_hardware_enabled);
cpumask_set_cpu(cpu, cpus_hardware_enabled);
kvm_arch_hardware_enable(NULL);
}

static void hardware_disable(void *junk)
{
int cpu = raw_smp_processor_id();

if (!cpu_isset(cpu, cpus_hardware_enabled))
if (!cpumask_test_cpu(cpu, cpus_hardware_enabled))
return;
cpu_clear(cpu, cpus_hardware_enabled);
cpumask_clear_cpu(cpu, cpus_hardware_enabled);
kvm_arch_hardware_disable(NULL);
}

Expand Down Expand Up @@ -2211,9 +2211,14 @@ int kvm_init(void *opaque, unsigned int vcpu_size,

bad_pfn = page_to_pfn(bad_page);

if (!alloc_cpumask_var(&cpus_hardware_enabled, GFP_KERNEL)) {
r = -ENOMEM;
goto out_free_0;
}

r = kvm_arch_hardware_setup();
if (r < 0)
goto out_free_0;
goto out_free_0a;

for_each_online_cpu(cpu) {
smp_call_function_single(cpu,
Expand Down Expand Up @@ -2277,6 +2282,8 @@ int kvm_init(void *opaque, unsigned int vcpu_size,
on_each_cpu(hardware_disable, NULL, 1);
out_free_1:
kvm_arch_hardware_unsetup();
out_free_0a:
free_cpumask_var(cpus_hardware_enabled);
out_free_0:
__free_page(bad_page);
out:
Expand All @@ -2300,6 +2307,7 @@ void kvm_exit(void)
kvm_arch_hardware_unsetup();
kvm_arch_exit();
kvm_exit_debug();
free_cpumask_var(cpus_hardware_enabled);
__free_page(bad_page);
}
EXPORT_SYMBOL_GPL(kvm_exit);

0 comments on commit 212818c

Please sign in to comment.