DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Nélio Laranjeiro" <nelio.laranjeiro@6wind.com>
To: Yongseok Koh <yskoh@mellanox.com>
Cc: Ferruh Yigit <ferruh.yigit@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>,
	Adrien Mazarguil <adrien.mazarguil@6wind.com>
Subject: Re: [dpdk-dev] [PATCH v2 3/5] net/mlx5: use buffer address for LKEY search
Date: Tue, 4 Jul 2017 08:54:54 +0200	[thread overview]
Message-ID: <20170704065436.GA21379@autoinstall.dev.6wind.com> (raw)
In-Reply-To: <4771B0EC-2A1E-4A0C-86C5-231289F3E0F2@mellanox.com>

On Mon, Jul 03, 2017 at 08:54:43PM +0000, Yongseok Koh wrote:
> 
> > On Jul 3, 2017, at 7:06 AM, Nélio Laranjeiro <nelio.laranjeiro@6wind.com> wrote:
> > 
> > On Fri, Jun 30, 2017 at 12:23:31PM -0700, Yongseok Koh wrote:
> >> When searching LKEY, if search key is mempool pointer, the 2nd cacheline
> >> has to be accessed and it even requires to check whether a buffer is
> >> indirect per every search. Instead, using address for search key can reduce
> >> cycles taken. And caching the last hit entry is beneficial as well.
> >> 
> >> Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
> >> ---
> >> drivers/net/mlx5/mlx5_mr.c   | 17 ++++++++++++++---
> >> drivers/net/mlx5/mlx5_rxtx.c | 39 +++++++++++++++++++++------------------
> >> drivers/net/mlx5/mlx5_rxtx.h |  4 +++-
> >> drivers/net/mlx5/mlx5_txq.c  |  3 +--
> >> 4 files changed, 39 insertions(+), 24 deletions(-)
> >> 
> >> diff --git a/drivers/net/mlx5/mlx5_mr.c b/drivers/net/mlx5/mlx5_mr.c
> >> index 0a3638460..287335179 100644
> >> --- a/drivers/net/mlx5/mlx5_mr.c
> >> +++ b/drivers/net/mlx5/mlx5_mr.c
> >> @@ -265,18 +266,28 @@ txq_mp2mr_iter(struct rte_mempool *mp, void *arg)
> >> 	struct txq_mp2mr_mbuf_check_data data = {
> >> 		.ret = 0,
> >> 	};
> >> +	uintptr_t start;
> >> +	uintptr_t end;
> >> 	unsigned int i;
> >> 
> >> 	/* Register mempool only if the first element looks like a mbuf. */
> >> 	if (rte_mempool_obj_iter(mp, txq_mp2mr_mbuf_check, &data) == 0 ||
> >> 			data.ret == -1)
> >> 		return;
> >> +	if (mlx5_check_mempool(mp, &start, &end) != 0) {
> >> +		ERROR("mempool %p: not virtually contiguous",
> >> +		      (void *)mp);
> >> +		return;
> >> +	}
> >> 	for (i = 0; (i != RTE_DIM(txq_ctrl->txq.mp2mr)); ++i) {
> >> -		if (unlikely(txq_ctrl->txq.mp2mr[i].mp == NULL)) {
> >> +		struct ibv_mr *mr = txq_ctrl->txq.mp2mr[i].mr;
> >> +
> >> +		if (unlikely(mr == NULL)) {
> >> 			/* Unknown MP, add a new MR for it. */
> >> 			break;
> >> 		}
> >> -		if (txq_ctrl->txq.mp2mr[i].mp == mp)
> >> +		if (start >= (uintptr_t)mr->addr &&
> >> +		    end <= (uintptr_t)mr->addr + mr->length)
> >> 			return;
> >> 	}
> >> 	txq_mp2mr_reg(&txq_ctrl->txq, mp, i);
> > 
> > if (start >= (uintptr_t)mr->addr &&
> >     end <= (uintptr_t)mr->addr + mr->length)
> > 
> > Is this expected to have a memory region bigger than the memory pool
> > space?  I mean I was expecting to see strict equality in the addresses.
> In mlx5_mp2mr(), start/end of a memory region are rounded up to make it
> aligned to its hugepage size.
> 
> struct ibv_mr *
> mlx5_mp2mr(struct ibv_pd *pd, struct rte_mempool *mp)
> {
> [...]
>         /* Round start and end to page boundary if found in memory segments. */
>         for (i = 0; (i < RTE_MAX_MEMSEG) && (ms[i].addr != NULL); ++i) {
>                 uintptr_t addr = (uintptr_t)ms[i].addr;
>                 size_t len = ms[i].len;
>                 unsigned int align = ms[i].hugepage_sz;
> 
>                 if ((start > addr) && (start < addr + len))
>                         start = RTE_ALIGN_FLOOR(start, align);
>                 if ((end > addr) && (end < addr + len))
>                         end = RTE_ALIGN_CEIL(end, align);
>         }
> 

Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>

-- 
Nélio Laranjeiro
6WIND

  reply	other threads:[~2017-07-04  6:55 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-28 23:03 [dpdk-dev] [PATCH 0/5] net/mlx5: add vectorized Rx/Tx burst for x86 Yongseok Koh
2017-06-28 23:03 ` [dpdk-dev] [PATCH 1/5] net/mlx5: change indexing for Tx SW ring Yongseok Koh
2017-06-30 12:20   ` Nélio Laranjeiro
2017-06-28 23:04 ` [dpdk-dev] [PATCH 2/5] net/mlx5: free buffers in bulk on Tx completion Yongseok Koh
2017-06-30 12:30   ` Nélio Laranjeiro
2017-06-30 12:43     ` Nélio Laranjeiro
2017-06-30 17:49       ` Yongseok Koh
2017-06-28 23:04 ` [dpdk-dev] [PATCH 3/5] net/mlx5: use buffer address for LKEY search Yongseok Koh
2017-06-30 13:01   ` Nélio Laranjeiro
2017-06-30 18:58     ` Yongseok Koh
2017-06-28 23:04 ` [dpdk-dev] [PATCH 4/5] net/mlx5: select Rx/Tx callbacks when starting device Yongseok Koh
2017-06-30 13:02   ` Nélio Laranjeiro
2017-06-28 23:04 ` [dpdk-dev] [PATCH 5/5] net/mlx5: add vectorized Rx/Tx burst for SSE4.1 Yongseok Koh
2017-06-30 19:23 ` [dpdk-dev] [PATCH v2 0/5] net/mlx5: add vectorized Rx/Tx burst for x86 Yongseok Koh
2017-06-30 19:23   ` [dpdk-dev] [PATCH v2 1/5] net/mlx5: change indexing for Tx SW ring Yongseok Koh
2017-07-03 13:48     ` Nélio Laranjeiro
2017-06-30 19:23   ` [dpdk-dev] [PATCH v2 2/5] net/mlx5: free buffers in bulk on Tx completion Yongseok Koh
2017-07-03 13:58     ` Nélio Laranjeiro
2017-06-30 19:23   ` [dpdk-dev] [PATCH v2 3/5] net/mlx5: use buffer address for LKEY search Yongseok Koh
2017-07-03 14:06     ` Nélio Laranjeiro
2017-07-03 20:54       ` Yongseok Koh
2017-07-04  6:54         ` Nélio Laranjeiro [this message]
2017-06-30 19:23   ` [dpdk-dev] [PATCH v2 4/5] net/mlx5: select Rx/Tx callbacks when starting device Yongseok Koh
2017-07-03 13:49     ` Nélio Laranjeiro
2017-06-30 19:23   ` [dpdk-dev] [PATCH v2 5/5] net/mlx5: add vectorized Rx/Tx burst for SSE4.1 Yongseok Koh
2017-07-03 23:54     ` Thomas Monjalon
2017-07-04  8:58     ` Nélio Laranjeiro
2017-07-05  0:38       ` Yongseok Koh
2017-07-05  8:21         ` Nélio Laranjeiro
2017-07-05 17:41           ` Yongseok Koh
2017-06-30 21:28   ` [dpdk-dev] [PATCH v2 0/5] net/mlx5: add vectorized Rx/Tx burst for x86 Bruce Richardson
2017-07-05 18:12 ` [dpdk-dev] [PATCH v3 " Yongseok Koh
2017-07-05 18:12   ` [dpdk-dev] [PATCH v3 1/5] net/mlx5: change indexing for Tx SW ring Yongseok Koh
2017-07-05 18:12   ` [dpdk-dev] [PATCH v3 2/5] net/mlx5: free buffers in bulk on Tx completion Yongseok Koh
2017-07-05 18:12   ` [dpdk-dev] [PATCH v3 3/5] net/mlx5: use buffer address for LKEY search Yongseok Koh
2017-07-05 18:12   ` [dpdk-dev] [PATCH v3 4/5] net/mlx5: select Rx/Tx callbacks when starting device Yongseok Koh
2017-07-06  7:17     ` Nélio Laranjeiro
2017-07-05 18:12   ` [dpdk-dev] [PATCH v3 5/5] net/mlx5: add vectorized Rx/Tx burst for SSE4.1 Yongseok Koh
2017-07-05 22:58     ` Yongseok Koh
2017-07-06  7:16     ` Nélio Laranjeiro
2017-07-06  9:58     ` Ferruh Yigit
2017-07-06 18:41 ` [dpdk-dev] [PATCH v4 0/5] net/mlx5: add vectorized Rx/Tx burst for x86 Yongseok Koh
2017-07-06 18:41   ` [dpdk-dev] [PATCH v4 1/5] net/mlx5: change indexing for Tx SW ring Yongseok Koh
2017-07-06 18:41   ` [dpdk-dev] [PATCH v4 2/5] net/mlx5: free buffers in bulk on Tx completion Yongseok Koh
2017-07-06 18:41   ` [dpdk-dev] [PATCH v4 3/5] net/mlx5: use buffer address for LKEY search Yongseok Koh
2017-07-06 18:41   ` [dpdk-dev] [PATCH v4 4/5] net/mlx5: select Rx/Tx callbacks when starting device Yongseok Koh
2017-07-06 18:41   ` [dpdk-dev] [PATCH v4 5/5] net/mlx5: add vectorized Rx/Tx burst for x86 Yongseok Koh
2017-07-07  9:58   ` [dpdk-dev] [PATCH v4 0/5] " Ferruh Yigit

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=20170704065436.GA21379@autoinstall.dev.6wind.com \
    --to=nelio.laranjeiro@6wind.com \
    --cc=adrien.mazarguil@6wind.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.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).