All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@linaro.org>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: julien.grall@citrix.com, jtd@galois.com,
	xen-devel@lists.xensource.com, Ian.Campbell@citrix.com
Subject: Re: [PATCH v4 03/10] xen/arm: support HW interrupts, do not request maintenance_interrupts
Date: Wed, 19 Mar 2014 13:42:48 +0000	[thread overview]
Message-ID: <53299ED8.2050701@linaro.org> (raw)
In-Reply-To: <1395232325-19226-3-git-send-email-stefano.stabellini@eu.citrix.com>

Hi Stefano,

On 03/19/2014 12:31 PM, Stefano Stabellini wrote:

[..]

> @@ -625,16 +628,19 @@ int __init setup_dt_irq(const struct dt_irq *irq, struct irqaction *new)
>  static inline void gic_set_lr(int lr, struct pending_irq *p,
>          unsigned int state)
>  {
> -    int maintenance_int = GICH_LR_MAINTENANCE_IRQ;
> +    uint32_t lr_reg;
>  
>      BUG_ON(lr >= nr_lrs);
>      BUG_ON(lr < 0);
>      BUG_ON(state & ~(GICH_LR_STATE_MASK<<GICH_LR_STATE_SHIFT));
>  
> -    GICH[GICH_LR + lr] = state |
> -        maintenance_int |
> -        ((p->priority >> 3) << GICH_LR_PRIORITY_SHIFT) |
> +    lr_reg = state | ((p->priority >> 3) << GICH_LR_PRIORITY_SHIFT) |
>          ((p->irq & GICH_LR_VIRTUAL_MASK) << GICH_LR_VIRTUAL_SHIFT);
> +    if ( p->desc != NULL )
> +        lr_reg |= GICH_LR_HW |
> +            ((p->desc->irq & GICH_LR_PHYSICAL_MASK) << GICH_LR_PHYSICAL_SHIFT);
> +
> +    GICH[GICH_LR + lr] = lr_reg;
>  
>      set_bit(GIC_IRQ_GUEST_VISIBLE, &p->status);
>      clear_bit(GIC_IRQ_GUEST_PENDING, &p->status);
> @@ -669,7 +675,7 @@ void gic_remove_from_queues(struct vcpu *v, unsigned int virtual_irq)
>      spin_unlock_irqrestore(&gic.lock, flags);
>  }
>  
> -void gic_set_guest_irq(struct vcpu *v, unsigned int virtual_irq,
> +void gic_set_guest_irq(struct vcpu *v, unsigned int irq,

Any reason to rename virtual_irq into irq?

[..]

> +static void gic_clear_lrs(struct vcpu *v)
> +{
> +    struct pending_irq *p;
> +    int i = 0, irq;
> +    uint32_t lr;
> +    bool_t inflight;
> +
> +    ASSERT(!local_irq_is_enabled());
> +
> +    while ((i = find_next_bit((const long unsigned int *) &this_cpu(lr_mask),
> +                              nr_lrs, i)) < nr_lrs) {
> +        lr = GICH[GICH_LR + i];
> +        if ( !(lr & (GICH_LR_PENDING|GICH_LR_ACTIVE)) )
> +        {
> +            inflight = 0;
> +            GICH[GICH_LR + i] = 0;
> +            clear_bit(i, &this_cpu(lr_mask));
> +
> +            irq = (lr >> GICH_LR_VIRTUAL_SHIFT) & GICH_LR_VIRTUAL_MASK;
> +            spin_lock(&gic.lock);

Not completely related to this patch ... taking gic.lock seems a bit too
strong here. The critical section only update data for the current
domain. It seems a bit stupid to block the other interrupt to handle
their interrupts at the same time.

Maybe introducing a dist lock would be a better solution?

[..]

>  void gic_dump_info(struct vcpu *v)
> diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
> index aab490c..566f0ff 100644
> --- a/xen/arch/arm/vgic.c
> +++ b/xen/arch/arm/vgic.c
> @@ -701,8 +701,7 @@ void vgic_vcpu_inject_irq(struct vcpu *v, unsigned int irq)
>          if ( (irq != current->domain->arch.evtchn_irq) ||
>               (!test_bit(GIC_IRQ_GUEST_VISIBLE, &n->status)) )
>              set_bit(GIC_IRQ_GUEST_PENDING, &n->status);
> -        spin_unlock_irqrestore(&v->arch.vgic.lock, flags);
> -        return;
> +        goto out;

We don't want to kick the other VCPU every time. I think it's enough
when the interrupt is updated.

Regards,

-- 
Julien Grall

  reply	other threads:[~2014-03-19 13:42 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-19 12:31 [PATCH v4 0/10] remove maintenance interrupts Stefano Stabellini
2014-03-19 12:31 ` [PATCH v4 01/10] xen/arm: no need to set HCR_VI when using the vgic to inject irqs Stefano Stabellini
2014-03-19 13:33   ` Julien Grall
2014-03-21 14:06   ` Ian Campbell
2014-03-19 12:31 ` [PATCH v4 02/10] xen/arm: remove unused virtual parameter from vgic_vcpu_inject_irq Stefano Stabellini
2014-03-19 12:31 ` [PATCH v4 03/10] xen/arm: support HW interrupts, do not request maintenance_interrupts Stefano Stabellini
2014-03-19 13:42   ` Julien Grall [this message]
2014-03-19 14:43     ` Stefano Stabellini
2014-03-19 15:11       ` Julien Grall
2014-03-19 15:53         ` Stefano Stabellini
2014-03-19 16:10           ` Julien Grall
2014-03-21 13:04   ` Ian Campbell
2014-03-21 15:55     ` Stefano Stabellini
2014-03-21 16:16       ` Ian Campbell
2014-03-24 12:11         ` Stefano Stabellini
2014-03-24 12:15           ` Ian Campbell
2014-03-19 12:31 ` [PATCH v4 04/10] xen/arm: set GICH_HCR_UIE if all the LRs are in use Stefano Stabellini
2014-03-19 13:49   ` Julien Grall
2014-03-21 13:06   ` Ian Campbell
2014-03-21 16:03     ` Stefano Stabellini
2014-03-21 13:07   ` Ian Campbell
2014-03-21 16:05     ` Stefano Stabellini
2014-03-19 12:32 ` [PATCH v4 05/10] xen/arm: keep track of the GICH_LR used for the irq in struct pending_irq Stefano Stabellini
2014-03-19 13:52   ` Julien Grall
2014-03-19 14:45     ` Stefano Stabellini
2014-03-21 13:11   ` Ian Campbell
2014-03-21 16:19     ` Stefano Stabellini
2014-03-21 16:25       ` Ian Campbell
2014-03-24 12:12         ` Stefano Stabellini
2014-03-19 12:32 ` [PATCH v4 06/10] xen/arm: s/gic_set_guest_irq/gic_raise_guest_irq Stefano Stabellini
2014-03-19 13:53   ` Julien Grall
2014-03-21 13:12   ` Ian Campbell
2014-03-21 16:20     ` Stefano Stabellini
2014-03-21 16:26       ` Ian Campbell
2014-03-19 12:32 ` [PATCH v4 07/10] xen/arm: call gic_clear_lrs on entry to the hypervisor Stefano Stabellini
2014-03-19 13:56   ` Julien Grall
2014-03-21 13:14   ` Ian Campbell
2014-03-21 16:34     ` Stefano Stabellini
2014-03-21 16:39       ` Ian Campbell
2014-03-24 12:24         ` Stefano Stabellini
2014-03-19 12:32 ` [PATCH v4 08/10] xen/arm: second irq injection while the first irq is still inflight Stefano Stabellini
2014-03-21 13:22   ` Ian Campbell
2014-03-21 16:46     ` Stefano Stabellini
2014-03-21 17:04       ` Ian Campbell
2014-03-24 12:54         ` Stefano Stabellini
2014-03-24 12:57           ` Ian Campbell
2014-03-24 16:41             ` Stefano Stabellini
2014-03-25 10:09               ` Ian Campbell
2014-03-19 12:32 ` [PATCH v4 09/10] xen/arm: don't protect GICH and lr_queue accesses with gic.lock Stefano Stabellini
2014-03-21 13:31   ` Ian Campbell
2014-03-21 17:07     ` Stefano Stabellini
2014-03-19 12:32 ` [PATCH v4 10/10] xen/arm: gic_events_need_delivery and irq priorities Stefano Stabellini
2014-03-19 14:00   ` Julien Grall
2014-03-20 11:03     ` Ian Campbell
2014-03-20 15:10       ` Julien Grall
2014-03-20 15:14         ` Ian Campbell
2014-03-21 13:42   ` Ian Campbell
2014-03-24 12:00     ` Stefano Stabellini
2014-03-24 12:05       ` Ian Campbell
2014-03-24 13:06         ` Stefano Stabellini
2014-03-24 16:06           ` Stefano Stabellini

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=53299ED8.2050701@linaro.org \
    --to=julien.grall@linaro.org \
    --cc=Ian.Campbell@citrix.com \
    --cc=jtd@galois.com \
    --cc=julien.grall@citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /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.