From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f65.google.com (mail-pg0-f65.google.com [74.125.83.65]) by dpdk.org (Postfix) with ESMTP id 0C6A069C6 for ; Wed, 26 Apr 2017 09:50:52 +0200 (CEST) Received: by mail-pg0-f65.google.com with SMTP id t7so12508348pgt.1 for ; Wed, 26 Apr 2017 00:50:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ozlabs-ru.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=QqOznOf2ROQ5qxFDbBfB5FhjVseDSV5pgr7SP7zOAss=; b=0eWEuve/tJCTn9xUni7402lUvvyzv40DfdHlGnPei9RIHEuhBY3s52I8ZxgUGVGlR2 B22SfcPL8lgbqAqOcbFdA6muk5ZJTaxUTU+NETYLpXcvB7fMKTKwgy7aK/GGLWrRaS6p I4HpwbFWqe+pqDZWIRoaBKcIh/J83YJ+zC/QHbDjnylpj9NiuyuuDIy3J9A0eLVSIFv1 sY3qh5ZV6wCTFSi4Qu4/pPQLDmUcoPtuCfN0MM+ph2dbpI8mu1vGFqExMYnZzV2VI5+e FCqI0oN5ftgNpTpWnKlPhr+j7yXdC4jnMeoTu66oa2ExA7RauLQFCyBzRjarieubM26c 1MEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=QqOznOf2ROQ5qxFDbBfB5FhjVseDSV5pgr7SP7zOAss=; b=aefSRteeAHpSXvhRFkh+myOGe30Uc/Wq7TTxLpnPZFSZnVaft6XMrdZHlC0rH1bR5m Qv7a1HjKExUg+WbH13ug4htcc63EKtKROLm4xmXLsPfYLURrMau0ytJuHqbhvrccgSYe ZkUEi/uiuCuJBISG5r7rI5hdJEoi7JbBxBoepLYP4GCnKjMXLlIi0HHhM/EefSKTVpSG EOmB4P/JRRLJi35QimW1XdnmqLvm3R/6ASyT5oMdIy4gaq84FhHeED98JXPYAPPTt66M iSkTOqBeXAwWI749u+NNRjtjTcnEsAu5bslA2hmygb/g+0wU1LGxvMm0rc/4kwRvAra4 smZw== X-Gm-Message-State: AN3rC/5/KjGn5B/u4ldqjd+dyHw/BcfOfIX+XDFrEMwaWo9YnO8rJz1w 7PzZ195rezJlWg== X-Received: by 10.98.113.67 with SMTP id m64mr17256528pfc.231.1493193051317; Wed, 26 Apr 2017 00:50:51 -0700 (PDT) Received: from [10.61.2.175] ([122.99.82.10]) by smtp.googlemail.com with ESMTPSA id q85sm40455932pfj.112.2017.04.26.00.50.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Apr 2017 00:50:50 -0700 (PDT) To: Andrew Rybchenko , dev@dpdk.org Cc: JPF@zurich.ibm.com, Gowrishankar Muthukrishnan References: <20170420072402.38106-1-aik@ozlabs.ru> <20170420072402.38106-5-aik@ozlabs.ru> <5b5fe4e4-af39-4c27-fb3c-aff0c601b938@solarflare.com> From: Alexey Kardashevskiy Message-ID: <9808fd9e-17e5-b873-592a-2309579097dc@ozlabs.ru> Date: Wed, 26 Apr 2017 17:50:46 +1000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 MIME-Version: 1.0 In-Reply-To: <5b5fe4e4-af39-4c27-fb3c-aff0c601b938@solarflare.com> Content-Type: text/plain; charset=koi8-r Content-Language: en-AU Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH dpdk 4/5] vfio: Do try setting IOMMU type if already set 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 07:50:52 -0000 On 21/04/17 18:54, Andrew Rybchenko wrote: > On 04/20/2017 10:24 AM, Alexey Kardashevskiy wrote: >> The existing code correctly checks if a container is set to a group and >> does not try attaching a group to a container for a second/third/... >> device from the same IOMMU group. >> >> However it still tries to set IOMMU type to a container for every device >> in a group which produces failure and closes container and group fds. >> >> This moves vfio_set_iommu_type() and DMA mapping code under: >> if (!(group_status.flags & VFIO_GROUP_FLAGS_CONTAINER_SET)) >> >> Signed-off-by: Alexey Kardashevskiy >> --- >> lib/librte_eal/linuxapp/eal/eal_vfio.c | 50 >> +++++++++++++++++----------------- >> 1 file changed, 25 insertions(+), 25 deletions(-) >> >> diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.c >> b/lib/librte_eal/linuxapp/eal/eal_vfio.c >> index 6e2e84ca7..46f951f4d 100644 >> --- a/lib/librte_eal/linuxapp/eal/eal_vfio.c >> +++ b/lib/librte_eal/linuxapp/eal/eal_vfio.c >> @@ -298,33 +298,33 @@ 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; >> + } >> } >> } > > It looks like a duplicate of the earlier submitted patch > http://dpdk.org/ml/archives/dev/2017-April/063077.html It is a duplicate indeed, what needs to be done to have it accepted in the mainline tree? -- Alexey