DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] vfio: fix getting default container
@ 2019-11-04 17:41 Anatoly Burakov
  2019-11-04 19:35 ` David Marchand
  0 siblings, 1 reply; 4+ messages in thread
From: Anatoly Burakov @ 2019-11-04 17:41 UTC (permalink / raw)
  To: dev; +Cc: damarion, thomas, david.marchand, dariuszx.stojaczyk, stable

When requesting DMA mapping to default container, we are meant to
supply the RTE_VFIO_DEFAULT_CONTAINER_FD value, however this is
not handled correctly by get_vfio_cfg_by_container_fd(), because
it only looks at actual fd values and does not check for this
special case.

Fix it to return default container if the fd requested is the
special RTE_VFIO_DEFAULT_CONTAINER_FD value.

Fixes: 4f5519ed8349 ("vfio: cleanup getting group fd")
Cc: dariuszx.stojaczyk@intel.com
Cc: stable@dpdk.org

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 lib/librte_eal/linux/eal/eal_vfio.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/librte_eal/linux/eal/eal_vfio.c b/lib/librte_eal/linux/eal/eal_vfio.c
index d9541b1220..d7887388f9 100644
--- a/lib/librte_eal/linux/eal/eal_vfio.c
+++ b/lib/librte_eal/linux/eal/eal_vfio.c
@@ -412,6 +412,9 @@ get_vfio_cfg_by_container_fd(int container_fd)
 {
 	int i;
 
+	if (container_fd == RTE_VFIO_DEFAULT_CONTAINER_FD)
+		return default_vfio_cfg;
+
 	for (i = 0; i < VFIO_MAX_CONTAINERS; i++) {
 		if (vfio_cfgs[i].vfio_container_fd == container_fd)
 			return &vfio_cfgs[i];
-- 
2.17.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH] vfio: fix getting default container
  2019-11-04 17:41 [dpdk-dev] [PATCH] vfio: fix getting default container Anatoly Burakov
@ 2019-11-04 19:35 ` David Marchand
  2019-11-05 12:38   ` Shahaf Shuler
  2019-11-06 13:44   ` David Marchand
  0 siblings, 2 replies; 4+ messages in thread
From: David Marchand @ 2019-11-04 19:35 UTC (permalink / raw)
  To: Anatoly Burakov, Shahaf Shuler
  Cc: dev, Damjan Marion (damarion),
	Thomas Monjalon, Dariusz Stojaczyk, dpdk stable

On Mon, Nov 4, 2019 at 6:41 PM Anatoly Burakov
<anatoly.burakov@intel.com> wrote:
>
> When requesting DMA mapping to default container, we are meant to
> supply the RTE_VFIO_DEFAULT_CONTAINER_FD value, however this is
> not handled correctly by get_vfio_cfg_by_container_fd(), because
> it only looks at actual fd values and does not check for this
> special case.
>
> Fix it to return default container if the fd requested is the
> special RTE_VFIO_DEFAULT_CONTAINER_FD value.
>
> Fixes: 4f5519ed8349 ("vfio: cleanup getting group fd")

RTE_VFIO_DEFAULT_CONTAINER_FD has been introduced in 4106d89a18f8
("vfio: allow DMA map to the default container") (19.05) as part of
the rework deprecating rte_vfio_dma_map.


>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
>  lib/librte_eal/linux/eal/eal_vfio.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/lib/librte_eal/linux/eal/eal_vfio.c b/lib/librte_eal/linux/eal/eal_vfio.c
> index d9541b1220..d7887388f9 100644
> --- a/lib/librte_eal/linux/eal/eal_vfio.c
> +++ b/lib/librte_eal/linux/eal/eal_vfio.c
> @@ -412,6 +412,9 @@ get_vfio_cfg_by_container_fd(int container_fd)
>  {
>         int i;
>
> +       if (container_fd == RTE_VFIO_DEFAULT_CONTAINER_FD)
> +               return default_vfio_cfg;
> +
>         for (i = 0; i < VFIO_MAX_CONTAINERS; i++) {
>                 if (vfio_cfgs[i].vfio_container_fd == container_fd)
>                         return &vfio_cfgs[i];
> --
> 2.17.1

Reviewed-by: David Marchand <david.marchand@redhat.com>

Shahaf, can you review this patch please?
Thanks.

-- 
David Marchand


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH] vfio: fix getting default container
  2019-11-04 19:35 ` David Marchand
@ 2019-11-05 12:38   ` Shahaf Shuler
  2019-11-06 13:44   ` David Marchand
  1 sibling, 0 replies; 4+ messages in thread
From: Shahaf Shuler @ 2019-11-05 12:38 UTC (permalink / raw)
  To: David Marchand, Anatoly Burakov
  Cc: dev, Damjan Marion (damarion),
	Thomas Monjalon, Dariusz Stojaczyk, dpdk stable

Monday, November 4, 2019 9:35 PM, David Marchand:
> Subject: Re: [PATCH] vfio: fix getting default container
> 
> On Mon, Nov 4, 2019 at 6:41 PM Anatoly Burakov
> <anatoly.burakov@intel.com> wrote:
> >
> > When requesting DMA mapping to default container, we are meant to
> > supply the RTE_VFIO_DEFAULT_CONTAINER_FD value, however this is not
> > handled correctly by get_vfio_cfg_by_container_fd(), because it only
> > looks at actual fd values and does not check for this special case.
> >
> > Fix it to return default container if the fd requested is the special
> > RTE_VFIO_DEFAULT_CONTAINER_FD value.
> >
> > Fixes: 4f5519ed8349 ("vfio: cleanup getting group fd")
> 
> RTE_VFIO_DEFAULT_CONTAINER_FD has been introduced in 4106d89a18f8
> ("vfio: allow DMA map to the default container") (19.05) as part of the
> rework deprecating rte_vfio_dma_map.
> 
> 
> >
> > Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> > ---
> >  lib/librte_eal/linux/eal/eal_vfio.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/lib/librte_eal/linux/eal/eal_vfio.c
> > b/lib/librte_eal/linux/eal/eal_vfio.c
> > index d9541b1220..d7887388f9 100644
> > --- a/lib/librte_eal/linux/eal/eal_vfio.c
> > +++ b/lib/librte_eal/linux/eal/eal_vfio.c
> > @@ -412,6 +412,9 @@ get_vfio_cfg_by_container_fd(int container_fd)  {
> >         int i;
> >
> > +       if (container_fd == RTE_VFIO_DEFAULT_CONTAINER_FD)
> > +               return default_vfio_cfg;
> > +
> >         for (i = 0; i < VFIO_MAX_CONTAINERS; i++) {
> >                 if (vfio_cfgs[i].vfio_container_fd == container_fd)
> >                         return &vfio_cfgs[i];
> > --
> > 2.17.1
> 
> Reviewed-by: David Marchand <david.marchand@redhat.com>
> 
> Shahaf, can you review this patch please?
> Thanks.

Looks good. Thanks for spotting this. 
Acked-by: Shahaf Shuler <shahafs@mellanox.com>


> 
> --
> David Marchand


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH] vfio: fix getting default container
  2019-11-04 19:35 ` David Marchand
  2019-11-05 12:38   ` Shahaf Shuler
@ 2019-11-06 13:44   ` David Marchand
  1 sibling, 0 replies; 4+ messages in thread
From: David Marchand @ 2019-11-06 13:44 UTC (permalink / raw)
  To: Anatoly Burakov, Shahaf Shuler
  Cc: dev, Damjan Marion (damarion),
	Thomas Monjalon, Dariusz Stojaczyk, dpdk stable

On Mon, Nov 4, 2019 at 8:35 PM David Marchand <david.marchand@redhat.com> wrote:
>
> On Mon, Nov 4, 2019 at 6:41 PM Anatoly Burakov
> <anatoly.burakov@intel.com> wrote:
> >
> > When requesting DMA mapping to default container, we are meant to
> > supply the RTE_VFIO_DEFAULT_CONTAINER_FD value, however this is
> > not handled correctly by get_vfio_cfg_by_container_fd(), because
> > it only looks at actual fd values and does not check for this
> > special case.
> >
> > Fix it to return default container if the fd requested is the
> > special RTE_VFIO_DEFAULT_CONTAINER_FD value.
> >

Fixes: 4106d89a18f8 ("vfio: allow DMA map to the default container")
Cc: stable@dpdk.org

> > Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> Reviewed-by: David Marchand <david.marchand@redhat.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>

Applied with title "vfio: fix DMA mapping with default container" as
discussed on irc.
Thanks.


--
David Marchand


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-11-06 13:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-04 17:41 [dpdk-dev] [PATCH] vfio: fix getting default container Anatoly Burakov
2019-11-04 19:35 ` David Marchand
2019-11-05 12:38   ` Shahaf Shuler
2019-11-06 13:44   ` David Marchand

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).