From patchwork Mon Jul 6 01:55:14 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 34294 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n66K1WP9005491 for ; Mon, 6 Jul 2009 20:01:33 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753872AbZGFUBZ (ORCPT ); Mon, 6 Jul 2009 16:01:25 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753332AbZGFUBY (ORCPT ); Mon, 6 Jul 2009 16:01:24 -0400 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 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n66K1OV4028797; Mon, 6 Jul 2009 16:01:24 -0400 Received: from amt.cnet (vpn-51-10.sfbay.redhat.com [10.14.51.10]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n66K1MRC030074; Mon, 6 Jul 2009 16:01:23 -0400 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 25CAC5580AD; Mon, 6 Jul 2009 17:00:47 -0300 (BRT) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id n66K0jE5008092; Mon, 6 Jul 2009 17:00:45 -0300 Message-Id: <20090706015812.679196017@localhost.localdomain> References: <20090706015511.923596553@localhost.localdomain> User-Agent: quilt/0.46-1 Date: Sun, 05 Jul 2009 22:55:14 -0300 From: Marcelo Tosatti To: kvm@vger.kernel.org Cc: Marcelo Tosatti Subject: [patch 3/8] KVM: x86: per-vcpu timer list Content-Disposition: inline; filename=kvm-per-vcpu-timer-list X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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)