DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Kusztal, ArkadiuszX" <arkadiuszx.kusztal@intel.com>
To: "Marchand, David" <david.marchand@redhat.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"ferruh.yigit@amd.com" <ferruh.yigit@amd.com>,
	"Ji, Kai" <kai.ji@intel.com>,
	"Dooley, Brian" <brian.dooley@intel.com>
Subject: RE: [PATCH v2 1/3] net: add thread-safe crc api
Date: Wed, 2 Oct 2024 08:41:12 +0000	[thread overview]
Message-ID: <PH0PR11MB5013C6D5E43705F9484D9A7F9F702@PH0PR11MB5013.namprd11.prod.outlook.com> (raw)
In-Reply-To: <CAJFAV8ww=+BczRS-yab-1_N2BqUJza2eOGghvL0160HAb_Ywrw@mail.gmail.com>



> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Wednesday, October 2, 2024 9:42 AM
> To: Kusztal, ArkadiuszX <arkadiuszx.kusztal@intel.com>
> Cc: dev@dpdk.org; ferruh.yigit@amd.com; Ji, Kai <kai.ji@intel.com>; Dooley,
> Brian <brian.dooley@intel.com>
> Subject: Re: [PATCH v2 1/3] net: add thread-safe crc api
> 
> On Tue, Oct 1, 2024 at 9:27 PM Arkadiusz Kusztal
> <arkadiuszx.kusztal@intel.com> wrote:
> >
> > The current net CRC API is not thread-safe, this patch solves this by
> > adding another, thread-safe API functions.
> > This API is also safe to use across multiple processes, yet with
> > limitations on max-simd-bitwidth, which will be checked only by the
> > process that created the CRC context; all other processes will use the
> > same CRC function when used with the same CRC context.
> > It is an undefined behavior when process binaries are compiled with
> > different SIMD capabilities when the same CRC context is used.
> >
> > Signed-off-by: Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>
> 
> I am lost... do you mean thread-safe ? or DPDK multi process safe?

In this case both.

> 
> For now, I don't see why we need a new API (and especially why we should
> break the existing one..).

In the current one, there exists a race condition that causes multi-threaded applications to crash; currently only QAT PMD is using it.
But I know it is late for such a change, so I probably should defer it. We can manage to fix it in a different way.

> 
> 
> > ---
> >  lib/net/net_crc.h     |  19 ++--
> >  lib/net/rte_net_crc.c | 309
> > +++++++++++++++-----------------------------------
> >  lib/net/rte_net_crc.h |  40 ++-----
> >  lib/net/version.map   |  18 ++-
> >  4 files changed, 124 insertions(+), 262 deletions(-)
> >
> > diff --git a/lib/net/net_crc.h b/lib/net/net_crc.h index
> > 7a74d5406c..d220200685 100644
> > --- a/lib/net/net_crc.h
> > +++ b/lib/net/net_crc.h
> > @@ -5,40 +5,41 @@
> >  #ifndef _NET_CRC_H_
> >  #define _NET_CRC_H_
> >
> > -/*
> > - * Different implementations of CRC
> > - */
> > -
> > -/* SSE4.2 */
> > +#include <rte_compat.h>
> >
> > +__rte_internal
> >  void
> >  rte_net_crc_sse42_init(void);
> >
> > +__rte_internal
> >  uint32_t
> >  rte_crc16_ccitt_sse42_handler(const uint8_t *data, uint32_t
> > data_len);
> >
> > +__rte_internal
> >  uint32_t
> >  rte_crc32_eth_sse42_handler(const uint8_t *data, uint32_t data_len);
> >
> > -/* AVX512 */
> > -
> > +__rte_internal
> >  void
> >  rte_net_crc_avx512_init(void);
> >
> > +__rte_internal
> >  uint32_t
> >  rte_crc16_ccitt_avx512_handler(const uint8_t *data, uint32_t
> > data_len);
> >
> > +__rte_internal
> >  uint32_t
> >  rte_crc32_eth_avx512_handler(const uint8_t *data, uint32_t data_len);
> >
> > -/* NEON */
> > -
> > +__rte_internal
> >  void
> >  rte_net_crc_neon_init(void);
> >
> > +__rte_internal
> >  uint32_t
> >  rte_crc16_ccitt_neon_handler(const uint8_t *data, uint32_t data_len);
> >
> > +__rte_internal
> >  uint32_t
> >  rte_crc32_eth_neon_handler(const uint8_t *data, uint32_t data_len);
> 
> Exporting internals but not using them out of the library makes no sense.
> 
So there must have been a misunderstanding on my part, the initial idea was to prevent the user from calling these functions.

> 
> --
> David Marchand


  reply	other threads:[~2024-10-02  8:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-01 18:11 [PATCH v2 0/3] " Arkadiusz Kusztal
2024-10-01 18:11 ` [PATCH v2 1/3] " Arkadiusz Kusztal
2024-10-01 21:44   ` Stephen Hemminger
2024-10-02  8:28     ` Kusztal, ArkadiuszX
2024-10-02  7:42   ` David Marchand
2024-10-02  8:41     ` Kusztal, ArkadiuszX [this message]
2024-10-02  9:01       ` David Marchand
2024-10-02  9:16         ` Kusztal, ArkadiuszX
2024-10-01 18:11 ` [PATCH v2 2/3] crypto/qat: use process safe " Arkadiusz Kusztal
2024-10-01 18:11 ` [PATCH v2 3/3] test/crc: replace thread-unsafe api functions Arkadiusz Kusztal

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=PH0PR11MB5013C6D5E43705F9484D9A7F9F702@PH0PR11MB5013.namprd11.prod.outlook.com \
    --to=arkadiuszx.kusztal@intel.com \
    --cc=brian.dooley@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=kai.ji@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).