[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 12 Dec 2014 23:14:56 +0800
From: Feng Wu <feng.wu@...el.com>
To: tglx@...utronix.de, mingo@...hat.com, hpa@...or.com,
x86@...nel.org, gleb@...nel.org, pbonzini@...hat.com,
dwmw2@...radead.org, joro@...tes.org, alex.williamson@...hat.com,
jiang.liu@...ux.intel.com
Cc: eric.auger@...aro.org, linux-kernel@...r.kernel.org,
iommu@...ts.linux-foundation.org, kvm@...r.kernel.org,
Feng Wu <feng.wu@...el.com>
Subject: [v3 22/26] KVM: Define a wakeup worker thread for vCPU
Define a wakeup worker thread for a vCPU.
Signed-off-by: Feng Wu <feng.wu@...el.com>
---
include/linux/kvm_host.h | 1 +
virt/kvm/kvm_main.c | 9 +++++++++
2 files changed, 10 insertions(+)
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index ca9a393..3d7242c 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -249,6 +249,7 @@ struct kvm_vcpu {
int sigset_active;
sigset_t sigset;
struct kvm_vcpu_stat stat;
+ struct work_struct wakeup_worker;
#ifdef CONFIG_HAS_IOMEM
int mmio_needed;
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 25ffac9..ba53fd6 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -211,6 +211,13 @@ void kvm_make_scan_ioapic_request(struct kvm *kvm)
kvm_make_all_cpus_request(kvm, KVM_REQ_SCAN_IOAPIC);
}
+static void wakeup_thread(struct work_struct *work)
+{
+ struct kvm_vcpu *vcpu = container_of(work, struct kvm_vcpu,
+ wakeup_worker);
+ kvm_vcpu_kick(vcpu);
+}
+
int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id)
{
struct page *page;
@@ -224,6 +231,8 @@ int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id)
init_waitqueue_head(&vcpu->wq);
kvm_async_pf_vcpu_init(vcpu);
+ INIT_WORK(&vcpu->wakeup_worker, wakeup_thread);
+
page = alloc_page(GFP_KERNEL | __GFP_ZERO);
if (!page) {
r = -ENOMEM;
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists