Re: [PATCH net-next v3 2/4] selftests/xsk: skip TX setup after RX configuration failure

[email protected]
Newsgroups org.kernel.vger.netdev,org.kernel.vger.bpf
Message-ID <fba2d36c24eebcbdc32ba8f1f117993b6a9a484e6bedefb34e02dfe2deb7464f@mail.kernel.org>
> diff --git a/tools/testing/selftests/bpf/prog_tests/test_xsk.c b/tools/testing/selftests/bpf/prog_tests/test_xsk.c
> index bba5e8d4222d..814b8325493f 100644
> --- a/tools/testing/selftests/bpf/prog_tests/test_xsk.c
> +++ b/tools/testing/selftests/bpf/prog_tests/test_xsk.c
> @@ -1699,12 +1699,15 @@ void *worker_testapp_validate_rx(void *arg)
>  				       strerror(-err));
>  	}
>
> +	/* Publish setup failure before releasing the main thread from the barrier. */
> +	if (err)
> +		test->fail = true;
> +
>  	if (test->use_barrier)
>  		pthread_barrier_wait(&barr);
>
>  	/* We leave only now in case of error to avoid getting stuck in the barrier */
>  	if (err) {
> -		test->fail = true;
>  		pthread_exit(NULL);
>  	}

This isn't a bug, but the braces in this if statement are now unnecessary.
You've moved test->fail = true; out, leaving a single-statement block:

	if (err) {
		pthread_exit(NULL);
	}

Could this be collapsed to the brace-less form?

	if (err)
		pthread_exit(NULL);

The lines you added just above already use this style (if (err) \n \t \t
test->fail = true;), so the two forms are inconsistent within the same
window.

[ ... ]

This looks like a bug fix for an initialization ordering issue. Should this
include:

  Fixes: 90d52cd76f2f ("selftests/xsk: add UMEM users refcount and centralize socket teardown")


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/32400920730
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.