DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: "Morten Brørup" <mb@smartsharesystems.com>
Cc: <dev@dpdk.org>, Jerin Jacob <jerinj@marvell.com>
Subject: Re: [PATCH v3] eventdev: ensure 16-byte alignment for events
Date: Fri, 6 Oct 2023 11:44:28 +0100	[thread overview]
Message-ID: <ZR/lDC88s+HYXw27@bricha3-MOBL.ger.corp.intel.com> (raw)
In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35E9EF04@smartserver.smartshare.dk>

On Fri, Oct 06, 2023 at 12:35:26PM +0200, Morten Brørup wrote:
> > From: Bruce Richardson [mailto:bruce.richardson@intel.com]
> > Sent: Friday, 6 October 2023 12.17
> ev: ensure 16-byte alignment for events
> > 
> > On Fri, Oct 06, 2023 at 12:13:54PM +0200, Morten Brørup wrote:
> > > > From: Bruce Richardson [mailto:bruce.richardson@intel.com]
> > > > Sent: Friday, 6 October 2023 11.45
> > > >
> > > > The event structure in DPDK is 16-bytes in size, and events are
> > > > regularly passed as parameters directly rather than being passed as
> > > > pointers. To help compiler optimize correctly, we can explicitly request
> > > > 16-byte alignment for events, which means that we should be able
> > > > to do aligned vector loads/stores (e.g. with SSE or Neon) when working
> > > > with those events.
> > > >
> > > > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > > > Acked-by: Morten Brørup <mb@smartsharesystems.com>
> > > > Acked-by: Jerin Jacob <jerinj@marvell.com>
> > > >
> > > > ---
> > >
> > > [...]
> > >
> > > > +_Static_assert(sizeof(struct rte_event) == 16, "Event structure size is
> > not 16-bytes in size");
> > >
> > > Thank you for adding this extra check. We should have more of these.
> > >
> > > NB: _Static_assert is deprecated in C23 [1], so for forward compatibility,
> > you could use static_assert (which is available in <assert.h>) instead. Nice
> > to have; feel free to ignore this comment.
> > >
> > Is the availability in assert.h backward compatible with C11, since the
> > link you posted seems to imply that "static_assert" is only from C23
> > onwards?
> 
> Yes, the link mentions "static_assert" being available for C11 as a convenience macro in assert.h.
> 
> I had to read the link very carefully to get this. I guess I'm not the only one. :-)
> 

I missed that in the link, but I did have a read of the header file itself
to see that there was a macro there with C11 guards. :-)

> I don't object to moving it to the .c file. However, I think it's convenient for readability to have the static_assert close to the thing it checks, and/or close to any code that relies on the assumption it checks.
> 
I'm ok either way, and happy enough to have the check in the C file. I
suppose it saves cluttering up the public header file with checks that
should not be relevant to the end-user, and are only for DPDK developers.

Anyway, v4 sent, hopefully with all concerns addressed.

/Bruce

  reply	other threads:[~2023-10-06 10:44 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-05 11:51 [RFC PATCH] " Bruce Richardson
2023-10-05 12:06 ` Bruce Richardson
2023-10-05 13:11   ` Jerin Jacob
2023-10-05 13:15     ` Bruce Richardson
2023-10-06  7:19       ` Jerin Jacob
2023-10-05 12:12 ` Morten Brørup
2023-10-05 13:02   ` Bruce Richardson
2023-10-06  9:37 ` [PATCH v2] " Bruce Richardson
2023-10-06  9:45 ` [PATCH v3] " Bruce Richardson
2023-10-06 10:13   ` Morten Brørup
2023-10-06 10:16     ` Jerin Jacob
2023-10-06 10:19       ` Bruce Richardson
2023-10-06 10:24         ` Jerin Jacob
2023-10-06 10:27           ` Bruce Richardson
2023-10-06 10:16     ` Bruce Richardson
2023-10-06 10:35       ` Morten Brørup
2023-10-06 10:44         ` Bruce Richardson [this message]
2023-10-06 10:29 ` [PATCH v4] " Bruce Richardson
2023-11-12  0:01   ` Stephen Hemminger
2023-11-12  8:30     ` Morten Brørup
2023-11-12 23:31       ` Stephen Hemminger
2023-11-13  7:58         ` Morten Brørup
2024-01-19 21:05           ` Tyler Retzlaff
2023-10-06 12:15 ` [RFC PATCH] " Mattias Rönnblom
2023-10-06 12:19   ` Bruce Richardson
2023-10-06 12:29     ` Mattias Rönnblom
2024-01-19 22:30   ` Stephen Hemminger

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=ZR/lDC88s+HYXw27@bricha3-MOBL.ger.corp.intel.com \
    --to=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=mb@smartsharesystems.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).