patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Shahaf Shuler <shahafs@mellanox.com>
To: "Nélio Laranjeiro" <nelio.laranjeiro@6wind.com>
Cc: Yongseok Koh <yskoh@mellanox.com>,
	Adrien Mazarguil <adrien.mazarguil@6wind.com>,
	"dev@dpdk.org" <dev@dpdk.org>,
	"stable@dpdk.org" <stable@dpdk.org>,
	"Xueming(Steven) Li" <xuemingl@mellanox.com>
Subject: Re: [dpdk-stable] [PATCH 2/5] net/mlx5: fix secondary process mempool registration
Date: Wed, 24 Jan 2018 13:37:42 +0000	[thread overview]
Message-ID: <VI1PR05MB31499EA2D3D5016B7DCE5C70C3E20@VI1PR05MB3149.eurprd05.prod.outlook.com> (raw)
In-Reply-To: <20180124081406.vzcfpk5btabyzqa6@laranjeiro-vm.dev.6wind.com>

Wednesday, January 24, 2018 10:14 AM, Nélio Laranjeiro:
> Hi Shahaf,
> 
> On Tue, Jan 23, 2018 at 07:08:20PM +0200, Shahaf Shuler wrote:
> > Secondary process is not allowed to register mempools on the flight.
> >
> > The code will return invalid memory key for such case.
> >
> > Fixes: 87ec44ce1651 ("net/mlx5: add operations for secondary process")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
> > Signed-off-by: Xueming Li <xuemingl@mellanox.com>
> > ---
> >  doc/guides/nics/mlx5.rst     |  7 ++++++-
> >  drivers/net/mlx5/mlx5_rxtx.h | 17 ++++++++++++++---
> >  2 files changed, 20 insertions(+), 4 deletions(-)
> >
> > diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index
> > bdc2216c0..2f860402f 100644
> > --- a/doc/guides/nics/mlx5.rst
> > +++ b/doc/guides/nics/mlx5.rst
> > @@ -106,7 +106,12 @@ Limitations
> >
> >  - Inner RSS for VXLAN frames is not supported yet.
> >  - Hardware checksum RX offloads for VXLAN inner header are not
> supported yet.
> > -- Forked secondary process not supported.
> > +- For secondary process:
> > +
> > +  - Forked secondary process not supported.
> > +  - All mempools must be initialized before rte_eth_dev_start().
> > +  - Number of mempools must less than
> > + CONFIG_RTE_LIBRTE_MLX5_TX_MP_CACHE
> 
> Why such limitation?  Registering a new memory is independent of searching
> a new one when the cache is too small.
> 
> >  - Flow pattern without any specific vlan will match for vlan packets as well:
> >
> >    When VLAN spec is not specified in the pattern, the matching rule will be
> created with VLAN as a wild card.
> > diff --git a/drivers/net/mlx5/mlx5_rxtx.h
> > b/drivers/net/mlx5/mlx5_rxtx.h index a63364d79..79cdfc793 100644
> > --- a/drivers/net/mlx5/mlx5_rxtx.h
> > +++ b/drivers/net/mlx5/mlx5_rxtx.h
> > @@ -550,6 +550,7 @@ mlx5_tx_mb2mr(struct mlx5_txq_data *txq, struct
> rte_mbuf *mb)
> >  	uint16_t i = txq->mr_cache_idx;
> >  	uintptr_t addr = rte_pktmbuf_mtod(mb, uintptr_t);
> >  	struct mlx5_mr *mr;
> > +	struct rte_mempool *mp;
> >
> >  	assert(i < RTE_DIM(txq->mp2mr));
> >  	if (likely(txq->mp2mr[i]->start <= addr && txq->mp2mr[i]->end >=
> > addr)) @@ -563,14 +564,24 @@ mlx5_tx_mb2mr(struct mlx5_txq_data
> *txq, struct rte_mbuf *mb)
> >  		if (txq->mp2mr[i]->start <= addr &&
> >  		    txq->mp2mr[i]->end >= addr) {
> >  			assert(txq->mp2mr[i]->lkey != (uint32_t)-1);
> > -			assert(rte_cpu_to_be_32(txq->mp2mr[i]->mr->lkey)
> ==
> > -			       txq->mp2mr[i]->lkey);
> > +			if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
> > +				assert(rte_cpu_to_be_32(txq->mp2mr[i]-
> >mr->lkey)
> > +				       == txq->mp2mr[i]->lkey);
> > +			}
> 
> This code should be inside priv_txq_mp2mr_reg() to let the secondary
> search inside the MR list when the cache is too small.

You probably mean below code and not above. Yes good suggestion.
Regarding the above code - the assert in un-accessible from the secondary process as it tries to access ibv_mr.
I will add another patch to remove this assert completely (in order to save the comparison logic). 

> 
> If it does not find any MR it should fail before calling priv_mr_new().
> 
> >  			txq->mr_cache_idx = i;
> >  			return txq->mp2mr[i]->lkey;
> >  		}
> >  	}
> >  	txq->mr_cache_idx = 0;
> > -	mr = mlx5_txq_mp2mr_reg(txq, mlx5_tx_mb2mp(mb), i);
> > +	mp = mlx5_tx_mb2mp(mb);
> > +	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
> > +		WARN("Using unregistered mempool 0x%p(%s) in secondary
> process,"
> > +		     " please create mempool before rte_eth_dev_start()",
> > +		     (void *)mp, mp->name);
> > +		assert(rte_eal_process_type() == RTE_PROC_PRIMARY);
> > +		return (uint32_t)-1;
> > +	}
> > +	mr = mlx5_txq_mp2mr_reg(txq, mp, i);
> >  	/*
> >  	 * Request the reference to use in this queue, the original one is
> >  	 * kept by the control plane.
> > --
> > 2.12.0
> 
> --
> Nélio Laranjeiro
> 6WIND

  reply	other threads:[~2018-01-24 13:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1516727100.git.shahafs@mellanox.com>
2018-01-23 17:08 ` [dpdk-stable] [PATCH 1/5] net/mlx5: fix Memory Region cache lookup Shahaf Shuler
2018-01-23 17:08 ` [dpdk-stable] [PATCH 2/5] net/mlx5: fix secondary process mempool registration Shahaf Shuler
2018-01-24  8:14   ` Nélio Laranjeiro
2018-01-24 13:37     ` Shahaf Shuler [this message]
2018-01-23 17:08 ` [dpdk-stable] [PATCH 4/5] net/mlx5: fix memory registration cache last index Shahaf Shuler
     [not found] ` <cover.1516896871.git.shahafs@mellanox.com>
2018-01-25 16:17   ` [dpdk-stable] [PATCH v2 1/6] net/mlx5: fix Memory Region cache lookup Shahaf Shuler
2018-01-25 16:17   ` [dpdk-stable] [PATCH v2 2/6] net/mlx5: fix secondary process mempool registration Shahaf Shuler
2018-01-25 16:18   ` [dpdk-stable] [PATCH v2 5/6] net/mlx5: fix Memory Region cache last index Shahaf Shuler

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=VI1PR05MB31499EA2D3D5016B7DCE5C70C3E20@VI1PR05MB3149.eurprd05.prod.outlook.com \
    --to=shahafs@mellanox.com \
    --cc=adrien.mazarguil@6wind.com \
    --cc=dev@dpdk.org \
    --cc=nelio.laranjeiro@6wind.com \
    --cc=stable@dpdk.org \
    --cc=xuemingl@mellanox.com \
    --cc=yskoh@mellanox.com \
    /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).