From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by dpdk.org (Postfix) with ESMTP id 1C71858FA for ; Wed, 26 Apr 2017 12:57:07 +0200 (CEST) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v3QAtHjp062318 for ; Wed, 26 Apr 2017 06:57:07 -0400 Received: from e23smtp06.au.ibm.com (e23smtp06.au.ibm.com [202.81.31.148]) by mx0a-001b2d01.pphosted.com with ESMTP id 2a2ebwcxjp-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 26 Apr 2017 06:57:06 -0400 Received: from localhost by e23smtp06.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 26 Apr 2017 20:37:23 +1000 Received: from d23relay10.au.ibm.com (202.81.31.229) by e23smtp06.au.ibm.com (202.81.31.212) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 26 Apr 2017 20:37:17 +1000 Received: from d23av06.au.ibm.com (d23av06.au.ibm.com [9.190.235.151]) by d23relay10.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v3QAb6ps3211616 for ; Wed, 26 Apr 2017 20:37:14 +1000 Received: from d23av06.au.ibm.com (localhost [127.0.0.1]) by d23av06.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v3QAafGJ023123 for ; Wed, 26 Apr 2017 20:36:41 +1000 Received: from [9.79.210.61] ([9.79.210.61]) by d23av06.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v3QAaWL2022229; Wed, 26 Apr 2017 20:36:40 +1000 To: Alejandro Lucero References: <1491321976-27290-1-git-send-email-arybchenko@solarflare.com> Cc: dev , Anatoly Burakov , Andrew Rybchenko , Alexey Kardashevskiy , Thomas Monjalon From: gowrishankar muthukrishnan Date: Wed, 26 Apr 2017 16:06:16 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: X-TM-AS-MML: disable x-cbid: 17042610-0040-0000-0000-0000030E7E04 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17042610-0041-0000-0000-00000C87038B Message-Id: <0ceec7d0-0ac1-305c-5e20-da0a0ac7d727@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-04-26_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1704260196 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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:57:08 -0000 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 > > 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.vfio_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; > + } > } > } > > >