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

Re: Disable IOMMU in Dom0


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Roman Skakun <Roman_Skakun@xxxxxxxx>
  • Date: Wed, 1 Sep 2021 09:59:52 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.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=La8gXQMXfHGw4BBQ/lbRYKOiAPc1dG59oOZFJuu/0R4=; b=atiOGJeaTfQD/X7a0Y5DxpMn/1zW8kvmxi+a0vyi117D0eUM5CIeTxrjskfuGc13BpsURhpQ+nSMbsxcllTBoFPk6r+GEsL5Fdp1DHOfJiJx6/HMB+QH/Rv5CECRl/6xh7N9qyle5VZPhw5jqy11vcXe0cgRH8SJmnJ/lRi6344yDtFfJFDxemywR/DLLDOdiY8j6d7Qh9KJGHA2krlmJnrhwzoCiP9Xf2nUyVVDAqjXQU5zc8pbwbeh/UTj3zq3eV0QzmcifqBBya8ow80o9pGQFNd9/vBSwr1GFB6ikB2aHvJPOd3p/8YfskKNJ9bIVrU1mPo6qPK83gxO1CR4gg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oQL0FSUpOR6ZZw4dzZ/WLDoYJRtr+dnA/6nKFP+FJdK3t7mQDaLQmiv/4yzs2ddRWiuquNuEWv3lGIRiirB+fSyN/nylMaMo3p2g9vsv3KuikQANoY8PVRlJdaAeXB2nQDXsKaKRGbqSXtQ4Lw41VsrJ+8U7dAyEVzsWryJSuefKp/cEZfc9gkV3mJlYVLvF32f5pcTk8h/7W/mORBBzsJ9k8cbBmfmNNn8Cd+NQlBkK2jxU9Pq0Fy8MxntIX71NF+aSeKHoV1RHwpDYd3oa8fDy1TlWGN6ghWQ6KUbHKC2U39EPLXHk68sGit7tjboKBV89C0nmxKXzoSX4qKU1HA==
  • Authentication-results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=epam.com;
  • Cc: Julien Grall <julien@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Andrii Anisov <Andrii_Anisov@xxxxxxxx>, Roman Skakun <rm.skakun@xxxxxxxxx>, Roman Skakun <Roman_Skakun@xxxxxxxx>
  • Delivery-date: Wed, 01 Sep 2021 10:00:07 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHXnnd7IVjUu+L6S0mPq9naNxJ1FauOJ3YAgADDGos=
  • Thread-topic: Disable IOMMU in Dom0

Hi, Stefano!

Thanks for responding!

> If you have a setup where Dom0 is not 1:1 mapped (which is not currently
> possible with upstream Xen but it is possible with cache coloring) and
> uses the IOMMU to make device DMA work like regular DomUs, then passing
> XENFEAT_not_direct_mapped to Linux would make it work. Without
> XENFEAT_not_direct_mapped, Linux would try to use swiotlb-xen which has
> code that relies on Linux being 1:1 mapped to work properly.

I'm using 1:1 Dom0.
According to your patch series, xen-swiotlb fops will be applied for all devices 
because XENFEAT_direct_mapped is active, as shown here:
https://elixir.bootlin.com/linux/v5.14/source/arch/arm64/mm/dma-mapping.c#L56

I agreed, that xen-swiotlb should work correctly, but in my case, I retrieved MFN here:
which is greater than 32bit and xen-swiotlb tries to use bounce buffer as expected.
It can lead to decrease a performance because I have a long buffer ~4MB.

I thought, that we can disable swiotlb fops for devices which are controlled by IOMMU.

Cheers,

From: Stefano Stabellini <sstabellini@xxxxxxxxxx>
Sent: Wednesday, September 1, 2021 12:50 AM
To: Roman Skakun <Roman_Skakun@xxxxxxxx>
Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>; Julien Grall <julien@xxxxxxx>; xen-devel@xxxxxxxxxxxxxxxxxxxx <xen-devel@xxxxxxxxxxxxxxxxxxxx>; Bertrand Marquis <bertrand.marquis@xxxxxxx>; Andrii Anisov <Andrii_Anisov@xxxxxxxx>; Roman Skakun <rm.skakun@xxxxxxxxx>
Subject: Re: Disable IOMMU in Dom0
 
On Tue, 31 Aug 2021, Roman Skakun wrote:
> Hi, Stefano!
>
> I have seen your negotiation of disabling xen-swiotlb for devices which are controlled by IOMMU in Dom0:
> https://urldefense.com/v3/__https://patchwork.kernel.org/project/xen-devel/patch/alpine.DEB.2.21.2102161333090.3234@sstabellini-ThinkPad-T480s/__;!!GF_29dbcQIUBPA!hl4_2pWlI3NQmAkwh4uvJFu7NhcOay9O9bIJRr7eOOMKD_I2z8MPbwnSXpNmqU6F$ [patchwork[.]kernel[.]org]
>
> As I was thinking to create a common implementation because I have the issue
> when device controlled by IOMMU using xen-swiotlb fops and bounce buffer as the result.
> https://urldefense.com/v3/__https://lore.kernel.org/xen-devel/060b5741-922c-115c-7e8c-97d8aa5f46f4@xxxxxxx/T/__;!!GF_29dbcQIUBPA!hl4_2pWlI3NQmAkwh4uvJFu7NhcOay9O9bIJRr7eOOMKD_I2z8MPbwnSXp1TdIa7$ [lore[.]kernel[.]org]
>
> Do you have any future plans to finish implementation for upstream?

Hi Roman,

The feature is already upstream in Linux as f5079a9a2, and the new
feature flags are XENFEAT_direct_mapped and XENFEAT_not_direct_mapped.

If you have a setup where Dom0 is not 1:1 mapped (which is not currently
possible with upstream Xen but it is possible with cache coloring) and
uses the IOMMU to make device DMA work like regular DomUs, then passing
XENFEAT_not_direct_mapped to Linux would make it work. Without
XENFEAT_not_direct_mapped, Linux would try to use swiotlb-xen which has
code that relies on Linux being 1:1 mapped to work properly.

Is that the same problem that you have, or is dom0 1:1 mapped in your
case? If dom0 is 1:1 mapped then swiotlb-xen should work regardless of
whether the IOMMU is enabled or disabled.

I hope this helps.

Cheers,

Stefano

 


Rackspace

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