From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vk0-f48.google.com (mail-vk0-f48.google.com [209.85.213.48]) by dpdk.org (Postfix) with ESMTP id 0708658EC for ; Wed, 26 Apr 2017 12:52:57 +0200 (CEST) Received: by mail-vk0-f48.google.com with SMTP id j127so69184026vkh.0 for ; Wed, 26 Apr 2017 03:52:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=ZGJzPlRyQn2qFcFTVv0DYQg2KCe5ne6w4MT2yIVnq/A=; b=byKA0kZUPXVI2pCrg733crThRu4VuQ12D08D057kgTGQAdvfTXP/gr91KsoSYAH+vu CfyuDWuxEd1Vsw225hqpgtzTXlDoIUVkSA74IlHW7I0ND/By9DER1qtZRmz18yfVm08x eNbnRYvFRMX+SblD9qvT9ZKKNFczVCShzpB85SDNPwA2N2sDgo2rQgoVFv7RaMEiyfn1 PTWT/46NCNfrw03vr68t4WuEXop9AcE9Iwq8KmWzbUn5N42J2wkc+ztdvWS1Uyo1p9WV t6adYQR4Zvv6ndrE3IAxVwNilxUpfwVTTmV6g9dloCwI5DUQuU68YNAm2yTl2I+h5ALa +LDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=ZGJzPlRyQn2qFcFTVv0DYQg2KCe5ne6w4MT2yIVnq/A=; b=UbvB90PexdcZTxYKKqXVeLEp7U9c6ef6Wz1zRhdbiI+gNADyFC34+IVj3HnIsNrYtX wMip0XVTeNsuKKeUO8qmQDgj6tnnQBJuy0lxqn0DwgNnSf+iT3OTJd2DuouFaH05sap3 4Tbdf9iV+UzNiweGBe+JIAfCUD4py4CWPoAmHemLvWXAOxr3/xdx42W4S7ofsGeD2iUQ +HkAjbbo1b4sS13N8tvggtkJ+LU01uSBDxLMSyX/3F+Y21f48HbseorklvDpSIWhlfPp rC1ghmzMgLpcsBEBc05wWW+kC5I5japDSkNkoytaiU67iAih7aZLMqZWhyg65HqFM3zX s3hA== X-Gm-Message-State: AN3rC/6DqCFnltlDRL933c6rrUMT6m0G/wIBXe6jmcuOrOE2uPFEIFGn WRaaxGUDBuULCsKJHZ2hjUh5tX2tvrId X-Received: by 10.31.10.133 with SMTP id 127mr2541864vkk.5.1493203977240; Wed, 26 Apr 2017 03:52:57 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.14.69 with HTTP; Wed, 26 Apr 2017 03:52:56 -0700 (PDT) In-Reply-To: <0ceec7d0-0ac1-305c-5e20-da0a0ac7d727@linux.vnet.ibm.com> References: <1491321976-27290-1-git-send-email-arybchenko@solarflare.com> <0ceec7d0-0ac1-305c-5e20-da0a0ac7d727@linux.vnet.ibm.com> From: Alejandro Lucero Date: Wed, 26 Apr 2017 11:52:56 +0100 Message-ID: To: gowrishankar muthukrishnan Cc: dev , Anatoly Burakov , Andrew Rybchenko , Alexey Kardashevskiy , Thomas Monjalon Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH] vfio: set IOMMU type for the container once X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 10:52:58 -0000 Hi Gowrishankar, The VFIO maintainer is going to accept your patch. I have just sent a patch about the unplug issue: http://www.dpdk.org/ml/archives/dev/2017-April/064737.html On Wed, Apr 26, 2017 at 11:36 AM, gowrishankar muthukrishnan < gowrishankar.m@linux.vnet.ibm.com> wrote: > Thanks Alajandro. Could this patch be merged before you make further cases > considered ?. > Reason is that, we need this fix in 17.05 for ppc64le as I pointed earlier > (and of course any > changes that would make the fix better, if possible before RCs closed). > > Thanks, > Gowrishankar > > > On Friday 21 April 2017 02:53 PM, Alejandro Lucero wrote: > > The patch is OK for me. I have run tests with that change with no > problems. But I can just run tests with devices where each one got its own > IOMMU group, so my ack is just for that case (although theoretically this > patch fixes the other case). I'm looking at doing some changes to the > kernel for being able to have an scenario with several devices sharing same > IOMMU group just for the shake of testing. > > By other hand, vfio hotplug has a problem when there are several devices > in same IOMMU group being plugged and unplugged. I have a patch ready for > fixing this issue which I will send soon. > > On Fri, Apr 21, 2017 at 11:12 AM, gowrishankar muthukrishnan < > gowrishankar.m@linux.vnet.ibm.com> wrote: > >> Could this patch be reviewed and merged for 17.05 rc3 ?. It solved >> regression with i40e pmd >> bring up in one of our ppc64le server models through vfio-pci pci module. >> >> Thanks Alexey pointing out this in one of your patches. >> >> Regards, >> Gowrishankar >> >> >> On Tuesday 04 April 2017 09:36 PM, Andrew Rybchenko wrote: >> >>> If more than one used PCI device belongs to one IOMMU group, >>> it is still one IOMMU group and the container IOMMU type >>> should be set only once. >>> >>> Fixes: 94c0776b1bad ("vfio: support hotplug") >>> >>> Signed-off-by: Andrew Rybchenko >>> --- >>> My testing of the patch is limitted to my configuration with 2 PCI >>> functions which belong to one IOMMU group. >>> >>> lib/librte_eal/linuxapp/eal/eal_vfio.c | 54 >>> ++++++++++++++++++---------------- >>> 1 file changed, 29 insertions(+), 25 deletions(-) >>> >>> diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.c >>> b/lib/librte_eal/linuxapp/eal/eal_vfio.c >>> index 6e2e84c..dd59c1c 100644 >>> --- a/lib/librte_eal/linuxapp/eal/eal_vfio.c >>> +++ b/lib/librte_eal/linuxapp/eal/eal_vfio.c >>> @@ -298,33 +298,37 @@ vfio_setup_device(const char *sysfs_base, const >>> char *dev_addr, >>> clear_group(vfio_group_fd); >>> return -1; >>> } >>> - } >>> >>> - /* >>> - * pick an IOMMU type and set up DMA mappings for container >>> - * >>> - * needs to be done only once, only when first group is assigned >>> to >>> - * a container and only in primary process. Note this can happen >>> several >>> - * times with the hotplug functionality. >>> - */ >>> - if (internal_config.process_type == RTE_PROC_PRIMARY && >>> - vfio_cfg.vfio_active_groups == 1) { >>> - /* select an IOMMU type which we will be using */ >>> - const struct vfio_iommu_type *t = >>> + /* >>> + * pick an IOMMU type and set up DMA mappings for >>> container >>> + * >>> + * needs to be done only once, only when first group is >>> + * assigned to a container and only in primary process. >>> + * Note this can happen several times with the hotplug >>> + * functionality. >>> + */ >>> + if (internal_config.process_type == RTE_PROC_PRIMARY && >>> + vfio_cfg.vfio_active_groups == 1) { >>> + /* select an IOMMU type which we will be using */ >>> + const struct vfio_iommu_type *t = >>> vfio_set_iommu_type(vfio_cfg.v >>> fio_container_fd); >>> - if (!t) { >>> - RTE_LOG(ERR, EAL, " %s failed to select IOMMU >>> type\n", dev_addr); >>> - close(vfio_group_fd); >>> - clear_group(vfio_group_fd); >>> - return -1; >>> - } >>> - ret = t->dma_map_func(vfio_cfg.vfio_container_fd); >>> - if (ret) { >>> - RTE_LOG(ERR, EAL, " %s DMA remapping failed, " >>> - "error %i (%s)\n", dev_addr, >>> errno, strerror(errno)); >>> - close(vfio_group_fd); >>> - clear_group(vfio_group_fd); >>> - return -1; >>> + if (!t) { >>> + RTE_LOG(ERR, EAL, >>> + " %s failed to select IOMMU >>> type\n", >>> + dev_addr); >>> + close(vfio_group_fd); >>> + clear_group(vfio_group_fd); >>> + return -1; >>> + } >>> + ret = t->dma_map_func(vfio_cfg.vfio_ >>> container_fd); >>> + if (ret) { >>> + RTE_LOG(ERR, EAL, >>> + " %s DMA remapping failed, >>> error %i (%s)\n", >>> + dev_addr, errno, >>> strerror(errno)); >>> + close(vfio_group_fd); >>> + clear_group(vfio_group_fd); >>> + return -1; >>> + } >>> } >>> } >>> >>> >> > >