All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Campbell <Ian.Campbell@citrix.com>
To: Julien Grall <julien.grall@linaro.org>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: xen-devel@lists.xenproject.org, stefano.stabellini@citrix.com,
	tim@xen.org
Subject: Re: [PATCH for-4.5] xen/arm: Fix virtual timer on ARMv8 Model
Date: Thu, 27 Nov 2014 10:40:37 +0000	[thread overview]
Message-ID: <1417084837.12784.5.camel@citrix.com> (raw)
In-Reply-To: <1416937469-8162-1-git-send-email-julien.grall@linaro.org>

On Tue, 2014-11-25 at 17:44 +0000, Julien Grall wrote:
> ARMv8 model may not disable correctly the timer interrupt when Xen

"correct disable"

> context switch to an idle vCPU. Therefore Xen may receive a spurious

"context switches" and s/spurious/unexpected/ (since spurious has a
specific meaning in the h/w which does not match what is happening here)

> timer interrupt. As the idle domain doesn't have vGIC, Xen will crash
> when trying to inject the interrupt with the following stack trace.
> 
> (XEN)    [<0000000000228388>] _spin_lock_irqsave+0x28/0x94 (PC)
> (XEN)    [<0000000000228380>] _spin_lock_irqsave+0x20/0x94 (LR)
> (XEN)    [<0000000000250510>] vgic_vcpu_inject_irq+0x40/0x1b0
> (XEN)    [<000000000024bcd0>] vtimer_interrupt+0x4c/0x54
> (XEN)    [<0000000000247010>] do_IRQ+0x1a4/0x220
> (XEN)    [<0000000000244864>] gic_interrupt+0x50/0xec
> (XEN)    [<000000000024fbac>] do_trap_irq+0x20/0x2c
> (XEN)    [<0000000000255240>] hyp_irq+0x5c/0x60
> (XEN)    [<0000000000241084>] context_switch+0xb8/0xc4
> (XEN)    [<000000000022482c>] schedule+0x684/0x6d0
> (XEN)    [<000000000022785c>] __do_softirq+0xcc/0xe8
> (XEN)    [<00000000002278d4>] do_softirq+0x14/0x1c
> (XEN)    [<0000000000240fac>] idle_loop+0x134/0x154
> (XEN)    [<000000000024c160>] start_secondary+0x14c/0x15c
> (XEN)    [<0000000000000001>] 0000000000000001
> 
> While we receive spurious virtual timer interrupt, this could be safely
> ignore for the time being. A proper fix need to be found for Xen 4.6.
> 
> Signed-off-by: Julien Grall <julien.grall@linaro.org>

Acked-by: Ian Campbell <ian.campbell@citrix.com>

Although I wonder if we should log, perhaps rate limited or only once.

Also, I've some grammar nits (above and below) which I can fix on commit
if there is no resend...

> 
> ---
> 
> This patch is a bug fix candidate for Xen 4.5. Any ARMv8 model may
> randomly crash when running Xen.

CCing Konrad.

> This patch don't inject the virtual timer interrupt if the current VCPU
> is the idle one. Entering in this function with the idle VCPU is already
> a bug itself. For now, I think this patch is the safest way to resolve
> the problem.
> 
> Meanwhile, I'm investigating with ARM to see wheter the bug comes from
> Xen or the model.
> ---
>  xen/arch/arm/time.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/xen/arch/arm/time.c b/xen/arch/arm/time.c
> index a6436f1..83c74cb 100644
> --- a/xen/arch/arm/time.c
> +++ b/xen/arch/arm/time.c
> @@ -169,6 +169,14 @@ static void timer_interrupt(int irq, void *dev_id, struct cpu_user_regs *regs)
>  
>  static void vtimer_interrupt(int irq, void *dev_id, struct cpu_user_regs *regs)
>  {
> +    /*
> +     * ARMv8 model may not disable correctly the timer interrupt when

"correctly disable"

> +     * Xen context switch to an idle vCPU. Therefore Xen may receive

"context switches" and "may receive an unexpected timer interrupt"

> +     * timer interrupt.
> +     */
> +    if ( is_idle_vcpu(current) )
> +        return;
> +
>      current->arch.virt_timer.ctl = READ_SYSREG32(CNTV_CTL_EL0);
>      WRITE_SYSREG32(current->arch.virt_timer.ctl | CNTx_CTL_MASK, CNTV_CTL_EL0);
>      vgic_vcpu_inject_irq(current, current->arch.virt_timer.irq);

  reply	other threads:[~2014-11-27 10:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-25 17:44 [PATCH for-4.5] xen/arm: Fix virtual timer on ARMv8 Model Julien Grall
2014-11-27 10:40 ` Ian Campbell [this message]
2014-11-27 10:51   ` Stefano Stabellini
2014-11-27 12:46     ` Julien Grall
2014-11-27 12:49   ` Julien Grall
2014-11-27 18:02 ` Julien Grall
2014-11-28 11:47   ` Ian Campbell
2014-11-28 12:48     ` Julien Grall
2014-11-28 13:10       ` Ian Campbell
2014-11-28 12:32   ` Ian Campbell
2014-11-28 12:49     ` Julien Grall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1417084837.12784.5.camel@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=julien.grall@linaro.org \
    --cc=konrad.wilk@oracle.com \
    --cc=stefano.stabellini@citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.