From: Julien Grall <julien.grall@linaro.org>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Oleksandr Tyshchenko <oleksandr.tyshchenko@globallogic.com>,
Ian Campbell <ian.campbell@citrix.com>,
xen-devel@lists.xen.org
Subject: Re: [PATCH v1 0/2] xen/arm: maintenance_interrupt SMP fix
Date: Wed, 29 Jan 2014 13:15:29 +0000 [thread overview]
Message-ID: <52E8FEF1.2080409@linaro.org> (raw)
In-Reply-To: <alpine.DEB.2.02.1401291144410.4373@kaball.uk.xensource.com>
On 29/01/14 11:46, Stefano Stabellini wrote:
> On Wed, 29 Jan 2014, Stefano Stabellini wrote:
>> On Wed, 29 Jan 2014, Oleksandr Tyshchenko wrote:
>>> Hello all,
>>>
>>> I just recollected about one hack which we created
>>> as we needed to route HW IRQ in domU.
>>>
>>> diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
>>> index 9d793ba..d0227b9 100644
>>> --- a/tools/libxl/libxl_create.c
>>> +++ b/tools/libxl/libxl_create.c
>>> @@ -989,8 +989,6 @@ static void domcreate_launch_dm(libxl__egc *egc,
>>> libxl__multidev *multidev,
>>>
>>> LOG(DEBUG, "dom%d irq %d", domid, irq);
>>>
>>> - ret = irq >= 0 ? xc_physdev_map_pirq(CTX->xch, domid, irq, &irq)
>>> - : -EOVERFLOW;
>>> if (!ret)
>>> ret = xc_domain_irq_permission(CTX->xch, domid, irq, 1);
>>> if (ret < 0) {
>>> diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
>>> index 2e4b11f..b54c08e 100644
>>> --- a/xen/arch/arm/vgic.c
>>> +++ b/xen/arch/arm/vgic.c
>>> @@ -85,7 +85,7 @@ int domain_vgic_init(struct domain *d)
>>> if ( d->domain_id == 0 )
>>> d->arch.vgic.nr_lines = gic_number_lines() - 32;
>>> else
>>> - d->arch.vgic.nr_lines = 0; /* We don't need SPIs for the guest */
>>> + d->arch.vgic.nr_lines = gic_number_lines() - 32; /* We do
>>> need SPIs for the guest */
>>>
>>> d->arch.vgic.shared_irqs =
>>> xzalloc_array(struct vgic_irq_rank, DOMAIN_NR_RANKS(d));
>>> diff --git a/xen/common/domctl.c b/xen/common/domctl.c
>>> index 75e2df3..ba88901 100644
>>> --- a/xen/common/domctl.c
>>> +++ b/xen/common/domctl.c
>>> @@ -29,6 +29,7 @@
>>> #include <asm/page.h>
>>> #include <public/domctl.h>
>>> #include <xsm/xsm.h>
>>> +#include <asm/gic.h>
>>>
>>> static DEFINE_SPINLOCK(domctl_lock);
>>> DEFINE_SPINLOCK(vcpu_alloc_lock);
>>> @@ -782,8 +783,11 @@ long
>>> do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
>>> ret = -EINVAL;
>>> else if ( xsm_irq_permission(XSM_HOOK, d, pirq, allow) )
>>> ret = -EPERM;
>>> - else if ( allow )
>>> - ret = pirq_permit_access(d, pirq);
>>> + else if ( allow ) {
>>> + struct dt_irq irq = {pirq + NR_LOCAL_IRQS,0};
>>> + ret = pirq_permit_access(d, irq.irq);
>>> + gic_route_irq_to_guest(d, &irq, "");
>>> + }
>>> else
>>> ret = pirq_deny_access(d, pirq);
>>> }
>>> (END)
>>>
>>> It seems, the following patch can violate the logic about routing
>>> physical IRQs only to CPU0.
>>> In gic_route_irq_to_guest() we need to call gic_set_irq_properties()
>>> where the one of the parameters is cpumask_of(smp_processor_id()).
>>> But in this part of code this function can be executed on CPU1. And as
>>> result this can cause to the fact that the wrong value would set to
>>> target CPU mask.
>>>
>>> Please, confirm my assumption.
>>
>> That is correct.
>>
>>
>>> If I am right we have to add a basic HW IRQ routing to DomU in a right way.
>>
>> We could add the cpumask parameter to gic_route_irq_to_guest. Or maybe
>> for now we could just hardcode the cpumask of cpu0
>> gic_route_irq_to_guest.
>>
>> However keep in mind that if you plan on routing SPIs to guests other
>> than dom0, receiving all the interrupts on cpu0 might not be great for
>> performances.
>
> Thinking twice about it, it might be the only acceptable change for 4.4.
In Xen upstream, gic_route_irq_to_guest is only called when the dom0 is
built (so on CPU0). I don't think we need this patch for Xen 4.4.
--
Julien Grall
next prev parent reply other threads:[~2014-01-29 13:15 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-27 17:33 [PATCH v1 0/2] xen/arm: maintenance_interrupt SMP fix Oleksandr Tyshchenko
2014-01-27 17:33 ` [PATCH v1 1/2] xen/arm: Add return value to smp_call_function_interrupt function Oleksandr Tyshchenko
2014-01-27 18:28 ` Stefano Stabellini
2014-01-27 17:33 ` [PATCH v1 2/2] xen/arm: Fix deadlock in on_selected_cpus function Oleksandr Tyshchenko
2014-01-27 19:00 ` Stefano Stabellini
2014-01-28 10:03 ` Ian Campbell
2014-01-28 14:00 ` Stefano Stabellini
2014-01-28 15:05 ` Ian Campbell
2014-01-28 16:02 ` Stefano Stabellini
2014-01-28 16:12 ` Ian Campbell
2014-01-28 16:23 ` Stefano Stabellini
2014-01-28 13:58 ` Stefano Stabellini
2014-01-30 11:58 ` Oleksandr Tyshchenko
2014-01-27 17:40 ` [PATCH v1 0/2] xen/arm: maintenance_interrupt SMP fix Ian Campbell
2014-01-27 17:51 ` Julien Grall
2014-01-28 19:25 ` Oleksandr Tyshchenko
2014-01-29 10:56 ` Oleksandr Tyshchenko
2014-01-29 11:42 ` Stefano Stabellini
2014-01-29 11:46 ` Stefano Stabellini
2014-01-29 13:15 ` Julien Grall [this message]
2014-02-04 15:32 ` Julien Grall
2014-02-04 16:20 ` [PATCH] xen/arm: route irqs to cpu0 Stefano Stabellini
2014-02-04 16:32 ` Julien Grall
2014-02-04 16:56 ` Oleksandr Tyshchenko
2014-02-19 13:43 ` Julien Grall
2014-02-19 13:53 ` Ian Campbell
2014-02-19 14:15 ` George Dunlap
2014-02-20 14:52 ` Stefano Stabellini
2014-02-21 11:12 ` George Dunlap
2014-02-21 11:59 ` Julien Grall
2014-02-21 12:07 ` George Dunlap
2014-01-29 13:07 ` [PATCH v1 0/2] xen/arm: maintenance_interrupt SMP fix Julien Grall
2014-01-29 13:22 ` Stefano Stabellini
2014-01-29 18:40 ` Oleksandr Tyshchenko
2014-01-29 18:43 ` Oleksandr Tyshchenko
2014-01-29 18:49 ` Julien Grall
2014-01-29 19:54 ` Oleksandr Tyshchenko
2014-01-30 0:42 ` Julien Grall
2014-01-30 13:24 ` Stefano Stabellini
2014-01-30 15:06 ` Oleksandr Tyshchenko
2014-01-30 15:35 ` Stefano Stabellini
2014-01-30 16:10 ` Oleksandr Tyshchenko
2014-01-30 17:18 ` Stefano Stabellini
2014-01-30 19:54 ` Oleksandr Tyshchenko
2014-01-30 21:47 ` Julien Grall
2014-01-31 1:57 ` Oleksandr Tyshchenko
2014-01-29 13:12 ` Julien Grall
2014-01-29 18:55 ` Oleksandr Tyshchenko
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=52E8FEF1.2080409@linaro.org \
--to=julien.grall@linaro.org \
--cc=ian.campbell@citrix.com \
--cc=oleksandr.tyshchenko@globallogic.com \
--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).