Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: almasrymina@google.com
Cc: netdev@vger.kernel.org, edumazet@kernel.org,
	ncardwell@google.com, kuniyu@google.com, davem@davemloft.net,
	kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
	sdf@fomichev.me, kaiyuanz@google.com, willemb@google.com,
	daniel@iogearbox.net, josef@toxicpanda.com, sdf.kernel@gmail.com,
	dtatulea@nvidia.com, asml.silence@gmail.com,
	bobbyeshleman@meta.com
Subject: Re: [PATCH net-next v6 5/7] net: kunit: attach net_iov frags to target skbs in unreadable tests
Date: Tue, 24 Nov 2026 08:14:28 +0000	[thread overview]
Message-ID: <179550806827.3135.15602698633826190265@kernel.org> (raw)
In-Reply-To: <20261120201408.3445445-6-almasrymina@google.com>

Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] In net/core/net_test.c, netmem_ref_test_try_coalesce() subtest 3,
  the patch adds `KUNIT_EXPECT_TRUE(test, to->unreadable)` after…

--

net: kunit: attach net_iov frags to target skbs in unreadable tests

This commit changes two netmem KUnit tests so that the target skb gets an
initial net_iov fragment from the same binding before the operation runs.
In netmem_ref_test_net_iov(), that operation is skb_shift(). In
netmem_ref_test_try_coalesce(), it is skb_try_coalesce(). The goal is to
keep both tests valid once memory provider compatibility is enforced in
those functions.

> diff --git a/net/core/net_test.c b/net/core/net_test.c
> index 19f422300d9c8..1cfa947c11f2c 100644
> --- a/net/core/net_test.c
> +++ b/net/core/net_test.c

[ ... ]

> @@ -1730,18 +1733,19 @@ static void netmem_ref_test_try_coalesce(struct kunit *test)
>  	from = alloc_skb(0, GFP_KERNEL);
>  	KUNIT_ASSERT_NOT_NULL(test, to);
>  	KUNIT_ASSERT_NOT_NULL(test, from);
> -	skb_put(to, skb_tailroom(to));
>  	to->pp_recycle = 1;
> -	to->unreadable = 1;
>  	from->pp_recycle = 1;
> -	skb_add_rx_frag_netmem(from, 0, niov_nm, 0, 64, PAGE_SIZE);
> +	skb_add_rx_frag_netmem(to, 0, niov_nm, 0, 32, PAGE_SIZE);
> +	napi_pp_get_page(niov_nm);
> +	skb_add_rx_frag_netmem(from, 0, niov_nm, 32, 64, PAGE_SIZE);
>  	napi_pp_get_page(niov_nm);
>  
>  	clone = skb_clone(from, GFP_KERNEL);
>  	KUNIT_ASSERT_NOT_NULL(test, clone);
>  	KUNIT_EXPECT_TRUE(test, skb_try_coalesce(to, from, &fragstolen,
>  						 &delta));
> -	KUNIT_EXPECT_EQ(test, atomic_long_read(&niov.desc.pp_ref_count), 4L);
> +	KUNIT_EXPECT_TRUE(test, to->unreadable);

[Severity: Low]
Can this new assertion ever fail?

The new skb_add_rx_frag_netmem(to, ...) call above already sets
to->unreadable before skb_try_coalesce() runs. The call chain is
skb_add_rx_frag_netmem()->skb_fill_netmem_desc()->__skb_fill_netmem_desc():

include/linux/skbuff.h:__skb_fill_netmem_desc() {
    ...
	if (netmem_is_net_iov(netmem)) {
		skb->unreadable = true;
		return;
	}
    ...
}

skb_try_coalesce() never writes to->unreadable. At this commit it only
compares skb_frags_readable(from) with skb_frags_readable(to). Later in the
series that comparison is replaced by skb_mem_provider_compat(to, from).
The rest of the function copies frags, takes frag references and updates
len/data_len/truesize. The one frag fill inside it is skb_fill_page_desc()
for a page-backed head, and that does not touch unreadable.

So the check reads back a flag the test itself set. It would still pass if
skb_try_coalesce() mishandled the unreadable state of the merged frags.

The assertion is also unchanged at the end of the series. The later commit
"net: kunit: test incompatible memory provider rejection" adds rejection
subtests for different bindings and providers, but leaves this check as it
is.

Should the assertion be dropped, or changed to check something that
skb_try_coalesce() actually changes, such as nr_frags on the target skb?

> +	KUNIT_EXPECT_EQ(test, atomic_long_read(&niov.desc.pp_ref_count), 5L);
>  	KUNIT_EXPECT_EQ(test, atomic_long_read(&binding.ref.data->count),
>  			base_iov_ref);
>  	consume_skb(from);

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261120201408.3445445-1-almasrymina%40google.com

  parent reply	other threads:[~2026-11-24  8:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 20:14 [PATCH net-next v6 0/7] net: prevent mixing incompatible memory providers in skbs Mina Almasry
2026-11-20 20:14 ` [PATCH net-next v6 1/7] net: fix skb->unreadable propagation in skb_split() and skb_shift() Mina Almasry
2026-11-20 20:14 ` [PATCH net-next v6 2/7] net: devmem: prevent mixing TX bindings and reject non-devmem xmit Mina Almasry
2026-11-23 17:29   ` Stanislav Fomichev
2026-11-20 20:14 ` [PATCH net-next v6 3/7] tcp: fix unreadable net_iov handling in tcp_clone_payload() Mina Almasry
2026-11-23 17:29   ` Stanislav Fomichev
2026-11-24  8:14   ` netdev-bot+sashiko
2026-11-20 20:14 ` [PATCH net-next v6 4/7] tcp: propagate skb_zcopy() uarg in tcp_mtu_probe() Mina Almasry
2026-11-24  8:14   ` netdev-bot+sashiko
2026-11-20 20:14 ` [PATCH net-next v6 5/7] net: kunit: attach net_iov frags to target skbs in unreadable tests Mina Almasry
2026-11-23 17:29   ` Stanislav Fomichev
2026-11-24  8:14   ` netdev-bot+sashiko [this message]
2026-11-20 20:14 ` [PATCH net-next v6 6/7] net: prevent mixing frags from different memory providers or bindings Mina Almasry
2026-11-23 17:30   ` Stanislav Fomichev
2026-11-24  8:14   ` netdev-bot+sashiko
2026-11-20 20:14 ` [PATCH net-next v6 7/7] net: kunit: test incompatible memory provider rejection Mina Almasry
2026-11-23 17:31   ` Stanislav Fomichev

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=179550806827.3135.15602698633826190265@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=almasrymina@google.com \
    --cc=asml.silence@gmail.com \
    --cc=bobbyeshleman@meta.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dtatulea@nvidia.com \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=josef@toxicpanda.com \
    --cc=kaiyuanz@google.com \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf.kernel@gmail.com \
    --cc=sdf@fomichev.me \
    --cc=willemb@google.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