All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Florian Westphal <fw@strlen.de>
Cc: <netdev@vger.kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	<netfilter-devel@vger.kernel.org>,
	pablo@netfilter.org
Subject: Re: [PATCH net 1/2] selftests: netfilter: fix udpclash tool hang
Date: Wed, 3 Sep 2025 15:15:54 -0700	[thread overview]
Message-ID: <20250903151554.5c72661e@kernel.org> (raw)
In-Reply-To: <20250902185855.25919-2-fw@strlen.de>

On Tue,  2 Sep 2025 20:58:54 +0200 Florian Westphal wrote:
> Yi Chen reports that 'udpclash' loops forever depending on compiler
> (and optimization level used); while (x == 1) gets optimized into
> for (;;).  Switch to stdatomic to prevent this.

gcc version 15.1.1 (F42) w/ whatever flags kselftests use appear to be
unaware of this macro:

udpclash.c:33:26: error: implicit declaration of function ‘ATOMIC_VAR_INIT’; did you mean ‘ATOMIC_FLAG_INIT’? [-Wimplicit-function-declaration]
   33 | static atomic_int wait = ATOMIC_VAR_INIT(1);
      |                          ^~~~~~~~~~~~~~~
      |                          ATOMIC_FLAG_INIT
udpclash.c:33:26: error: initializer element is not constant

Could you perhaps use volatile instead?

> +#include <stdatomic.h>
>  #include <stdio.h>
>  #include <string.h>
>  #include <stdlib.h>
> @@ -29,7 +30,7 @@ struct thread_args {
>  	int sockfd;
>  };
>  
> -static int wait = 1;
> +static atomic_int wait = ATOMIC_VAR_INIT(1);
>  
>  static void *thread_main(void *varg)
>  {


  reply	other threads:[~2025-09-03 22:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-02 18:58 [PATCH net 0/2] netfilter: updates for net Florian Westphal
2025-09-02 18:58 ` [PATCH net 1/2] selftests: netfilter: fix udpclash tool hang Florian Westphal
2025-09-03 22:15   ` Jakub Kicinski [this message]
2025-09-03 22:52     ` Florian Westphal
2025-09-03 23:09       ` Jakub Kicinski
2025-09-02 18:58 ` [PATCH net 2/2] netfilter: nf_tables: Introduce NFTA_DEVICE_PREFIX Florian Westphal

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=20250903151554.5c72661e@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fw@strlen.de \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pablo@netfilter.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.