From: Julien Grall <julien.grall@linaro.org>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: patches@linaro.org, ian.campbell@citrix.com, xen-devel@lists.xen.org
Subject: Re: [PATCH 3/5] xen/arm: Don't reinject the IRQ if it's already in LRs
Date: Tue, 25 Jun 2013 14:55:12 +0100 [thread overview]
Message-ID: <51C9A140.80702@linaro.org> (raw)
In-Reply-To: <alpine.DEB.2.02.1306251417440.4782@kaball.uk.xensource.com>
On 06/25/2013 02:24 PM, Stefano Stabellini wrote:
> On Tue, 25 Jun 2013, Julien Grall wrote:
>> From: Julien Grall <julien.grall@linaro.org>
>>
>> When an IRQ, marked as IRQS_ONESHOT, is injected Linux will:
>> - Disable the IRQ
>> - Call the interrupt handler
>> - Conditionnally enable the IRQ
>> - EOI the IRQ
>>
>> When Linux will re-enable the IRQ, Xen will inject again the IRQ because it's
>> still inflight. Therefore, LRs will contains duplicated IRQs and Xen will
>> EOI it twice if it's a physical IRQ.
>>
>> Signed-off-by: Julien Grall <julien.grall@linaro.org>
>> ---
>> xen/arch/arm/gic.c | 27 +++++++++++++++++++++++++++
>> xen/arch/arm/vgic.c | 3 ++-
>> xen/include/asm-arm/gic.h | 3 +++
>> 3 files changed, 32 insertions(+), 1 deletion(-)
>>
>> diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
>> index 21575df..bf05716 100644
>> --- a/xen/arch/arm/gic.c
>> +++ b/xen/arch/arm/gic.c
>> @@ -570,6 +570,33 @@ int __init setup_dt_irq(const struct dt_irq *irq, struct irqaction *new)
>> return rc;
>> }
>>
>> +/* Check if an IRQ was already injected to the current VCPU */
>> +bool_t gic_irq_injected(unsigned int irq)
>
> Can you rename it to something more specific, like gic_irq_inlr?
>
>> +{
>> + bool_t found = 0;
>> + int i = 0;
>> + unsigned int virq;
>> +
>> + spin_lock_irq(&gic.lock);
>> +
>> + while ( (i = find_next_bit((unsigned long *)&this_cpu(lr_mask),
>> + nr_lrs, i)) < nr_lrs )
>> + {
>> + virq = GICH[GICH_LR + i] & GICH_LR_VIRTUAL_MASK;
>> +
>> + if ( virq == irq )
>> + {
>> + found = 1;
>> + break;
>> + }
>> + i++;
>> + }
>
> Instead of reading back all the GICH_LR registers, can't just just read
> the ones that have a corresponding bit set in lr_mask?
It's already the case, I use find_next_bit to find the next used LRs.
> Also you should be able to avoid having to read the GICH_LR registers by
> simply checking if the irq is in the lr_queue list: if an irq is in
> inflight but not in lr_queue, it means that it is in one of the LRs.
No. When a disabled IRQ is injected to the VCPU, Xen puts it in inflight
but not in lr_queue. We don't have a way to know whether the IRQ is
really in LRs or not.
--
Julien
next prev parent reply other threads:[~2013-06-25 13:55 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-24 23:04 [PATCH 0/5] Fix multiple issues with the interrupts on ARM Julien Grall
2013-06-24 23:04 ` [PATCH 1/5] xen/arm: Physical IRQ is not always equal to virtual IRQ Julien Grall
2013-06-25 13:16 ` Stefano Stabellini
2013-06-25 15:21 ` Julien Grall
2013-06-25 16:06 ` Ian Campbell
2013-06-24 23:04 ` [PATCH 2/5] xen/arm: Keep count of inflight interrupts Julien Grall
2013-06-25 16:12 ` Ian Campbell
2013-06-25 16:58 ` Stefano Stabellini
2013-06-25 17:46 ` Julien Grall
2013-06-25 18:38 ` Stefano Stabellini
2013-06-26 10:59 ` Ian Campbell
2013-06-26 11:10 ` Stefano Stabellini
2013-06-26 11:16 ` Ian Campbell
2013-06-26 10:58 ` Ian Campbell
2013-06-26 11:08 ` Stefano Stabellini
2013-06-26 11:15 ` Ian Campbell
2013-06-26 11:23 ` Stefano Stabellini
2013-06-26 11:41 ` Ian Campbell
2013-06-26 11:50 ` Stefano Stabellini
2013-06-26 11:57 ` Ian Campbell
2013-06-26 14:02 ` Stefano Stabellini
2013-06-24 23:04 ` [PATCH 3/5] xen/arm: Don't reinject the IRQ if it's already in LRs Julien Grall
2013-06-25 13:24 ` Stefano Stabellini
2013-06-25 13:55 ` Julien Grall [this message]
2013-06-25 16:36 ` Stefano Stabellini
2013-06-25 16:46 ` Ian Campbell
2013-06-25 17:05 ` Stefano Stabellini
2013-06-26 10:53 ` Ian Campbell
2013-06-26 11:19 ` Stefano Stabellini
2013-06-25 16:48 ` Julien Grall
2013-06-25 16:59 ` Stefano Stabellini
2013-06-25 16:14 ` Ian Campbell
2013-06-24 23:04 ` [PATCH 4/5] xen/arm: Rename gic_irq_{startup, shutdown} to gic_irq_{mask, unmask} Julien Grall
2013-06-24 23:04 ` [PATCH 5/5] xen/arm: Only enable physical IRQs when the guest asks Julien Grall
2013-06-25 16:19 ` Stefano Stabellini
2013-06-25 16:55 ` Julien Grall
2013-06-25 17:07 ` Stefano Stabellini
2013-12-02 17:26 ` Ian Campbell
2013-12-02 17:37 ` Stefano Stabellini
2013-06-25 16:28 ` Ian Campbell
2013-06-25 17:38 ` Julien Grall
2013-06-25 18:27 ` Stefano Stabellini
2013-06-26 10:55 ` Ian Campbell
2013-06-26 13:03 ` Julien Grall
2013-07-31 13:08 ` [PATCH 0/5] Fix multiple issues with the interrupts on ARM Andrii Anisov
2013-07-31 14:00 ` 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=51C9A140.80702@linaro.org \
--to=julien.grall@linaro.org \
--cc=ian.campbell@citrix.com \
--cc=patches@linaro.org \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xen.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).