debug_register_view(kvm->arch.dbf, &debug_sprintf_view);
        VM_EVENT(kvm, 3, "%s", "vm created");
 
-       try_module_get(THIS_MODULE);
-
        return kvm;
 out_nodbf:
        free_page((unsigned long)(kvm->arch.sca));
        return ERR_PTR(rc);
 }
 
+void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
+{
+       VCPU_EVENT(vcpu, 3, "%s", "free cpu");
+       free_page((unsigned long)(vcpu->arch.sie_block));
+       kfree(vcpu);
+}
+
+static void kvm_free_vcpus(struct kvm *kvm)
+{
+       unsigned int i;
+
+       for (i = 0; i < KVM_MAX_VCPUS; ++i) {
+               if (kvm->vcpus[i]) {
+                       kvm_arch_vcpu_destroy(kvm->vcpus[i]);
+                       kvm->vcpus[i] = NULL;
+               }
+       }
+}
+
 void kvm_arch_destroy_vm(struct kvm *kvm)
 {
-       debug_unregister(kvm->arch.dbf);
+       kvm_free_vcpus(kvm);
        kvm_free_physmem(kvm);
        free_page((unsigned long)(kvm->arch.sca));
+       debug_unregister(kvm->arch.dbf);
        kfree(kvm);
-       module_put(THIS_MODULE);
 }
 
 /* Section: vcpu related */
        VM_EVENT(kvm, 3, "create cpu %d at %p, sie block at %p", id, vcpu,
                 vcpu->arch.sie_block);
 
-       try_module_get(THIS_MODULE);
-
        return vcpu;
 out_free_cpu:
        kfree(vcpu);
        return ERR_PTR(rc);
 }
 
-void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
-{
-       VCPU_EVENT(vcpu, 3, "%s", "destroy cpu");
-       free_page((unsigned long)(vcpu->arch.sie_block));
-       kfree(vcpu);
-       module_put(THIS_MODULE);
-}
-
 int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu)
 {
        /* kvm common code refers to this, but never calls it */