From: Roman Kagan <rkagan@virtuozzo.com>
To: kvm@vger.kernel.org, "Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>
Cc: "Denis V. Lunev" <den@openvz.org>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
David Hildenbrand <david@redhat.com>
Subject: [PATCH v5 1/2] kvm: x86: factor out kvm.arch.hyperv (de)init
Date: Tue, 12 Dec 2017 19:07:41 +0300 [thread overview]
Message-ID: <20171212160742.793-2-rkagan@virtuozzo.com> (raw)
In-Reply-To: <20171212160742.793-1-rkagan@virtuozzo.com>
Move kvm.arch.hyperv initialization and cleanup to separate functions.
For now only a mutex is inited in the former, and the latter is empty;
more stuff will go in there in a followup patch.
Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
---
v3 -> v4 -> v5:
no change
v2 -> v3:
- style fixes
v1 -> v2:
- fix subject prefix
arch/x86/kvm/hyperv.h | 3 +++
arch/x86/kvm/hyperv.c | 9 +++++++++
arch/x86/kvm/x86.c | 3 ++-
3 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kvm/hyperv.h b/arch/x86/kvm/hyperv.h
index e637631a9574..cc2468244ca2 100644
--- a/arch/x86/kvm/hyperv.h
+++ b/arch/x86/kvm/hyperv.h
@@ -88,4 +88,7 @@ void kvm_hv_process_stimers(struct kvm_vcpu *vcpu);
void kvm_hv_setup_tsc_page(struct kvm *kvm,
struct pvclock_vcpu_time_info *hv_clock);
+void kvm_hv_init_vm(struct kvm *kvm);
+void kvm_hv_destroy_vm(struct kvm *kvm);
+
#endif
diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c
index dc97f2544b6f..015fb06c7522 100644
--- a/arch/x86/kvm/hyperv.c
+++ b/arch/x86/kvm/hyperv.c
@@ -1301,3 +1301,12 @@ int kvm_hv_hypercall(struct kvm_vcpu *vcpu)
kvm_hv_hypercall_set_result(vcpu, ret);
return 1;
}
+
+void kvm_hv_init_vm(struct kvm *kvm)
+{
+ mutex_init(&kvm->arch.hyperv.hv_lock);
+}
+
+void kvm_hv_destroy_vm(struct kvm *kvm)
+{
+}
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index faf843c9b916..d17cf7900138 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -8148,7 +8148,6 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
raw_spin_lock_init(&kvm->arch.tsc_write_lock);
mutex_init(&kvm->arch.apic_map_lock);
- mutex_init(&kvm->arch.hyperv.hv_lock);
spin_lock_init(&kvm->arch.pvclock_gtod_sync_lock);
kvm->arch.kvmclock_offset = -ktime_get_boot_ns();
@@ -8157,6 +8156,7 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
INIT_DELAYED_WORK(&kvm->arch.kvmclock_update_work, kvmclock_update_fn);
INIT_DELAYED_WORK(&kvm->arch.kvmclock_sync_work, kvmclock_sync_fn);
+ kvm_hv_init_vm(kvm);
kvm_page_track_init(kvm);
kvm_mmu_init_vm(kvm);
@@ -8291,6 +8291,7 @@ void kvm_arch_destroy_vm(struct kvm *kvm)
kvfree(rcu_dereference_check(kvm->arch.apic_map, 1));
kvm_mmu_uninit_vm(kvm);
kvm_page_track_cleanup(kvm);
+ kvm_hv_destroy_vm(kvm);
}
void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
--
2.14.3
next prev parent reply other threads:[~2017-12-12 16:07 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-12 16:07 [PATCH v5 0/2] kvm: x86: hyperv: guest->host event signaling via eventfd Roman Kagan
2017-12-12 16:07 ` Roman Kagan [this message]
2017-12-12 16:07 ` [PATCH v5 2/2] " Roman Kagan
2017-12-12 16:22 ` Paolo Bonzini
2017-12-12 16:29 ` David Hildenbrand
2017-12-12 18:18 ` Roman Kagan
2017-12-12 18:20 ` David Hildenbrand
2017-12-13 8:41 ` Roman Kagan
2017-12-13 9:35 ` David Hildenbrand
2017-12-13 10:00 ` Roman Kagan
2017-12-12 17:03 ` Roman Kagan
2017-12-13 9:51 ` David Hildenbrand
2017-12-13 11:04 ` Roman Kagan
2017-12-13 11:14 ` David Hildenbrand
2017-12-13 12:16 ` Roman Kagan
2017-12-13 9:55 ` David Hildenbrand
2017-12-13 11:44 ` Roman Kagan
2017-12-13 11:46 ` David Hildenbrand
2017-12-13 11:51 ` David Hildenbrand
2017-12-13 11:57 ` David Hildenbrand
2017-12-13 12:58 ` Roman Kagan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171212160742.793-2-rkagan@virtuozzo.com \
--to=rkagan@virtuozzo.com \
--cc=david@redhat.com \
--cc=den@openvz.org \
--cc=konrad.wilk@oracle.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=vkuznets@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.