DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: Cheng Jiang <Cheng1.jiang@intel.com>
Cc: dev@dpdk.org, patrick.fu@intel.com
Subject: Re: [dpdk-dev] [PATCH 20.11] raw/ioat: added a flag to control copying handle parameters
Date: Mon, 13 Jul 2020 10:59:10 +0100	[thread overview]
Message-ID: <20200713095910.GE694@bricha3-MOBL.ger.corp.intel.com> (raw)
In-Reply-To: <20200713095530.GD694@bricha3-MOBL.ger.corp.intel.com>

On Mon, Jul 13, 2020 at 10:55:30AM +0100, Bruce Richardson wrote:
> On Mon, Jul 13, 2020 at 07:15:19AM +0000, Cheng Jiang wrote:
> > Added a flag which controls whether rte_ioat_enqueue_copy
> > and rte_ioat_completed_copies function should process
> > handle parameters to improve the performance when handle
> > parameters are not necessary to use. This is targeting
> > 20.11 release.
> > 
> > Signed-off-by: Cheng Jiang <Cheng1.jiang@intel.com>
> > ---
> >  drivers/raw/ioat/ioat_rawdev.c     |  1 +
> >  drivers/raw/ioat/rte_ioat_rawdev.h | 14 +++++++++++---
> >  2 files changed, 12 insertions(+), 3 deletions(-)
> > 
> <snip>
> > @@ -208,6 +213,11 @@ rte_ioat_completed_copies(int dev_id, uint8_t max_copies,
> >  	if (count > max_copies)
> >  		count = max_copies;
> >  
> > +	ioat->next_read = read + count;
> > +	ioat->completed += count;
> > +	if (!ioat->hdls_enable)
> > +		return count;
> > +
> >  	for (; i < count - 1; i += 2, read += 2) {
> >  		__m128i hdls0 = _mm_load_si128(&ioat->hdls[read & mask]);
> >  		__m128i hdls1 = _mm_load_si128(&ioat->hdls[(read + 1) & mask]);
> > @@ -223,8 +233,6 @@ rte_ioat_completed_copies(int dev_id, uint8_t max_copies,
> >  		dst_hdls[i] = hdls[1];
> >  	}
> >  
> > -	ioat->next_read = read;
> > -	ioat->completed += count;
> >  	return count;
> >  }
> 
> This change I think may cause problems if we ever want to have one thread
> enqueuing and another taking completions. The next_read and completed
> counters should really only be updated after we have finished reading the
> completed handles array. Therefore, for safety, I tihnk it might be better
> to keep the updates in their original places and put an "end:" label before
> them. Then the "return count" in the middle of the function can be "goto
> end;"
> 
A further suggestion to the changes to this function: if we are not
actually returning completion handles, then there is no need to limit the
count to "max_copies". Therefore move the "return count" or "goto end"
above the previous length check, and update the doxygen comments to
indicate that max_copies is ignored if "hdls_enable" is false, and that the
final two parameters can also be NULL when calling the function in this
case.

/Bruce

  reply	other threads:[~2020-07-13  9:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-13  7:15 Cheng Jiang
2020-07-13  9:31 ` Bruce Richardson
2020-07-13  9:55 ` Bruce Richardson
2020-07-13  9:59   ` Bruce Richardson [this message]
2020-07-13 13:28 ` Bruce Richardson
2020-07-14 10:45   ` Jiang, Cheng1
2020-07-15  2:16 ` [dpdk-dev] [PATCH 20.11 v2] raw/ioat: add " Cheng Jiang
2020-07-17 12:49   ` Bruce Richardson
2020-07-21 10:15     ` Bruce Richardson

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=20200713095910.GE694@bricha3-MOBL.ger.corp.intel.com \
    --to=bruce.richardson@intel.com \
    --cc=Cheng1.jiang@intel.com \
    --cc=dev@dpdk.org \
    --cc=patrick.fu@intel.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).