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

Re: [PATCH] xen/arm: smmuv1: remove iommu group when deassign a device


  • To: Mykyta Poturai <mykyta.poturai@xxxxxxxxx>
  • From: Rahul Singh <Rahul.Singh@xxxxxxx>
  • Date: Tue, 21 Jun 2022 13:51:56 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • 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=2; 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=tOGuhvqCIs1oxNymuMFyvzbwzfCeT9HJS6rcrPwb1kY=; b=giyCTYvRvDGk43quwUNhcxkvQQyOGp5i3YM0rqarE2mgkluYGjaPAFZ3wATI7AMXBgwhq8P5shvdMjABhS5O8tZ8QUGSIWC/9Oa/8TwHxLxtfC/2i8egB3IjidoWQCNmBycRdyKuoyE2tdqSS7EEcFO3474VjgrJo7BtSkpK2qbtN77Y/a5F8sIVy/t3PB6Ea/xPf+rFNwGwNYOrU6VIPA73LCY8+7P2VvuYMB9+ZwVkCH57R5Ku2BV2YTD220m/QK/PVGvVMBJaR4OGHCXzck5aJD7aa6+vbYg7fXyZR4hhtiMP9d215MJlCKHgbCVnqsRg3UagtMp3VEY9V8u7vg==
  • 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=tOGuhvqCIs1oxNymuMFyvzbwzfCeT9HJS6rcrPwb1kY=; b=cNNLbJ/HuCu2ZtArX6/gfeduwcVTGHtd8cIBm7O1e/fx+UqlBRAz2/NgFUuMk1VNmZy0soVMcDGwK8PfxaaZ8IiMOpgcR7Fs8R0dFPoib7bFiDlNFuzWN4j/k7xVTGEbNa0VqL4Zf95zUyKrQrwbuqqLZUvZgTMJ5DUTxebQgkZh7EIefJfQVF1i/K6pFne5vtlConqca3UekHQnNcRyTpvMzwKg5MqgwHHCPevtkOwnzrDbv5VN1iZLNsdq+/N+8z/96STV+v11goxlEvCZ2As/HrfkcoVhZogqAzx9CJYH7yQ1i3J7kI8vWYNH6BovqhT5+dmo4aOfp05iyRJg9A==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=f4PRqajjSzYGJoAxGh3+QnrSQ+JdhRij8tCqC/WOI5q+6YTiw58CpDEbT3APo9xxNvYPW6fiuj3oA9jcRo/7duqAvy3QIwPx75wclETML34akaxE+Y9syAGcMg2O8c7rJerd+Z1qXhLksoCaxreNcvVxBuobfuGbLgbw79QBJ8M3rrq4OvZigq9IQPOBmLdMSaF9VKKgG0KweNWoR7u7Era95R0YRqM2tNg0m06ftmFbpdq/FBTEILybg2M5pkFmLyF04oo7RoILMX31TACKb9Fo0QU3+Qhi7Ol9yqiqp7LT5a45vmLoGTdPYFHRL9UZjoOW/SBz395ryqRUxrFoUQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XQLdM5aKc4DkDbPxrP3RjCirRmTtYoP9TVRttvuFCuqrYTolHbtd9anRCy/AFOAV1cdSGsPKEWTKK8hn+tZPFYp71ouxOvr9rZQplhe6uFmRziuf83/g71k2fB4r1XR6eFOHblKenZIljQlJ9FDy7zq+8xfqokFft0yNjYK0EOCcIB4JU4lBPrSiaG9OzVxe4k8cZ8imGv6NSUrON6aJ4k0TQ9E/AXrt3LByTbAbYYiqNdegpqZn8KZ/Oi0Z7K+nLbXcQBlXpGpMiCGR5LTQp2idJ+CpQYKko3/ln1cBwOAN7owqsKjTfN5WjWyvsB6uAiLTiJTq3Hw9PwDs2ra7xg==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, "Volodymyr_Babchuk@xxxxxxxx" <Volodymyr_Babchuk@xxxxxxxx>, "julien@xxxxxxx" <julien@xxxxxxx>, "sstabellini@xxxxxxxxxx" <sstabellini@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 21 Jun 2022 13:52:13 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHYWlIekEFYa4Z+ZkOKg6prrRxnv60EB7eAgALvxoCABl1EgIBEoW2AgAA0fACAAZfdAIAEm8YAgAGSSQCAAEbogA==
  • Thread-topic: [PATCH] xen/arm: smmuv1: remove iommu group when deassign a device

Hi Mykyta,

> On 21 Jun 2022, at 10:38 am, Mykyta Poturai <mykyta.poturai@xxxxxxxxx> wrote:
> 
>> Thanks for testing the patch.
>>> But not fixed the "Unexpected Global fault" that occasionally happens when 
>>> destroying
>>> the domain with an actively working GPU. Although, I am not sure if this 
>>> issue
>>> is relevant here.
>> 
>> Can you please if possible share the more details and logs so that I can 
>> look if this issue is relevant here ?
> 
> So in my setup I have a board with IMX8 chip and 2 core Vivante GPU. GPU is 
> split between domains.
> One core goes to Dom0 and one to DomU.
> 
> Steps to trigger this issue:
> 1. Start DomU
> 2. Start wayland and glmark2-es2-wayland inside DomU
> 3. Destroy DomU
> 
> Sometimes it destroys fine but roughly 1 of 8 times I get logs like this:
> 
> root@dom0:~# xl dest DomU
> [12725.412940] xenbr0: port 1(vif8.0) entered disabled state
> [12725.671033] xenbr0: port 1(vif8.0) entered disabled state
> [12725.689923] device vif8.0 left promiscuous mode
> [12725.696736] xenbr0: port 1(vif8.0) entered disabled state
> [12725.696989] audit: type=1700 audit(1616594240.068:39): dev=vif8.0 prom=0 
> old_prom=256 auid=4294967295 uid=0 gid=0 ses=4294967295
> (XEN) smmu: /iommu@51400000: Unexpected global fault, this could be serious
> (XEN) smmu: /iommu@51400000:    GFSR 0x00000001, GFSYNR0 0x00000004, GFSYNR1 
> 0x00001055, GFSYNR2 0x00000000
> 
> My guess is that this happens because GPU continues to access memory when the 
> context is already invalidated,
> and therefore triggers the "Invalid context fault".

Yes you are right in this case GPU trying to do DMA operation after Xen 
destroyed the guest and configures
the S2CR type value to fault. Solution to this issue is the patch that I shared 
earlier.

You can try this patch and confirm.This patch will solve both the issues.

diff --git a/xen/drivers/passthrough/arm/smmu.c 
b/xen/drivers/passthrough/arm/smmu.c
index 5cacb2dd99..ff1b73d3d8 100644
--- a/xen/drivers/passthrough/arm/smmu.c
+++ b/xen/drivers/passthrough/arm/smmu.c
@@ -1680,6 +1680,10 @@ static int arm_smmu_attach_dev(struct iommu_domain 
*domain, struct device *dev)
if (!cfg)
return -ENODEV;

+ ret = arm_smmu_master_alloc_smes(dev);
+ if (ret)
+ return ret;
+
return arm_smmu_domain_add_master(smmu_domain, cfg);
}

@@ -2075,7 +2079,7 @@ static int arm_smmu_add_device(struct device *dev)
iommu_group_add_device(group, dev);
iommu_group_put(group);

- return arm_smmu_master_alloc_smes(dev);
+ return 0;
}


Regards,
Rahul


 


Rackspace

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