Linux-HyperV List
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Kameron Carr <kameroncarr@linux.microsoft.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com,
	pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org,
	haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com,
	ernis@linux.microsoft.com,
	"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>
Subject: Re: [PATCH net-next v2 3/5] hv_netvsc: treat the VF's XDP program the way bonding treats a slave's
Date: Tue, 17 Nov 2026 19:12:47 -0800	[thread overview]
Message-ID: <20261117191247.28c6ce0c@kernel.org> (raw)
In-Reply-To: <dc137a5c-66ee-429e-944a-58a802ebfb97@linux.microsoft.com>

On Tue, 17 Nov 2026 16:39:48 -0800 Kameron Carr wrote:
> > -	if (netvsc_vf_join(vf_netdev, ndev, context) != 0)
> > +	if (netvsc_vf_join(vf_netdev, ndev, context) != 0) {
> > +		ret = prog ? netvsc_vf_setxdp(vf_netdev, NULL) : 0;
> > +		if (ret)
> > +			netdev_warn(ndev, "failed to remove XDP program from VF %s: %d\n",
> > +				    vf_netdev->name, ret);
> >  		return NOTIFY_DONE;
> > +	}  
> 
> If netvsc_vf_join() fails here, did we potentially just
> netdev_update_features() a VF we don't own? Can we restore the old
> features on failure? And / or reject VFs with a busy RX handler before
> making feature changes?

To me the first question is why this driver thinks its appropriate
to override wanted_features in the first place??  That's not how
normal feature propagation works for uppers.

Slightly more to your point - I don't see the driver restoring the
original features when VF detaches. So why should we bother worrying
about the failure case when normal detach doesn't clean up?

> >  	dev_hold(vf_netdev);
> >  	rcu_assign_pointer(net_device_ctx->vf_netdev, vf_netdev);
> > @@ -2363,9 +2391,6 @@ static int netvsc_register_vf(struct net_device *vf_netdev, int context)
> >  	vf_netdev->wanted_features = ndev->features;
> >  	netdev_update_features(vf_netdev);
> >  
> > -	prog = netvsc_xdp_get(netvsc_dev);
> > -	netvsc_vf_setxdp(vf_netdev, prog);  
> 
> I think Sashiko has a point that this patch might introduce edge case
> issues when netvsc_detach() fails.
> 
> I wonder if moving the netvsc_xdp_set() after netif_device_detach() in
> netvsc_detach() fixes some of the faiure paths (RNDIS close or ring
> drain fails)? I haven't yet fully thought through all the scenarios
> Sashiko brought up.
> 
> I understand improving XDP accounting is the end goal, but I hope we can
> get there without introducing new bugs.

"Improving" is not strong enough, the propagation bypassed all safety
checks. See the next series in the sequence:
https://lore.kernel.org/all/20261112235027.4072149-1-kuba@kernel.org/
Pretty sure I left netvsc in a much better state that before the series,
but there's plenty of bugs left to fix. I hope Microsoft will address
them.

      reply	other threads:[~2026-11-18  3:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20261109194843.1353592-1-kuba@kernel.org>
     [not found] ` <20261109194843.1353592-4-kuba@kernel.org>
2026-11-18  0:39   ` [PATCH net-next v2 3/5] hv_netvsc: treat the VF's XDP program the way bonding treats a slave's Kameron Carr
2026-11-18  3:12     ` Jakub Kicinski [this message]

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=20261117191247.28c6ce0c@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=decui@microsoft.com \
    --cc=edumazet@google.com \
    --cc=ernis@linux.microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=horms@kernel.org \
    --cc=kameroncarr@linux.microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=wei.liu@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox