xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrii Anisov <andrii.anisov@gmail.com>
To: andre.przywara@arm.com
Cc: xen-devel@lists.xenproject.org,
	Julien Grall <julien.grall@arm.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Andrii Anisov <andrii_anisov@epam.com>
Subject: Re: [PATCH] gic:vgic: avoid excessive conversions
Date: Tue, 20 Nov 2018 13:09:27 +0200	[thread overview]
Message-ID: <9730226f-c5a8-6623-bbf1-a829c21f74a0@gmail.com> (raw)
In-Reply-To: <1542386727-30311-1-git-send-email-andrii.anisov@gmail.com>

Hello Andre,


I'm going to change "gic_raise_guest_irq()" function interface.

Could you please comment my understanding of vgic-v3-its.c code below? 
So that I could fix it alongside the function interface change.

On 16.11.18 18:45, Andrii Anisov wrote:
> diff --git a/xen/arch/arm/vgic-v3-its.c b/xen/arch/arm/vgic-v3-its.c
> index 5b73c4e..193a28f 100644
> --- a/xen/arch/arm/vgic-v3-its.c
> +++ b/xen/arch/arm/vgic-v3-its.c
> @@ -447,7 +447,7 @@ static void update_lpi_vgic_status(struct vcpu *v, struct pending_irq *p)
>       {
>           if ( !list_empty(&p->inflight) &&
>                !test_bit(GIC_IRQ_GUEST_VISIBLE, &p->status) )

As I understand, the intention here is to reinsert an irq to 
`lr_pending` queue with an updated priority, just in case the irq is not 
yet visible to guests. You try to pass a `p->lpi_priority` to the 
`gic_raise_guest_irq` as a new priority. But, with the current 
implementation, that parameter is clearly ignored by the function. 
Moreover, it just could not be honored there, because 
`gic_raise_guest_irq` touches only `lr_pending` queue, while both 
`lr_pending` and `inflight_irqs` are sorted by `p->priority` and you 
can't change it while updating only one queue.

I guess here the irq should be removed from both queues first, then 
`p->priority` updated to `p->lpi_priority`, then irq should be 
reinserted to both queues.

What do you think about that?

> -            gic_raise_guest_irq(v, p->irq, p->lpi_priority);
> +            gic_raise_guest_irq(v, p);
>       }
>       else
The call below looks excessive to me. We can reach this branch in case 
`p->inflight` is empty or it is not empty, but irq is visible to guest. 
In both those cases irq can not be on lr_pending queue, so calling this 
function is just a wasting cpu cycles.
>           gic_remove_from_lr_pending(v, p);

-- 
Sincerely,
Andrii Anisov.


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2018-11-20 11:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-16 16:45 [PATCH] gic:vgic: avoid excessive conversions Andrii Anisov
2018-11-16 17:27 ` Julien Grall
2018-11-19 12:02   ` Andrii Anisov
2018-11-19 13:54     ` Julien Grall
2018-11-19 15:48       ` Andrii Anisov
2018-11-20 11:09 ` Andrii Anisov [this message]
2018-12-19 10:49   ` Andrii Anisov

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=9730226f-c5a8-6623-bbf1-a829c21f74a0@gmail.com \
    --to=andrii.anisov@gmail.com \
    --cc=andre.przywara@arm.com \
    --cc=andrii_anisov@epam.com \
    --cc=julien.grall@arm.com \
    --cc=sstabellini@kernel.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 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).