From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH RFC v2 2/4] Use pointer to vcpu instead of vcpu_id in timer code. Date: Tue, 26 May 2009 11:52:10 +0300 Message-ID: <20090526085210.GO3948@redhat.com> References: <1243266636-16914-1-git-send-email-gleb@redhat.com> <1243266636-16914-3-git-send-email-gleb@redhat.com> <4A1BA89D.8090003@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from mx2.redhat.com ([66.187.237.31]:34754 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753445AbZEZIwL (ORCPT ); Tue, 26 May 2009 04:52:11 -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 n4Q8qDP4005198 for ; Tue, 26 May 2009 04:52:13 -0400 Content-Disposition: inline In-Reply-To: <4A1BA89D.8090003@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, May 26, 2009 at 11:30:21AM +0300, Avi Kivity wrote: > Gleb Natapov wrote: >> Signed-off-by: Gleb Natapov >> --- >> arch/x86/kvm/i8254.c | 2 +- >> arch/x86/kvm/kvm_timer.h | 2 +- >> arch/x86/kvm/lapic.c | 2 +- >> arch/x86/kvm/timer.c | 2 +- >> 4 files changed, 4 insertions(+), 4 deletions(-) >> >> diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c >> index bcf755f..85d95ff 100644 >> --- a/arch/x86/kvm/i8254.c >> +++ b/arch/x86/kvm/i8254.c >> @@ -291,7 +291,7 @@ static void create_pit_timer(struct kvm_kpit_state *ps, u32 val, int is_period) >> pt->timer.function = kvm_timer_fn; >> pt->t_ops = &kpit_ops; >> pt->kvm = ps->pit->kvm; >> - pt->vcpu_id = 0; >> + pt->vcpu = pt->kvm->bsp_vcpu; >> >> > > bsp_vcpu might not have been initialized at this time? > There is only two code path that may lead to this code. First one is from pit_ioport_write() and at this stage BSP is already executing code and thus exists. The second is during migration and vcpus are created before incoming migration is accepted. May be BUG_ON() is appropriate here. -- Gleb.