[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 8/8] xen/arm: Add support for SMMUv3 driver


  • To: Julien Grall <julien@xxxxxxx>
  • From: Rahul Singh <Rahul.Singh@xxxxxxx>
  • Date: Mon, 7 Dec 2020 18:42:40 +0000
  • Accept-language: 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-SenderADCheck; bh=p01CoVpdQE0NVlpZRY0LQOE/3ZsylSlgSX9tml/Dv8w=; b=RSdxeB3y+1ER6EoEtryQ5byhJqogbtgjInLvrBPKGH01XrZ92TrsTOBFCVeZWlKBRHp96UnTkAj2tYkDvO4aesPxsEbWcemRwrQ7+9XQqrW16kJHVlB1ORHrNVaMIkc1w8QIqKbZ8GL/09yJNEaxSIx4kvqxAhTRSq2sTpYHHCd76H4hv/b2rvrhoy+YhQdKrWEXAP8vRu1wTQAb5BLYBbN37PUzu0fpdwoo27aAQtFKwB7uJstQFuI5G5mdYTOeccrpihLEIo067Js2i/ZDUgJyFkBmH6z2uayylygq+nbb07zNQuOOZucXy+2VwMeefmCuxQrTN7eWQvUxn/owVg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IhPdYSXKcuQJqiaOY6FDzFGUssWwIqtZXZ4IIpSu9/XRx97vQHHvxy9/tSF0y4+dLq6TTZIH0ZZ2J9gX1CVVKDH6AkyLYGhDMANTGJSjlqm080dfr0jmEJpeVRh99Ac8djtlowBxy9e2e/VEuZkC8iIjyNpgiXiFPm2VSCYcJZ/1naV71XahJ4prxvl+Z5x1yiW6hOlf6q55dkXOjiz6wjo9pjfzyRvPLEczvfaZT1m8RqsH8MvaJGmR19VVS9T4IvgQT7FJLBx7pUnNsDwn9UfaWZg/2OjJURrQjyaLU7V1ZnuwQNM1Il2wsyr1QtbViLNBY0odWkMgVBnZB8W0RQ==
  • Authentication-results-original: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=arm.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Paul Durrant <paul@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Mon, 07 Dec 2020 18:43:31 +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: AQHWxBX/ttp8YMNqT0KunkbXuSldmKnkBpwAgAeVnoCAAFuAgIAAEZOA
  • Thread-topic: [PATCH v2 8/8] xen/arm: Add support for SMMUv3 driver

Hello Julien,

> On 7 Dec 2020, at 5:39 pm, Julien Grall <julien@xxxxxxx> wrote:
> 
> 
> 
> On 07/12/2020 12:12, Rahul Singh wrote:
>>>> +typedef paddr_t dma_addr_t;
>>>> +typedef unsigned int gfp_t;
>>>> +
>>>> +#define platform_device device
>>>> +
>>>> +#define GFP_KERNEL 0
>>>> +
>>>> +/* Alias to Xen device tree helpers */
>>>> +#define device_node dt_device_node
>>>> +#define of_phandle_args dt_phandle_args
>>>> +#define of_device_id dt_device_match
>>>> +#define of_match_node dt_match_node
>>>> +#define of_property_read_u32(np, pname, out) (!dt_property_read_u32(np, 
>>>> pname, out))
>>>> +#define of_property_read_bool dt_property_read_bool
>>>> +#define of_parse_phandle_with_args dt_parse_phandle_with_args
>>>> +
>>>> +/* Alias to Xen lock functions */
>>>> +#define mutex spinlock
>>>> +#define mutex_init spin_lock_init
>>>> +#define mutex_lock spin_lock
>>>> +#define mutex_unlock spin_unlock
>>> 
>>> Hmm... mutex are not spinlock. Can you explain why this is fine to switch 
>>> to spinlock?
>> Yes mutex are not spinlock. As mutex is not implemented in XEN I thought of 
>> using spinlock in place of mutex as this is the only locking mechanism 
>> available in XEN.
>> Let me know if there is another blocking lock available in XEN. I will check 
>> if we can use that.
> 
> There are no blocking lock available in Xen so far. However, if Linux were 
> using mutex instead of spinlock, then it likely means they operations in the 
> critical section can be long running.

Yes you are right Linux is using mutex when attaching a device to the SMMU as 
this operation might take longer time.
> 
> How did you came to the conclusion that using spinlock in the SMMU driver 
> would be fine?

Mutex is replaced by spinlock  in the SMMU driver when there is a request to 
assign a device to the guest. As we are in user context at that time its ok to 
use spinlock.
As per my understanding there is one scenario when CPU will spin when there is 
a request from the user at the same time to assign another device to the SMMU 
and I think that is very rare.

Please suggest how we can proceed on this.

Regards
Rahul
> 
> Cheers,
> 
> -- 
> Julien Grall




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.