From: Henry Wang <xin.wang2@amd.com>
To: Julien Grall <julien@xen.org>, <xen-devel@lists.xenproject.org>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
Bertrand Marquis <bertrand.marquis@arm.com>,
Michal Orzel <michal.orzel@amd.com>,
"Volodymyr Babchuk" <Volodymyr_Babchuk@epam.com>,
Stefano Stabellini <stefano.stabellini@xilinx.com>
Subject: Re: [PATCH 02/15] xen/arm/gic: Enable interrupt assignment to running VM
Date: Wed, 8 May 2024 15:49:43 +0800 [thread overview]
Message-ID: <8957ab21-796f-4e15-a89e-d040e6f7b5ca@amd.com> (raw)
In-Reply-To: <f30f7599-6bcd-4b8d-bd1f-6afde18c14c8@xen.org>
Hi Julien,
On 5/8/2024 5:54 AM, Julien Grall wrote:
> Hi Henry,
>>> What if the DT overlay is unloaded and then reloaded? Wouldn't the
>>> same interrupt be re-used? As a more generic case, this could also
>>> be a new bitstream for the FPGA.
>>>
>>> But even if the interrupt is brand new every time for the DT
>>> overlay, you are effectively relaxing the check for every user (such
>>> as XEN_DOMCTL_bind_pt_irq). So the interrupt re-use case needs to be
>>> taken into account.
>>
>> I agree. I think IIUC, with your explanation here and below, could we
>> simplify the problem to how to properly handle the removal of the IRQ
>> from a running guest, if we always properly remove and clean up the
>> information when remove the IRQ from the guest? In this way, the IRQ
>> can always be viewed as a brand new one when we add it back.
>
> If we can make sure the virtual IRQ and physical IRQ is cleaned then yes.
>
>> Then the only corner case that we need to take care of would be...
>
> Can you clarify whether you say the "only corner case" because you
> looked at the code? Or is it just because I mentioned only one?
Well, I indeed checked the code and to my best knowledge the corner case
that you pointed out would be the only one I can think of.
>>> Xen allows the guest to enable a vIRQ even if there is no pIRQ
>>> assigned. Thanksfully, it looks like the vgic_connect_hw_irq(), in
>>> both the current and new vGIC, will return an error if we are trying
>>> to route a pIRQ to an already enabled vIRQ.
>>>
>>> But we need to investigate all the possible scenarios to make sure
>>> that any inconsistencies between the physical state and virtual
>>> state (including the LRs) will not result to bigger problem.
>>>
>>> The one that comes to my mind is: The physical interrupt is
>>> de-assigned from the guest before it was EOIed. In this case, the
>>> interrupt will still be in the LR with the HW bit set. This would
>>> allow the guest to EOI the interrupt even if it is routed to someone
>>> else. It is unclear what would be the impact on the other guest.
>>
>> ...same as this case, i.e.
>> test_bit(_IRQ_INPROGRESS, &desc->status) || !test_bit(_IRQ_DISABLED,
>> &desc->status)) when we try to remove the IRQ from a running domain.
>
> We already call ->shutdown() which will disable the IRQ. So don't we
> only need to take care of _IRQ_INPROGRESS?
Yes you are correct.
>> we have 3 possible states which can be read from LR for this case :
>> active, pending, pending and active.
>> - I don't think we can do anything about the active state, so we
>> should return -EBUSY and reject the whole operation of removing the
>> IRQ from running guest, and user can always retry this operation.
>
> This would mean a malicious/buggy guest would be able to prevent a
> device to be de-assigned. This is not a good idea in particular when
> the domain is dying.
>
> That said, I think you can handle this case. The LR has a bit to
> indicate whether the pIRQ needs to be EOIed. You can clear it and this
> would prevent the guest to touch the pIRQ. There might be other
> clean-up to do in the vGIC datastructure.
I probably misunderstood this sentence, do you mean the EOI bit in the
pINTID field? I think this bit is only available when the HW bit of LR
is 0, but in our case the HW is supposed to be 1 (as indicated as your
previous comment). Would you mind clarifying a bit more? Thanks!
> Anyway, we don't have to handle removing an active IRQ when the domain
> is still running (although we do when the domain is destroying). But I
> think this would need to be solved before the feature is (security)
> supported.
>
>> - For the pending (and active) case,
>
> Shouldn't the pending and active case handled the same way as the
> active case?
Sorry, yes you are correct.
Kind regards,
Henry
next prev parent reply other threads:[~2024-05-08 7:50 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-24 3:34 [PATCH 00/15] Remaining patches for dynamic node programming using overlay dtbo Henry Wang
2024-04-24 3:34 ` [PATCH 01/15] xen/commom/dt-overlay: Fix missing lock when remove the device Henry Wang
2024-04-24 5:58 ` Jan Beulich
2024-04-24 6:02 ` Henry Wang
2024-04-24 3:34 ` [PATCH 02/15] xen/arm/gic: Enable interrupt assignment to running VM Henry Wang
2024-04-24 12:58 ` Julien Grall
2024-04-25 7:06 ` Henry Wang
2024-04-25 14:28 ` Julien Grall
2024-04-30 3:50 ` Henry Wang
2024-04-30 20:13 ` Julien Grall
2024-05-06 8:32 ` Henry Wang
2024-05-07 21:54 ` Julien Grall
2024-05-08 7:49 ` Henry Wang [this message]
2024-05-08 20:46 ` Julien Grall
2024-05-09 15:31 ` Henry Wang
2024-05-10 8:54 ` Julien Grall
2024-05-11 7:29 ` Henry Wang
2024-05-11 8:22 ` Julien Grall
2024-05-11 8:35 ` Henry Wang
2024-04-24 3:34 ` [PATCH 03/15] xen/arm: Always enable IOMMU Henry Wang
2024-04-24 13:03 ` Julien Grall
2024-04-25 1:02 ` Henry Wang
2024-04-24 3:34 ` [PATCH 04/15] tools/libs/light: " Henry Wang
2024-05-01 13:47 ` Anthony PERARD
2024-05-06 3:17 ` Henry Wang
2024-04-24 3:34 ` [PATCH 05/15] tools/libs/light: Increase nr_spi to 160 Henry Wang
2024-05-01 13:58 ` Anthony PERARD
2024-05-06 5:17 ` Henry Wang
2024-05-07 14:35 ` Julien Grall
2024-05-08 0:46 ` Henry Wang
2024-04-24 3:34 ` [PATCH 06/15] rangeset: Move struct range and struct rangeset to headerfile Henry Wang
2024-04-24 6:22 ` Jan Beulich
2024-04-25 0:47 ` Henry Wang
2024-04-24 3:34 ` [PATCH 07/15] xen/overlay: Enable device tree overlay assignment to running domains Henry Wang
2024-04-24 6:05 ` Jan Beulich
2024-04-29 3:36 ` Henry Wang
2024-04-29 6:43 ` Jan Beulich
2024-04-29 17:34 ` Julien Grall
2024-04-30 4:00 ` Henry Wang
2024-04-30 9:47 ` Julien Grall
2024-05-06 5:26 ` Henry Wang
2024-05-02 18:02 ` Stefano Stabellini
2024-05-06 3:14 ` Henry Wang
2024-04-24 3:34 ` [PATCH 08/15] tools: Add domain_id and expert mode for overlay operations Henry Wang
2024-05-01 14:46 ` Anthony PERARD
2024-05-06 5:51 ` Henry Wang
2024-04-24 3:34 ` [PATCH 09/15] tools/libs/light: Modify dtbo to domU linux dtbo format Henry Wang
2024-05-01 15:09 ` Anthony PERARD
2024-05-06 5:40 ` Henry Wang
2024-04-24 3:34 ` [PATCH 10/15] tools/xl: Share overlay with domU Henry Wang
2024-04-24 3:34 ` [PATCH 11/15] tools/helpers: Add get_overlay Henry Wang
2024-04-24 6:08 ` Jan Beulich
2024-04-25 0:43 ` Henry Wang
2024-04-26 1:45 ` Stewart Hildebrand
2024-04-26 1:48 ` Henry Wang
2024-04-24 3:34 ` [PATCH 12/15] get_overlay: remove domU overlay Henry Wang
2024-04-24 3:34 ` [PATCH 13/15] xl/overlay: add remove operation to xenstore Henry Wang
2024-04-24 3:34 ` [PATCH 14/15] add a domU script to fetch overlays and applying them to linux Henry Wang
2024-04-24 6:16 ` Jan Beulich
2024-04-25 0:54 ` Henry Wang
2024-04-25 6:46 ` Jan Beulich
2024-04-25 7:06 ` Henry Wang
2024-04-24 3:34 ` [PATCH 15/15] docs: add device tree overlay documentation Henry Wang
2024-04-24 6:29 ` [PATCH 00/15] Remaining patches for dynamic node programming using overlay dtbo Jan Beulich
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=8957ab21-796f-4e15-a89e-d040e6f7b5ca@amd.com \
--to=xin.wang2@amd.com \
--cc=Volodymyr_Babchuk@epam.com \
--cc=bertrand.marquis@arm.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=sstabellini@kernel.org \
--cc=stefano.stabellini@xilinx.com \
--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).