Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp412777ybc; Tue, 12 Nov 2019 03:29:51 -0800 (PST) X-Google-Smtp-Source: APXvYqz0yUoEn0KpLyCEVxUJQ+j2dOwxmNPlNU++uUhc9xePfWMVnWmvH6rLHC/jzIRqHSVQfsUS X-Received: by 2002:a17:906:194a:: with SMTP id b10mr27930903eje.123.1573558191257; Tue, 12 Nov 2019 03:29:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573558191; cv=none; d=google.com; s=arc-20160816; b=O4NIefnXuHdGSjlcQ55bLwqBA76FN6ty+8IezLpeN5y83az0IPwWJzqoCCbmJQpdhu L1PMXi8PN79+vWuZEFJisbo3pUKe5RKguQDyPhGQVXxFnDlk6z1NNBI6qVvGkAYsQX3q B+cQkBZJpwAnbphBHHqKrxVjGm+/OclW/0v93ynueWV7IPLhAQjDqx84Bc0DNbcWDmDy hVRo8Mq+KVcENtCQfD5WU4ST1TNJIgD55HqPmVAcY9/SYuD/IE4iGChYEh8vVe0+3G9d gYugfhfc9D8cKO93gvdJoKhSAV0Z4Wj30sIjk99SxJKizNgmbgDykh8TF5VHtYCBuhfu YB5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=FJp+cdkR/KUfWO88XvWnViJGJgatKXO8jQkKYpu6WJk=; b=sfgPQ2ZCkfYHk17lxJ8Zg7AIGg8kkiL7Ul6AMF5gVE3lL4zwzmeD2zepwHxOn6LaYz ghUAufBhCh2rVjZnulwgAYaZR+/PswTCbx5jRi88QpgjLcWvZJeps6hiKHp1P11uv0Gg q+tuKKa+axSIQjCjOhbCyw7ib9H7IKH9qL/YRIBAkJlQvUWcP9Aow7n+Zjs18LEDPzgY dADfbssdDq4jjHxnV12Yfz7xCsQUMgna/kwEH9/mCjoiVK3lkLIoHGJAJOhb+i5VpFqH xjRffL6/mu94JnOEH24b7HMXSTo3iERTcArdvFtGahRV+63tp6oR3dhPSnCY4YMvNbvX +AxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LL6KrsfI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s7si14434389eds.215.2019.11.12.03.29.26; Tue, 12 Nov 2019 03:29:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LL6KrsfI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726985AbfKLL2z (ORCPT + 99 others); Tue, 12 Nov 2019 06:28:55 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:57629 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726954AbfKLL2x (ORCPT ); Tue, 12 Nov 2019 06:28:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573558132; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FJp+cdkR/KUfWO88XvWnViJGJgatKXO8jQkKYpu6WJk=; b=LL6KrsfIudUG5gaq3YGOpEwte5bl8w7dH/+yoJvK5fZ8fvzF+C6Str4mhNqxqNV98nZN0Q 5hVCRe1uW0PpxlKk6R6+q3PjTgghReCgsWywK5js0U5ESBJAgvxIo+oH/f97oABpbrqJP0 1SGAzgMUS33Ihu880bA/ecf9B5xmvhs= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-405-ceMHyAO1Mn2K2ymVmGHufg-1; Tue, 12 Nov 2019 06:28:48 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 16E66107ACC4; Tue, 12 Nov 2019 11:28:46 +0000 (UTC) Received: from [10.36.116.54] (ovpn-116-54.ams2.redhat.com [10.36.116.54]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AA6BE59; Tue, 12 Nov 2019 11:28:38 +0000 (UTC) Subject: Re: [PATCH v9 00/11] SMMUv3 Nested Stage Setup (VFIO part) To: Shameerali Kolothum Thodi , "eric.auger.pro@gmail.com" , "iommu@lists.linux-foundation.org" , "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" , "kvmarm@lists.cs.columbia.edu" , "joro@8bytes.org" , "alex.williamson@redhat.com" , "jacob.jun.pan@linux.intel.com" , "yi.l.liu@intel.com" , "jean-philippe.brucker@arm.com" , "will.deacon@arm.com" , "robin.murphy@arm.com" Cc: "kevin.tian@intel.com" , "vincent.stehle@arm.com" , "ashok.raj@intel.com" , "marc.zyngier@arm.com" , "tina.zhang@intel.com" , Linuxarm , "xuwei (O)" References: <20190711135625.20684-1-eric.auger@redhat.com> From: Auger Eric Message-ID: Date: Tue, 12 Nov 2019 12:28:37 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: ceMHyAO1Mn2K2ymVmGHufg-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Shameer, On 11/12/19 12:08 PM, Shameerali Kolothum Thodi wrote: > Hi Eric, >=20 >> -----Original Message----- >> From: kvmarm-bounces@lists.cs.columbia.edu >> [mailto:kvmarm-bounces@lists.cs.columbia.edu] On Behalf Of Eric Auger >> Sent: 11 July 2019 14:56 >> To: eric.auger.pro@gmail.com; eric.auger@redhat.com; >> iommu@lists.linux-foundation.org; linux-kernel@vger.kernel.org; >> kvm@vger.kernel.org; kvmarm@lists.cs.columbia.edu; joro@8bytes.org; >> alex.williamson@redhat.com; jacob.jun.pan@linux.intel.com; >> yi.l.liu@intel.com; jean-philippe.brucker@arm.com; will.deacon@arm.com; >> robin.murphy@arm.com >> Cc: kevin.tian@intel.com; vincent.stehle@arm.com; ashok.raj@intel.com; >> marc.zyngier@arm.com; tina.zhang@intel.com >> Subject: [PATCH v9 00/11] SMMUv3 Nested Stage Setup (VFIO part) >> >> This series brings the VFIO part of HW nested paging support >> in the SMMUv3. >> >> The series depends on: >> [PATCH v9 00/14] SMMUv3 Nested Stage Setup (IOMMU part) >> (https://www.spinics.net/lists/kernel/msg3187714.html) >> >> 3 new IOCTLs are introduced that allow the userspace to >> 1) pass the guest stage 1 configuration >> 2) pass stage 1 MSI bindings >> 3) invalidate stage 1 related caches >> >> They map onto the related new IOMMU API functions. >> >> We introduce the capability to register specific interrupt >> indexes (see [1]). A new DMA_FAULT interrupt index allows to register >> an eventfd to be signaled whenever a stage 1 related fault >> is detected at physical level. Also a specific region allows >> to expose the fault records to the user space. >=20 > I am trying to get this running on one of our platform that has smmuv3 du= al > stage support. I am seeing some issues with this when an ixgbe vf dev is= =20 > made pass-through and is behind a vSMMUv3 in Guest. >=20 > Kernel used : https://github.com/eauger/linux/tree/v5.3.0-rc0-2stage-v9 > Qemu: https://github.com/eauger/qemu/tree/v4.1.0-rc0-2stage-rfcv5 >=20 > And this is my Qemu cmd line, >=20 > ./qemu-system-aarch64 > -machine virt,kernel_irqchip=3Don,gic-version=3D3,iommu=3Dsmmuv3 -cpu hos= t \ > -kernel Image \ > -drive if=3Dnone,file=3Dubuntu,id=3Dfs \ > -device virtio-blk-device,drive=3Dfs \ > -device vfio-pci,host=3D0000:01:10.1 \ > -bios QEMU_EFI.fd \ > -net none \ > -m 4G \ > -nographic -D -d -enable-kvm \ > -append "console=3DttyAMA0 root=3D/dev/vda rw acpi=3Dforce" >=20 > The basic ping from Guest works fine, > root@ubuntu:~# ping 10.202.225.185 > PING 10.202.225.185 (10.202.225.185) 56(84) bytes of data. > 64 bytes from 10.202.225.185: icmp_seq=3D2 ttl=3D64 time=3D0.207 ms > 64 bytes from 10.202.225.185: icmp_seq=3D3 ttl=3D64 time=3D0.203 ms > ... >=20 > But if I increase ping packet size,=20 >=20 > root@ubuntu:~# ping -s 1024 10.202.225.185 > PING 10.202.225.185 (10.202.225.185) 1024(1052) bytes of data. > 1032 bytes from 10.202.225.185: icmp_seq=3D22 ttl=3D64 time=3D0.292 ms > 1032 bytes from 10.202.225.185: icmp_seq=3D23 ttl=3D64 time=3D0.207 ms > From 10.202.225.169 icmp_seq=3D66 Destination Host Unreachable > From 10.202.225.169 icmp_seq=3D67 Destination Host Unreachable > From 10.202.225.169 icmp_seq=3D68 Destination Host Unreachable > From 10.202.225.169 icmp_seq=3D69 Destination Host Unreachable >=20 > And from Host kernel I get, > [ 819.970742] ixgbe 0000:01:00.1 enp1s0f1: 3 Spoofed packets detected > [ 824.002707] ixgbe 0000:01:00.1 enp1s0f1: 1 Spoofed packets detected > [ 828.034683] ixgbe 0000:01:00.1 enp1s0f1: 1 Spoofed packets detected > [ 830.050673] ixgbe 0000:01:00.1 enp1s0f1: 4 Spoofed packets detected > [ 832.066659] ixgbe 0000:01:00.1 enp1s0f1: 1 Spoofed packets detected > [ 834.082640] ixgbe 0000:01:00.1 enp1s0f1: 3 Spoofed packets detected >=20 > Also noted that iperf cannot work as it fails to establish the connection= with iperf > server.=20 >=20 > Please find attached the trace logs(vfio*, smmuv3*) from Qemu for your re= ference. > I haven't debugged this further yet and thought of checking with you if t= his is > something you have seen already or not. Or maybe I am missing something h= ere? Please can you try to edit and modify hw/vfio/common.c, function vfio_iommu_unmap_notify /* if (size <=3D 0x10000) { ustruct.info.cache =3D IOMMU_CACHE_INV_TYPE_IOTLB; ustruct.info.granularity =3D IOMMU_INV_GRANU_ADDR; ustruct.info.addr_info.flags =3D IOMMU_INV_ADDR_FLAGS_ARCHID; if (iotlb->leaf) { ustruct.info.addr_info.flags |=3D IOMMU_INV_ADDR_FLAGS_LEAF; } ustruct.info.addr_info.archid =3D iotlb->arch_id; ustruct.info.addr_info.addr =3D start; ustruct.info.addr_info.granule_size =3D size; ustruct.info.addr_info.nb_granules =3D 1; trace_vfio_iommu_addr_inv_iotlb(iotlb->arch_id, start, size, 1, iotlb->leaf); } else { */ ustruct.info.cache =3D IOMMU_CACHE_INV_TYPE_IOTLB; ustruct.info.granularity =3D IOMMU_INV_GRANU_PASID; ustruct.info.pasid_info.archid =3D iotlb->arch_id; ustruct.info.pasid_info.flags =3D IOMMU_INV_PASID_FLAGS_ARCHID; trace_vfio_iommu_asid_inv_iotlb(iotlb->arch_id); // } This modification leads to invalidate the whole asid each time we get a guest TLBI instead of invalidating the single IOVA (TLBI). On my end, I saw this was the cause of such kind of issues. Please let me know if it fixes your perf issues and then we may discuss further about the test configuration. Thanks Eric >=20 > Please let me know. >=20 > Thanks, > Shameer >=20 >> Best Regards >> >> Eric >> >> This series can be found at: >> https://github.com/eauger/linux/tree/v5.3.0-rc0-2stage-v9 >> >> It series includes Tina's patch steming from >> [1] "[RFC PATCH v2 1/3] vfio: Use capability chains to handle device >> specific irq" plus patches originally contributed by Yi. >> >> History: >> >> v8 -> v9: >> - introduce specific irq framework >> - single fault region >> - iommu_unregister_device_fault_handler failure case not handled >> yet. >> >> v7 -> v8: >> - rebase on top of v5.2-rc1 and especially >> 8be39a1a04c1 iommu/arm-smmu-v3: Add a master->domain pointer >> - dynamic alloc of s1_cfg/s2_cfg >> - __arm_smmu_tlb_inv_asid/s1_range_nosync >> - check there is no HW MSI regions >> - asid invalidation using pasid extended struct (change in the uapi) >> - add s1_live/s2_live checks >> - move check about support of nested stages in domain finalise >> - fixes in error reporting according to the discussion with Robin >> - reordered the patches to have first iommu/smmuv3 patches and then >> VFIO patches >> >> v6 -> v7: >> - removed device handle from bind/unbind_guest_msi >> - added "iommu/smmuv3: Nested mode single MSI doorbell per domain >> enforcement" >> - added few uapi comments as suggested by Jean, Jacop and Alex >> >> v5 -> v6: >> - Fix compilation issue when CONFIG_IOMMU_API is unset >> >> v4 -> v5: >> - fix bug reported by Vincent: fault handler unregistration now happens = in >> vfio_pci_release >> - IOMMU_FAULT_PERM_* moved outside of struct definition + small >> uapi changes suggested by Kean-Philippe (except fetch_addr) >> - iommu: introduce device fault report API: removed the PRI part. >> - see individual logs for more details >> - reset the ste abort flag on detach >> >> v3 -> v4: >> - took into account Alex, jean-Philippe and Robin's comments on v3 >> - rework of the smmuv3 driver integration >> - add tear down ops for msi binding and PASID table binding >> - fix S1 fault propagation >> - put fault reporting patches at the beginning of the series following >> Jean-Philippe's request >> - update of the cache invalidate and fault API uapis >> - VFIO fault reporting rework with 2 separate regions and one mmappable >> segment for the fault queue >> - moved to PATCH >> >> v2 -> v3: >> - When registering the S1 MSI binding we now store the device handle. Th= is >> addresses Robin's comment about discimination of devices beonging to >> different S1 groups and using different physical MSI doorbells. >> - Change the fault reporting API: use VFIO_PCI_DMA_FAULT_IRQ_INDEX to >> set the eventfd and expose the faults through an mmappable fault regio= n >> >> v1 -> v2: >> - Added the fault reporting capability >> - asid properly passed on invalidation (fix assignment of multiple >> devices) >> - see individual change logs for more info >> >> >> Eric Auger (8): >> vfio: VFIO_IOMMU_SET_MSI_BINDING >> vfio/pci: Add VFIO_REGION_TYPE_NESTED region type >> vfio/pci: Register an iommu fault handler >> vfio/pci: Allow to mmap the fault queue >> vfio: Add new IRQ for DMA fault reporting >> vfio/pci: Add framework for custom interrupt indices >> vfio/pci: Register and allow DMA FAULT IRQ signaling >> vfio: Document nested stage control >> >> Liu, Yi L (2): >> vfio: VFIO_IOMMU_SET_PASID_TABLE >> vfio: VFIO_IOMMU_CACHE_INVALIDATE >> >> Tina Zhang (1): >> vfio: Use capability chains to handle device specific irq >> >> Documentation/vfio.txt | 77 ++++++++ >> drivers/vfio/pci/vfio_pci.c | 283 ++++++++++++++++++++++++++-- >> drivers/vfio/pci/vfio_pci_intrs.c | 62 ++++++ >> drivers/vfio/pci/vfio_pci_private.h | 24 +++ >> drivers/vfio/pci/vfio_pci_rdwr.c | 45 +++++ >> drivers/vfio/vfio_iommu_type1.c | 166 ++++++++++++++++ >> include/uapi/linux/vfio.h | 109 ++++++++++- >> 7 files changed, 747 insertions(+), 19 deletions(-) >> >> -- >> 2.20.1 >> >> _______________________________________________ >> kvmarm mailing list >> kvmarm@lists.cs.columbia.edu >> https://lists.cs.columbia.edu/mailman/listinfo/kvmarm