From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: [patch 3/8] KVM: x86: per-vcpu timer list Date: Sun, 05 Jul 2009 22:55:14 -0300 Message-ID: <20090706015812.679196017@localhost.localdomain> References: <20090706015511.923596553@localhost.localdomain> Cc: Marcelo Tosatti To: kvm@vger.kernel.org Return-path: Received: from mx2.redhat.com ([66.187.237.31]:39618 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752744AbZGFUBV (ORCPT ); Mon, 6 Jul 2009 16:01:21 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n66K1PWk013628 for ; Mon, 6 Jul 2009 16:01:25 -0400 Content-Disposition: inline; filename=kvm-per-vcpu-timer-list Sender: kvm-owner@vger.kernel.org List-ID: Add a per-vcpu list of (emulated) timers. Signed-off-by: Marcelo Tosatti Index: kvm-new/arch/x86/include/asm/kvm_host.h =================================================================== --- kvm-new.orig/arch/x86/include/asm/kvm_host.h +++ kvm-new/arch/x86/include/asm/kvm_host.h @@ -375,6 +375,8 @@ struct kvm_vcpu_arch { u64 mcg_status; u64 mcg_ctl; u64 *mce_banks; + + struct list_head timers; }; struct kvm_mem_alias { Index: kvm-new/arch/x86/kvm/kvm_timer.h =================================================================== --- kvm-new.orig/arch/x86/kvm/kvm_timer.h +++ kvm-new/arch/x86/kvm/kvm_timer.h @@ -7,6 +7,7 @@ struct kvm_timer { bool periodic; struct kvm *kvm; struct kvm_vcpu *vcpu; + struct list_head vcpu_timer; }; void kvm_timer_init(struct kvm *kvm, struct kvm_timer *ktimer); Index: kvm-new/arch/x86/kvm/x86.c =================================================================== --- kvm-new.orig/arch/x86/kvm/x86.c +++ kvm-new/arch/x86/kvm/x86.c @@ -4644,6 +4644,8 @@ int kvm_arch_vcpu_init(struct kvm_vcpu * BUG_ON(vcpu->kvm == NULL); kvm = vcpu->kvm; + INIT_LIST_HEAD(&vcpu->arch.timers); + vcpu->arch.mmu.root_hpa = INVALID_PAGE; if (!irqchip_in_kernel(kvm) || kvm_vcpu_is_bsp(vcpu)) vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE; Index: kvm-new/arch/x86/kvm/timer.c =================================================================== --- kvm-new.orig/arch/x86/kvm/timer.c +++ kvm-new/arch/x86/kvm/timer.c @@ -53,11 +53,13 @@ void kvm_timer_init(struct kvm *kvm, str ktimer->kvm = kvm; hrtimer_init(&ktimer->timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); ktimer->timer.function = kvm_timer_fn; + INIT_LIST_HEAD(&ktimer->vcpu_timer); } void kvm_timer_vcpu_bind(struct kvm_timer *ktimer, struct kvm_vcpu *vcpu) { ktimer->vcpu = vcpu; + list_add(&ktimer->vcpu_timer, &vcpu->arch.timers); } void kvm_timer_start(struct kvm_timer *ktimer, u64 interval, bool periodic) --