All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Tushar Vyavahare" <tushar.vyavahare@intel.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net-next v3 1/4] selftests/xsk: add UMEM users refcount and centralize socket teardown
Date: Thu, 20 Aug 2026 02:47:44 +0000	[thread overview]
Message-ID: <20260820024745.07FC81F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260819024443.781764-2-tushar.vyavahare@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Shared UMEM TX sockets fail to create due to partial UMEM view lacking the libbpf UMEM handle.
--

--- Patch [1]: [PATCH net-next v3 1/4] selftests/xsk: add UMEM users refcount and centralize socket teardown ---
commit ec175a3b2fa035fe1d6886d51e8d51aa7aaf1d62
Author: Tushar Vyavahare <tushar.vyavahare@intel.com>

selftests/xsk: add UMEM users refcount and centralize socket teardown

This commit adds a reference count to xsk_umem_info to track shared UMEM
ownership and centralizes the teardown path to ensure sockets clean up
properly across all error paths.

> diff --git a/tools/testing/selftests/bpf/prog_tests/test_xsk.c b/tools/testing/selftests/bpf/prog_tests/test_xsk.c
> index 38ce6060b8fac..fbec8afaadc99 100644
> --- a/tools/testing/selftests/bpf/prog_tests/test_xsk.c
> +++ b/tools/testing/selftests/bpf/prog_tests/test_xsk.c
[ ... ]
> @@ -1508,8 +1529,15 @@ static int thread_common_ops_tx(struct test_spec *test, struct ifobject *ifobjec
>  	}
>  
>  	umem_rx = test->ifobj_rx->xsk_arr[0].umem;
> +	/* Non-owning view used only for TX buffer arithmetic; the sockets below bind to
> +	 * the RX-owned UMEM, so the handle, cq and refcount stay in one place.
> +	 */
>  	umem_tx = ifobject->xsk_arr[0].umem_real;
> -	memcpy(umem_tx, umem_rx, sizeof(*umem_tx));
> +	umem_tx->num_frames = umem_rx->num_frames;
> +	umem_tx->frame_headroom = umem_rx->frame_headroom;
> +	umem_tx->buffer = umem_rx->buffer;
> +	umem_tx->frame_size = umem_rx->frame_size;
> +	umem_tx->unaligned_mode = umem_rx->unaligned_mode;
>  	umem_tx->base_addr = 0;
>  	umem_tx->next_buffer = 0;

[Severity: Medium]
Will this cause shared UMEM TX sockets to fail creation because the libbpf
UMEM handle is not copied over?

Since umem_tx is now constructed manually instead of using memcpy(), the
umem_tx->umem field is left NULL. When xsk_configure_socket() is called later
in thread_common_ops_tx(), it passes this NULL umem->umem pointer to
xsk_socket__create(), which causes it to fail.

Also, does leaving the users refcount zero-initialized on this umem_tx view
conflict with the stated goal of keeping shared sockets pointing to the same
reference count?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260819024443.781764-1-tushar.vyavahare@intel.com?part=1

  reply	other threads:[~2026-08-20  2:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-19  2:44 [PATCH net-next v3 0/4] selftests/xsk: improve shared-UMEM coverage Tushar Vyavahare
2026-08-19  2:44 ` [PATCH net-next v3 1/4] selftests/xsk: add UMEM users refcount and centralize socket teardown Tushar Vyavahare
2026-08-20  2:47   ` sashiko-bot [this message]
2026-08-19  2:44 ` [PATCH net-next v3 2/4] selftests/xsk: skip TX setup after RX configuration failure Tushar Vyavahare
2026-08-19  2:44 ` [PATCH net-next v3 3/4] selftests/xsk: expand XSKMAP capacity and add length-based XDP program Tushar Vyavahare
2026-08-19  2:44 ` [PATCH net-next v3 4/4] selftests/xsk: add shared-UMEM callback framework and initial test cases Tushar Vyavahare
2026-08-20  9:35 ` [PATCH net-next v3 0/4] selftests/xsk: improve shared-UMEM coverage Paolo Abeni

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=20260820024745.07FC81F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tushar.vyavahare@intel.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 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.