xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@arm.com>
To: Stefano Stabellini <sstabellini@kernel.org>
Cc: steve.capper@arm.com, shankerd@codeaurora.org,
	shannon.zhao@linaro.org, wei.chen@arm.com,
	xen-devel@lists.xen.org
Subject: Re: [RFC 8/8] xen/arm: acpi: route all unused IRQs to DOM0
Date: Wed, 22 Jun 2016 13:19:29 +0100	[thread overview]
Message-ID: <576A8251.6010803@arm.com> (raw)
In-Reply-To: <alpine.DEB.2.10.1606221238170.2575@sstabellini-ThinkPad-X260>

Hi Stefano,

On 22/06/16 12:44, Stefano Stabellini wrote:
> On Tue, 7 Jun 2016, Julien Grall wrote:
>> It is not possible to know which IRQs will be used by DOM0 when ACPI is
>> inuse. The approach implemented by this patch, will route all unused
>> IRQs to DOM0 before it has booted.
>>
>> The number of IRQs routed is based on the maximum SPIs supported by the
>> hardware (up to ~1000). However, some of them might not be wired. So we
>> would allocate resource for nothing.
>>
>> For each IRQ routed, Xen is allocating memory for irqaction (40 bytes)
>> and irq_guest (16 bytes). So in the worst case scenario ~54KB of memory
>> will be allocated. Given that ACPI will mostly be used by server, I
>> think it is a small drawback.
>
> Yeah, it's a pity. The patch is certainly an improvement and it would
> fix ACPI, which is currently broken, so I think it should go in pretty
> much as is. (See only one small comment below.)
>
> But I wonder if we could do something better by the next release. Have
> you considered using something like a tasklet to call
> route_irq_to_guest? The tasklet would be scheduled only after
> vgic_enable_irqs is called.
>
> Something like:
>
> - guest writes to GICD_ISENABLER
> - run vgic_enable_irqs
>    - enable tasklet
> - tasklet run
>    - call route_irq_to_guest
>
> ?

I remembered we talked about a such solution on IRC.

I have considered it and I have found multiple downsides, what do we do 
if the call to route_irq_to_guest fails? It is easy to make this call 
fail on ARM64 because there is no difference between xenheap and 
domheap. And there is no way to report this failure to the guest except 
crashing it.

Furthermore, we would need to take into account that the IRQ might be 
disabled by another CPU before the tasklet is called.

Finally, we would also need to plumb GICD_CTLR.RWP on GICv3 because the 
effects of the write will be differed. Which lead to the problem, what 
if the tasklet takes more than a 1s to be scheduled/executed?

I agree that the memory usage is "greater" (54KB on server with tens of 
gigabyte of memory), but I think the complexity of the code with tasklet 
outweigh the memory usage of this patch.

>
>
>> map_irq_to_domain is slightly reworked to remove the dependency on
>> device-tree. So the function can be also be used for ACPI and will
>> avoid code duplication.
>>
>> Signed-off-by: Julien Grall <julien.grall@arm.com>
>> ---
>>   xen/arch/arm/domain_build.c | 19 ++++++++-----------
>>   1 file changed, 8 insertions(+), 11 deletions(-)
>>
>> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
>> index 00dc07a..76d503d 100644
>> --- a/xen/arch/arm/domain_build.c
>> +++ b/xen/arch/arm/domain_build.c

[...]

>> @@ -1411,13 +1411,10 @@ static int acpi_permit_spi_access(struct domain *d)
>
> I would rename acpi_permit_spi_access to acpi_route_spis_to_dom0 or
> something like that, to reflect the change in behavior of the function.

Good point. I will do it in the next version.

Regards,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2016-06-22 12:19 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-07 16:48 [RFC 0/8] xen/arm: acpi: Support SPIs routing Julien Grall
2016-06-07 16:48 ` [RFC 1/8] xen/arm: gic: Consolidate the IRQ affinity set in a single place Julien Grall
2016-06-22 10:46   ` Stefano Stabellini
2016-06-07 16:48 ` [RFC 2/8] xen/arm: gic: Do not configure affinity for guest IRQ during routing Julien Grall
2016-06-22 10:54   ` Stefano Stabellini
2016-06-22 11:19     ` Julien Grall
2016-06-07 16:48 ` [RFC 3/8] xen/arm: gic: split set_irq_properties Julien Grall
2016-06-22 10:58   ` Stefano Stabellini
2016-06-07 16:48 ` [RFC 4/8] xen/arm: gic: set_type: Pass the type in parameter rather than in desc->arch.type Julien Grall
2016-06-22 11:25   ` Stefano Stabellini
2016-06-07 16:48 ` [RFC 5/8] xen/arm: gic: Document how gic_set_irq_type should be called Julien Grall
2016-06-22 11:00   ` Stefano Stabellini
2016-06-07 16:48 ` [RFC 6/8] Revert "xen/arm: warn the user that we cannot route SPIs to Dom0 on ACPI" Julien Grall
2016-06-22 11:01   ` Stefano Stabellini
2016-06-07 16:48 ` [RFC 7/8] xen/arm: Allow DOM0 to set the irq type when ACPI is inuse Julien Grall
2016-06-22 11:23   ` Stefano Stabellini
2016-06-22 11:46     ` Julien Grall
2016-06-22 11:49       ` Stefano Stabellini
2016-06-07 16:48 ` [RFC 8/8] xen/arm: acpi: route all unused IRQs to DOM0 Julien Grall
2016-06-22 11:44   ` Stefano Stabellini
2016-06-22 12:19     ` Julien Grall [this message]
2016-06-07 18:50 ` [RFC 0/8] xen/arm: acpi: Support SPIs routing Shanker Donthineni
2016-06-08 11:48   ` Shanker Donthineni
2016-06-08 11:49     ` Julien Grall
2016-06-08 12:11       ` Shanker Donthineni
2016-06-08 12:34         ` Julien Grall
2016-06-13 11:42           ` Julien Grall
2016-06-13 17:19             ` Shanker Donthineni
2016-06-13 17:20               ` 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=576A8251.6010803@arm.com \
    --to=julien.grall@arm.com \
    --cc=shankerd@codeaurora.org \
    --cc=shannon.zhao@linaro.org \
    --cc=sstabellini@kernel.org \
    --cc=steve.capper@arm.com \
    --cc=wei.chen@arm.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).