Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 282049
b: refs/heads/master
c: 4f69b68
h: refs/heads/master
i:
  282047: a529613
v: v3
  • Loading branch information
Hamo authored and Avi Kivity committed Dec 27, 2011
1 parent 5644ac4 commit ceca4cd
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 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: d546cb406ea0d83e2d39ec14221957a24f88a622
refs/heads/master: 4f69b6805c4f818cf7f4126978cc4a54c489119f
26 changes: 23 additions & 3 deletions trunk/virt/kvm/kvm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2654,15 +2654,29 @@ static const struct file_operations *stat_fops[] = {
[KVM_STAT_VM] = &vm_stat_fops,
};

static void kvm_init_debug(void)
static int kvm_init_debug(void)
{
int r = -EFAULT;
struct kvm_stats_debugfs_item *p;

kvm_debugfs_dir = debugfs_create_dir("kvm", NULL);
for (p = debugfs_entries; p->name; ++p)
if (kvm_debugfs_dir == NULL)
goto out;

for (p = debugfs_entries; p->name; ++p) {
p->dentry = debugfs_create_file(p->name, 0444, kvm_debugfs_dir,
(void *)(long)p->offset,
stat_fops[p->kind]);
if (p->dentry == NULL)
goto out_dir;
}

return 0;

out_dir:
debugfs_remove_recursive(kvm_debugfs_dir);
out:
return r;
}

static void kvm_exit_debug(void)
Expand Down Expand Up @@ -2806,10 +2820,16 @@ int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align,
kvm_preempt_ops.sched_in = kvm_sched_in;
kvm_preempt_ops.sched_out = kvm_sched_out;

kvm_init_debug();
r = kvm_init_debug();
if (r) {
printk(KERN_ERR "kvm: create debugfs files failed\n");
goto out_undebugfs;
}

return 0;

out_undebugfs:
unregister_syscore_ops(&kvm_syscore_ops);
out_unreg:
kvm_async_pf_deinit();
out_free:
Expand Down

0 comments on commit ceca4cd

Please sign in to comment.