From: Ian Campbell Subject: Re: [PATCH v4 11/12] xen/arm: run the vtimer Xen timers on the pcpu the vcpu is running on Date: Mon, 29 Apr 2013 15:06:07 +0100 Message-ID: <1367244367.3142.290.camel@zakaz.uk.xensource.com> References: <1366990117-8689-11-git-send-email-stefano.stabellini@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1366990117-8689-11-git-send-email-stefano.stabellini@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini Cc: Julien Grall , "xen-devel@lists.xensource.com" , "Tim (Xen.org)" List-Id: xen-devel@lists.xenproject.org On Fri, 2013-04-26 at 16:28 +0100, Stefano Stabellini wrote: > The Xen physical timer emulator and virtual timer driver use two > internal Xen timers: initialize them on the pcpu the vcpu is running on, > rather than the processor that it's creating the vcpu. > > On vcpu restore migrate the phys_timer and the virt_timer to the > pcpu the vcpu is running on. > > Signed-off-by: Stefano Stabellini In so far as I understand Xen's timer architecture: Acked-by: Ian Campbell > Changes in v4: > - migrate Xen timers on virt_timer_restore. > --- > xen/arch/arm/vtimer.c | 6 ++++-- > 1 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/xen/arch/arm/vtimer.c b/xen/arch/arm/vtimer.c > index 1cb365e..393aac3 100644 > --- a/xen/arch/arm/vtimer.c > +++ b/xen/arch/arm/vtimer.c > @@ -48,7 +48,7 @@ int vcpu_vtimer_init(struct vcpu *v) > { > struct vtimer *t = &v->arch.phys_timer; > > - init_timer(&t->timer, phys_timer_expired, t, smp_processor_id()); > + init_timer(&t->timer, phys_timer_expired, t, v->processor); > t->ctl = 0; > t->offset = NOW(); > t->cval = NOW(); > @@ -56,7 +56,7 @@ int vcpu_vtimer_init(struct vcpu *v) > t->v = v; > > t = &v->arch.virt_timer; > - init_timer(&t->timer, virt_timer_expired, t, smp_processor_id()); > + init_timer(&t->timer, virt_timer_expired, t, v->processor); > t->ctl = 0; > t->offset = READ_SYSREG64(CNTVCT_EL0) + READ_SYSREG64(CNTVOFF_EL2); > t->cval = 0; > @@ -95,6 +95,8 @@ int virt_timer_restore(struct vcpu *v) > return 0; > > stop_timer(&v->arch.virt_timer.timer); > + migrate_timer(&v->arch.virt_timer.timer, v->processor); > + migrate_timer(&v->arch.phys_timer.timer, v->processor); > > WRITE_SYSREG64(v->arch.virt_timer.offset, CNTVOFF_EL2); > WRITE_SYSREG64(v->arch.virt_timer.cval, CNTV_CVAL_EL0);