[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: xen/arm: Missing appropriate locking for the IOMMU (WAS Re: [PATCH v5 02/11] xen/arm: Add PHYSDEVOP_pci_device_(*add/remove) support for ARM)
- To: Julien Grall <julien@xxxxxxx>
- From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
- Date: Thu, 21 Oct 2021 13:52:48 +0000
- Accept-language: en-GB, en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Jy7QlzZooPuohQZ/c26XP8x/PPZTy952CU6Q8AEgGoM=; b=liV1KPBT/JQDhjTLtNjSuMw9SoqntC0Tbzohw5E4Bp9FqAeEScXNORTFSp64Rtra2yJ58pmBSaMEWPn6RVzzA9mvxzEUX2CO6Df0h5jmWBnn8qFkNVSqCBqM+L2BqPKIXz58r0npscfiHxlS9mFQnyRZY62SwUj5YjShCZGyQR1ZDNRKFa6ukE98STYV3TcENxWQpgfLUYBGXRtY35MgobdEjE2xTw0i5EBoKmgsmjfBTgB1FfpYoeeKT/PWJrkqYZMzkRQrQf7svpHzHmd119MTs1C6oKQh5E7MnXR/RDYQuXprcUMPEqXGVG2opYAHSNkRpyQIJLHzQrGLnGS+Mg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jH5uSJv4zp0XbxY2YFn53RlfeJ5Wdc3X/4wjDBt8gxE/wp4anFZR+6cYEC8nbDmHvNq8nbP72B4ek0+uC9+E2g27qccyMZ0P8U+r8D15b5km65Fikj7w2nxNFhMhGBUDevhnb0N2FGNDeYlQSFhc0RiOUWwv4wXqiSSbL6Jld0/2VFBmxVZ5fjhhiaj1haGJ0C1cJ6fnQJREIa5lROAWbxiNGN0SVAXZ30YDF+0i2PAtOCLGj0+wfKA3kQoBfnzPB//G29SQl+dVB95HobQJYfsnXze4BqAYQW8d1Yze+xI2zTtMG1wbfsp4iAa4ftzP1AR5AgbuDPLm0ByjZC0CQQ==
- Authentication-results-original: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=arm.com;
- Cc: Rahul Singh <Rahul.Singh@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andre Przywara <Andre.Przywara@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Delivery-date: Thu, 21 Oct 2021 13:53:08 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Nodisclaimer: true
- Original-authentication-results: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=arm.com;
- Thread-index: AQHXxl4YkvgVlFH7LEi1mWK2psfiI6vdbqqAgAAI9ACAAAGCAA==
- Thread-topic: xen/arm: Missing appropriate locking for the IOMMU (WAS Re: [PATCH v5 02/11] xen/arm: Add PHYSDEVOP_pci_device_(*add/remove) support for ARM)
Hi Julien,
> On 21 Oct 2021, at 14:47, Julien Grall <julien@xxxxxxx> wrote:
>
>
>
> On 21/10/2021 14:15, Bertrand Marquis wrote:
>> Hi Julien,
>
> Hi Bertand,
>
>>> On 21 Oct 2021, at 10:28, Julien Grall <julien@xxxxxxx> wrote:
>>>
>>> Hi all,
>>>
>>> While going through the passthrough code. I noticed that we don't have a
>>> common lock for the IOMMU between the PCI and DT code.
>>>
>>> This is going to be an issue given it would technically be possible to add
>>> a PCI device while assigning a DT.
>>>
>>> Rahul, Bertrand, Oleksandr, can you have a look at the issue?
>> Yes we can have a look at this.
>> Right now pci device add is done by dom0 so I do not think we have an issue
>> in practice unless I wrongly understood something
> This will depend on the XSM policy. With the default one, then yes I agree
> that only dom0 (we don't support hardware domain) can add PCI device.
>
> However, this restriction doesn't really matter here. You would be relying on
> dom0 to do the locking and AFAIK this doesn't exist. Instead, the admin would
> have to ensure that two don't happen at the same time.
>
> Anyway, I think Xen should take care of preventing concurrent IOMMU
> operations rather than relying on external subsystem (e.g. dom0) to do it. At
> least the Arm SMMU driver will rely the generic locking to modify atomically
> internal list.
Agree, was just trying to make sure I understood the problem correctly.
We will check that.
Cheers
Bertrand
>
> Cheers,
>
> --
> Julien Grall
|