DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Morten Brørup" <mb@smartsharesystems.com>
To: "Thomas Monjalon" <thomas@monjalon.net>
Cc: <bruce.richardson@intel.com>, <konstantin.v.ananyev@yandex.ru>,
	<dev@dpdk.org>
Subject: RE: [PATCH] x86: rte_mov256 was missing for AVX2
Date: Mon, 29 Aug 2022 14:18:55 +0200	[thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35D872CB@smartserver.smartshare.dk> (raw)
In-Reply-To: <10793250.BaYr0rKQ5T@thomas>

> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Monday, 29 August 2022 12.56
> 
> 20/08/2022 12:30, Morten Brørup:
> > The rte_mov256 function was missing for AVX2.
> > Does nobody build test for AVX2 and check the compiler output?
> 
> Please could you specify the context/setup to reproduce the issue?

I stumbled upon it while working on the new non-temporal memcpy function.

Reproduction described below.

> 
> An error message would be nice to paste here as well.
> Thanks

The rte_memcpy declarations are in the lib/eal/generic/rte_memcpy.h header file, so add this declaration header file to the implementation file. (I wonder why it is not already there?)

lib/eal/x86/rte_memcpy.h:

  #include <rte_common.h>
  #include <rte_config.h>
  #include <rte_debug.h>
+ #include "generic/rte_memcpy.h"

  #ifdef __cplusplus
  extern "C" {
  #endif


The error messages from ninja look like this:

[46/2597] Compiling C object lib/acl/libavx2_tmp.a.p/acl_run_avx2.c.o
In file included from ../lib/eal/x86/include/rte_memcpy.h:24,
                 from ../lib/acl/rte_acl_osdep.h:40,
                 from ../lib/acl/rte_acl.h:14,
                 from ../lib/acl/acl_run.h:8,
                 from ../lib/acl/acl_run_sse.h:5,
                 from ../lib/acl/acl_run_avx2.h:5,
                 from ../lib/acl/acl_run_avx2.c:6:
../lib/eal/include/generic/rte_memcpy.h:89:1: warning: 'rte_mov256' declared 'static' but never defined [-Wunused-function]
   89 | rte_mov256(uint8_t *dst, const uint8_t *src);
      | ^~~~~~~~~~
[52/2597] Compiling C object lib/acl/libavx512_tmp.a.p/acl_run_avx512.c.o
In file included from ../lib/eal/x86/include/rte_memcpy.h:24,
                 from ../lib/acl/rte_acl_osdep.h:40,
                 from ../lib/acl/rte_acl.h:14,
                 from ../lib/acl/acl_run.h:8,
                 from ../lib/acl/acl_run_sse.h:5,
                 from ../lib/acl/acl_run_avx512.c:5:
../lib/eal/include/generic/rte_memcpy.h:89:1: warning: 'rte_mov256' declared 'static' but never defined [-Wunused-function]
   89 | rte_mov256(uint8_t *dst, const uint8_t *src);
      | ^~~~~~~~~~


At SmartShare Systems we follow a coding convention of including the declaration header file at the absolute top of the file implementing it. This reveals at build time if anything is missing in the declaration header file. The DPDK Project could do the same, and find bugs like this.

Here's an example:

foo.h:
------
// Declaration
static inline uint32_t bar(uint32_t x);

foo.c:
------
#include <foo.h> // <-- Note: At the absolute top!
#include <stdint.h>

// Implementation
static inline uint32_t bar(uint32_t x)
{
	return x * 2;
}

Following our coding convention will reveal that <stdint.h> is required for using <foo.h>, and thus should be included in foo.h (not in foo.c) - because someone else might include <foo.h>, and then <stdint.h> could be missing there.

-Morten


  reply	other threads:[~2022-08-29 12:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-20 10:30 Morten Brørup
2022-08-29 10:55 ` Thomas Monjalon
2022-08-29 12:18   ` Morten Brørup [this message]
2022-08-29 13:12     ` Thomas Monjalon
2022-09-28 19:44 ` Morten Brørup
2022-09-29  8:25   ` Bruce Richardson
2022-09-30  8:34 ` David Marchand

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=98CBD80474FA8B44BF855DF32C47DC35D872CB@smartserver.smartshare.dk \
    --to=mb@smartsharesystems.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.v.ananyev@yandex.ru \
    --cc=thomas@monjalon.net \
    /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).