DPDK patches and discussions
 help / color / mirror / Atom feed
From: Lance Richardson <lance.richardson@broadcom.com>
To: Ruifeng Wang <Ruifeng.Wang@arm.com>
Cc: "Ajit Khaparde (ajit.khaparde@broadcom.com)"
	<ajit.khaparde@broadcom.com>,
	Somnath Kotur <somnath.kotur@broadcom.com>,
	 Bruce Richardson <bruce.richardson@intel.com>,
	 Konstantin Ananyev <konstantin.ananyev@intel.com>,
	"jerinj@marvell.com" <jerinj@marvell.com>,
	 Stephen Hurd <stephen.hurd@broadcom.com>,
	 David Christensen <david.christensen@broadcom.com>,
	"dev@dpdk.org" <dev@dpdk.org>,
	 "stable@dpdk.org" <stable@dpdk.org>, nd <nd@arm.com>
Subject: Re: [dpdk-dev] [PATCH] net/bnxt: fix missing barriers in completion handling
Date: Fri, 9 Jul 2021 10:48:35 -0400	[thread overview]
Message-ID: <CADyeNEA3hEX9YNYuPgCakoNZLQL-ZxXTH+Oa8fDH8zG0E2e3Vg@mail.gmail.com> (raw)
In-Reply-To: <HE1PR0802MB2474CDAA57CCF626D8F887999E189@HE1PR0802MB2474.eurprd08.prod.outlook.com>

[-- Attachment #1: Type: text/plain, Size: 2435 bytes --]

On Fri, Jul 9, 2021 at 2:00 AM Ruifeng Wang <Ruifeng.Wang@arm.com> wrote:
>
<snip>
> > +/**
> > + * Check validity of a completion ring entry. If the entry is valid, include a
> > + * C11 __ATOMIC_ACQUIRE fence to ensure that subsequent loads of fields
> > in the
> > + * completion are not hoisted by the compiler or by the CPU to come before
> > the
> > + * loading of the "valid" field.
> > + *
> > + * Note: the caller must not access any fields in the specified completion
> > + * entry prior to calling this function.
> > + *
> > + * @param cmp
> Nit, cmpl

Thanks, good catch. I'll fix this in v2.

<snip>
>
> >
> >       /* Check to see if hw has posted a completion for the descriptor. */
> > @@ -3327,7 +3327,7 @@ bnxt_tx_descriptor_status_op(void *tx_queue,
> > uint16_t offset)
> >               cons = RING_CMPL(ring_mask, raw_cons);
> >               txcmp = (struct tx_cmpl *)&cp_desc_ring[cons];
> >
> > -             if (!CMP_VALID(txcmp, raw_cons, cp_ring_struct))
> > +             if (!bnxt_cpr_cmp_valid(txcmp, raw_cons, ring_mask + 1))
> cpr->cp_ring_struct->ring_size can be used instead of 'ring_mask + 1'?
>
> >                       break;
> >
> >               if (CMP_TYPE(txcmp) == TX_CMPL_TYPE_TX_L2)
>
> <snip>
>
> > diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_neon.c
> > b/drivers/net/bnxt/bnxt_rxtx_vec_neon.c
> > index 263e6ec3c..13211060c 100644
> > --- a/drivers/net/bnxt/bnxt_rxtx_vec_neon.c
> > +++ b/drivers/net/bnxt/bnxt_rxtx_vec_neon.c
> > @@ -339,7 +339,7 @@ bnxt_handle_tx_cp_vec(struct bnxt_tx_queue *txq)
> >               cons = RING_CMPL(ring_mask, raw_cons);
> >               txcmp = (struct tx_cmpl *)&cp_desc_ring[cons];
> >
> > -             if (!CMP_VALID(txcmp, raw_cons, cp_ring_struct))
> > +             if (!bnxt_cpr_cmp_valid(txcmp, raw_cons, ring_mask + 1))
> Same here. I think cpr->cp_ring_struct->ring_size can be used and it avoids calculation.
> Also some places in other vector files.

It's true that cpr->cp_ring_struct->ring_size and ring_mask + 1 are
equivalent, but there doesn't seem to be a meaningful difference
between the two in the generated code.

Based on disassembly of x86 and Arm code for this function, the compiler
correctly determines that the value of ring_mask + 1 doesn't change within
the loop, so it is only computed once. The only difference would be in
whether an add instruction or a load instruction is used to put the value
in the register.

  reply	other threads:[~2021-07-09 14:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-08 19:15 Lance Richardson
2021-07-09  5:59 ` Ruifeng Wang
2021-07-09 14:48   ` Lance Richardson [this message]
2021-07-09 16:38 ` [dpdk-dev] [PATCH v2] " Lance Richardson
2021-07-12  2:34   ` Ruifeng Wang
2021-07-12 21:43     ` Ajit Khaparde

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=CADyeNEA3hEX9YNYuPgCakoNZLQL-ZxXTH+Oa8fDH8zG0E2e3Vg@mail.gmail.com \
    --to=lance.richardson@broadcom.com \
    --cc=Ruifeng.Wang@arm.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=bruce.richardson@intel.com \
    --cc=david.christensen@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=nd@arm.com \
    --cc=somnath.kotur@broadcom.com \
    --cc=stable@dpdk.org \
    --cc=stephen.hurd@broadcom.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).