DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Wang, Xiao W" <xiao.w.wang@intel.com>
To: "Stojaczyk, Dariusz" <dariusz.stojaczyk@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Cc: Alejandro Lucero <alejandro.lucero@netronome.com>,
	"Burakov, Anatoly" <anatoly.burakov@intel.com>,
	"stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH 1/2] eal/vfio: check if we already have the group fd open
Date: Tue, 25 Sep 2018 07:56:19 +0000	[thread overview]
Message-ID: <B7F2E978279D1D49A3034B7786DACF406F9C51C2@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <20180917134643.103871-1-dariusz.stojaczyk@intel.com>

Hi,

> -----Original Message-----
> From: Stojaczyk, Dariusz
> Sent: Monday, September 17, 2018 9:47 PM
> To: dev@dpdk.org
> Cc: Alejandro Lucero <alejandro.lucero@netronome.com>; Burakov, Anatoly
> <anatoly.burakov@intel.com>; stable@dpdk.org; Stojaczyk, Dariusz
> <dariusz.stojaczyk@intel.com>; Wang, Xiao W <xiao.w.wang@intel.com>
> Subject: [PATCH 1/2] eal/vfio: check if we already have the group fd open
> 
> From: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
> 
> Always attempt to find already opened fd for an iommu
> group as subsequent attempts to open it will fail.
> 
> There's no public API to check if a group was already
> bound and has a container, so rte_vfio_container_group_bind()
> shouldn't fail in such case.
> 
> Fixes: ea2dc1066870 ("vfio: add multi container support")
> Cc: xiao.w.wang@intel.com
> 
> Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
> ---
>  lib/librte_eal/linuxapp/eal/eal_vfio.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.c
> b/lib/librte_eal/linuxapp/eal/eal_vfio.c
> index c68dc38e0..bcb869be1 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_vfio.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_vfio.c
> @@ -1680,6 +1680,11 @@ rte_vfio_container_group_bind(int container_fd,
> int iommu_group_num)
>  		return -1;
>  	}
> 
> +	/* check if we already have the group descriptor open */
> +	for (i = 0; i < VFIO_MAX_GROUPS; i++)
> +		if (vfio_cfg->vfio_groups[i].group_num == iommu_group_num)
> +			return vfio_cfg->vfio_groups[i].fd;
> +
>  	/* Check room for new group */
>  	if (vfio_cfg->vfio_active_groups == VFIO_MAX_GROUPS) {
>  		RTE_LOG(ERR, EAL, "Maximum number of VFIO groups
> reached!\n");
> --
> 2.17.1

Acked-by: Xiao Wang <xiao.w.wang@intel.com>

BRs,
Xiao

  parent reply	other threads:[~2018-09-25  7:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-17 13:46 Darek Stojaczyk
2018-09-17 13:46 ` [dpdk-dev] [PATCH 2/2] eal/vfio: cleanup getting group fd Darek Stojaczyk
2018-09-26 12:34   ` Burakov, Anatoly
2018-09-25  7:56 ` Wang, Xiao W [this message]
2018-10-29  0:26   ` [dpdk-dev] [PATCH 1/2] eal/vfio: check if we already have the group fd open Thomas Monjalon
2018-09-26 12:35 ` Burakov, Anatoly

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B7F2E978279D1D49A3034B7786DACF406F9C51C2@SHSMSX101.ccr.corp.intel.com \
    --to=xiao.w.wang@intel.com \
    --cc=alejandro.lucero@netronome.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dariusz.stojaczyk@intel.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).