mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: almasrymina@google.com
Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
	dri-devel@lists.freedesktop.org, pabeni@redhat.com,
	sdf@fomichev.me, kaiyuanz@google.com, kuba@kernel.org,
	bobbyeshleman@meta.com, asml.silence@gmail.com, dw@davidwei.uk,
	ap420073@gmail.com, davem@davemloft.net, edumazet@kernel.org,
	horms@kernel.org, shuah@kernel.org, sumit.semwal@linaro.org,
	christian.koenig@amd.com, phasta@kernel.org,
	andrew+netdev@lunn.ch, sdf.kernel@gmail.com, hawk@kernel.org,
	ilias.apalodimas@linaro.org, daniel@iogearbox.net,
	razor@blackwall.org, tariqt@nvidia.com, kaifengw@google.com,
	dtatulea@nvidia.com
Subject: Re: [PATCH net v5 3/4] netdevsim: support devmem RX and TX bindings
Date: Sun, 01 Nov 2026 23:01:25 +0000	[thread overview]
Message-ID: <179357408589.3131.13149073708335764140@kernel.org> (raw)
In-Reply-To: <20261030083539.777877-4-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] Not a bug (baseline: false positive).

--

netdevsim: support devmem RX and TX bindings

This patch sets a 64-bit DMA mask on the netdevsim bus device and turns on
NETMEM_TX_DMA on the netdevsim net_device. It also sets up the page pools
so they can be backed by unreadable netmem, which lets the devmem bind-rx
and bind-tx netlink operations be tested against netdevsim. pp_hold is
refused on memory-provider backed pools, and unreadable or net_iov skbs
are dropped in nsim_start_xmit().

> diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
> index eebc02ccc4a92..0372a9bd63bbb 100644
> --- a/drivers/net/netdevsim/netdev.c
> +++ b/drivers/net/netdevsim/netdev.c
> @@ -133,6 +133,10 @@ static netdev_tx_t nsim_start_xmit(struct sk_buff *skb, struct net_device *dev)
>  	int dr;
>  
>  	rcu_read_lock();
> +	if (!skb_frags_readable(skb) ||
> +	    (skb_shinfo(skb)->nr_frags &&
> +	     skb_frag_is_net_iov(&skb_shinfo(skb)->frags[0])))
> +		goto out_drop_any;
>  	if (!nsim_ipsec_tx(ns, skb))
>  		goto out_drop_any;
>  

[ ... ]

> @@ -1059,6 +1078,8 @@ static int nsim_init_netdevsim(struct netdevsim *ns)
>  	ns->netdev->netdev_ops = &nsim_netdev_ops;
>  	ns->netdev->stat_ops = &nsim_stat_ops;
>  	ns->netdev->queue_mgmt_ops = &nsim_queue_mgmt_ops;
> +	if (ns->nsim_bus_dev->dev.dma_mask)
> +		ns->netdev->netmem_tx = NETMEM_TX_DMA;

[Severity: Low]
This isn't a bug, but the docs and the driver don't quite match here.
Documentation/networking/netmem.rst describes the mode as:

    NETMEM_TX_DMA: for physical devices that perform DMA.

nsim_init_netdevsim() sets NETMEM_TX_DMA, but nsim_start_xmit() above
drops every unreadable or net_iov skb.

As I understand it, NETMEM_TX_NO_DMA would not work for this test. That
is because netdev_find_netmem_tx_dev() only resolves a NO_DMA device by
following leased RX queues to a physical NETMEM_TX_DMA device:

net/core/netdev-genl.c:netdev_find_netmem_tx_dev() {
    ...
	if (dev->netmem_tx == NETMEM_TX_DMA)
		return dev;

	if (dev->netmem_tx != NETMEM_TX_NO_DMA)
		return NULL;
    ...
}

Traffic also behaves the same as before. Under NETMEM_TX_NONE,
validate_xmit_unreadable_skb() already freed these skbs. Now the driver
drops them and counts them through dev_dstats_tx_dropped().

Would it help to add a short comment next to this assignment? It could
say that netdevsim advertises NETMEM_TX_DMA only so the bind-tx control
path works, and that devmem TX data is dropped in nsim_start_xmit().

>  	netdev_lockdep_set_classes(ns->netdev);
>  
>  	err = nsim_udp_tunnels_info_create(ns->nsim_dev, ns->netdev);

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

  reply	other threads:[~2026-11-01 23:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-30  8:35 [PATCH net v5 0/4] net: devmem: fix RX and TX binding teardown on device unregistration Mina Almasry
2026-10-30  8:35 ` [PATCH net v5 1/4] net: devmem: unmap dma_buf synchronously on queue uninstall Mina Almasry
2026-11-01 23:01   ` netdev-bot+sashiko
2026-11-01 23:16     ` Mina Almasry
2026-10-30  8:35 ` [PATCH net v5 2/4] net: devmem: detach TX bindings on NETDEV_UNREGISTER Mina Almasry
2026-11-01 23:01   ` netdev-bot+sashiko
2026-11-01 23:15     ` Mina Almasry
2026-10-30  8:35 ` [PATCH net v5 3/4] netdevsim: support devmem RX and TX bindings Mina Almasry
2026-11-01 23:01   ` netdev-bot+sashiko [this message]
2026-10-30  8:35 ` [PATCH net v5 4/4] selftests: net: add devmem RX and TX netdev unregister tests Mina Almasry
2026-11-01 23:01   ` netdev-bot+sashiko

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=179357408589.3131.13149073708335764140@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=almasrymina@google.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=ap420073@gmail.com \
    --cc=asml.silence@gmail.com \
    --cc=bobbyeshleman@meta.com \
    --cc=christian.koenig@amd.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=dtatulea@nvidia.com \
    --cc=dw@davidwei.uk \
    --cc=edumazet@kernel.org \
    --cc=hawk@kernel.org \
    --cc=horms@kernel.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=kaifengw@google.com \
    --cc=kaiyuanz@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=phasta@kernel.org \
    --cc=razor@blackwall.org \
    --cc=sdf.kernel@gmail.com \
    --cc=sdf@fomichev.me \
    --cc=shuah@kernel.org \
    --cc=sumit.semwal@linaro.org \
    --cc=tariqt@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

all inboxes | Powered by JetHome®