DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: David Marchand <david.marchand@redhat.com>
Cc: "Morten Brørup" <mb@smartsharesystems.com>,
	"Bruce Richardson" <bruce.richardson@intel.com>,
	dev@dpdk.org, "Chenbo Xia" <chenbo.xia@intel.com>,
	"Maxime Coquelin" <maxime.coquelin@redhat.com>,
	"Raslan Darawsheh" <rasland@nvidia.com>
Subject: Re: [PATCH] disable lock annotation with clang 3.4.2
Date: Tue, 14 Feb 2023 12:27:35 +0100	[thread overview]
Message-ID: <5904649.31tnzDBltd@thomas> (raw)
In-Reply-To: <BYAPR12MB3078A7A9D6484429C4598F37CFDD9@BYAPR12MB3078.namprd12.prod.outlook.com>

13/02/2023 17:36, Raslan Darawsheh:
> From: Morten Brørup <mb@smartsharesystems.com>
> > From: Bruce Richardson [mailto:bruce.richardson@intel.com]
> > > On Mon, Feb 13, 2023 at 03:44:55PM +0100, David Marchand wrote:
> > > > Venerable RHEL7 clang 3.4.2 has (at least) two issues with lock
> > > > annotations.
> > > >
> > > > A first one with regards to the attribute position:
> > > > ../lib/vhost/vhost.h:518:2: error: GCC does not allow
> > > > 	assert_exclusive_lock attribute in this position on a
> > > > 	function definition [-Werror,-Wgcc-compat]
> > > >         __rte_assert_exclusive_lock(&vq->access_lock)
> > > >         ^
> > > > ../lib/eal/include/rte_lock_annotations.h:29:38: note: expanded
> > > > 	from macro '__rte_assert_exclusive_lock'
> > > >         __attribute__((assert_exclusive_lock(__VA_ARGS__)))
> > > >                                             ^
> > > >
> > > > This can be worked around by splitting and having the allocation on
> > > the
> > > > function declaration.
> > > >
> > > > But on the other hand, clang 3.4.2 does not seem to propagate those
> > > > annotations in presence of a __builtin_expect (i.e. unlikely()), like
> > > > for example when calling if (unlikely(rte_spinlock_trylock() == 0)).
> > > >
> > > > Those annotations were only working with clang in any case, so
> > > restrict
> > > > to clang versions newer than 3.5.0.
> > > >
> > > > Fixes: 657a98f38940 ("eal: annotate spinlock, rwlock and seqlock")
> > > >
> > > > Signed-off-by: David Marchand <david.marchand@redhat.com>
[...]
> > > Are we likely to see any issues with this with any other compilers?
> > > Should
> > > we look to do a built-test in meson to determine feature support rather
> > > than checking clang versions explicitly?
> > >
> > > On the plus side, checking clang version like this makes it clear when
> > > we
> > > can drop the conditional.
> > 
> > I prefer this over auto-detection in meson, for the reason mentioned by
> > Bruce.
> > 
> > Furthermore, different compilers may use different syntax in the code, so it
> > is impossible to detect generically; the auto-detection would be per compiler
> > anyway.
> > 
> > Acked-by: Morten Brørup <mb@smartsharesystems.com>
> Tested-by: Raslan Darawsheh <rasland@nvidia.com>

Applied, thanks.



      reply	other threads:[~2023-02-14 11:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-13 14:44 David Marchand
2023-02-13 14:54 ` Bruce Richardson
2023-02-13 16:09   ` Morten Brørup
2023-02-13 16:36     ` Raslan Darawsheh
2023-02-14 11:27       ` Thomas Monjalon [this message]

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=5904649.31tnzDBltd@thomas \
    --to=thomas@monjalon.net \
    --cc=bruce.richardson@intel.com \
    --cc=chenbo.xia@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.com \
    --cc=mb@smartsharesystems.com \
    --cc=rasland@nvidia.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).