2023-11-15 16:14:14

by Stephen Hemminger

[permalink] [raw]
Subject: Re: [PATCH net-next v4] hv_netvsc: Mark VF as slave before exposing it to user-mode

On Fri, 10 Nov 2023 12:05:13 -0800
Jakub Kicinski <[email protected]> wrote:

> On Fri, 10 Nov 2023 00:43:55 +0000 Long Li wrote:
> > The code above needs to work with and without netvsc (the possible
> > master device) present.
>
> I don't think that's a reasonable requirement for the kernel code.
>
> The auto-bonding already puts the kernel into business of guessing
> policy, which frankly we shouldn't be in.
>
> Having the kernel guess even harder that there will be a master,
> but it's not there yet, is not reasonable.
>

I wrote the netvsc automatic VF code almost six years ago.
So let me give a little history. The original support of VF's was
done by using a bonding device and script. Haiyang worked hard
to get to work but it could not work on many distro's and had
lots of races and problems.

Jakub is right that in an ideal world, this could all be managed by
userspace. But the management of network devices in Linux is a
dumpster fire! Every distro invents there own solution, last time
I counted there were six different tools claiming to be the
"one network device manager to rule them all". And that doesn't
include all the custom scripts and vendor appliances.

The users requirements were:
- VF networking should work out of the box
- VF networking should require no userspace changes
- It must work with legacy enterprise distro's
- The first network device must show up as eth0 and it must work.

The Linux ecosystem of userspace but the kernel is a common base.
It was much easier for Microsoft to tell partners to
"use these upstream kernel components" and it will work.
Windows and BSD OS's have a tight binding between kernel and management
from userspace, therefore it is possible to handle things in userspace.

There are still problems (as Long indicated in the patch) because
the VF device does appear in the list of network devices. And
getting the transparent VF support to work in the face of all
the trash of userspace scripts is hard. Part of the problem is
that the state model of Linux network devices is fractured and
poorly documented.

The IFF_SLAVE flag is already used to indicate device is managed
by another driver. It keeps IPv6 from doing local address assignment
and existing userspace should be looking at it. The problem was
that userspace must not see a non-flagged VF device, or it will
get confused.

Microsoft should have exposed only one device in hardware.
Other vendors only expose the VF device and hairpin packets any
pre-processed packets. Part of the problem here is that
VF firmware needs to be updated (too often) and it is a requirement
that VM's do not lose connectivity.

Ideally, several things should happen:
- Linux should support hiding devices managed by another device
- the naming of device roles needs to not be master/slave.



2023-11-18 17:39:20

by Jakub Kicinski

[permalink] [raw]
Subject: Re: [PATCH net-next v4] hv_netvsc: Mark VF as slave before exposing it to user-mode

On Wed, 15 Nov 2023 08:14:06 -0800 Stephen Hemminger wrote:
> Jakub is right that in an ideal world, this could all be managed by
> userspace. But the management of network devices in Linux is a
> dumpster fire! Every distro invents there own solution, last time
> I counted there were six different tools claiming to be the
> "one network device manager to rule them all". And that doesn't
> include all the custom scripts and vendor appliances.

To be clear, I thought Long Li was saying that the goal is work around
cases where VF is probed before netvsc. That seems like something that
can be prevented by the hypervisor.

2023-11-21 00:24:10

by Long Li

[permalink] [raw]
Subject: RE: [PATCH net-next v4] hv_netvsc: Mark VF as slave before exposing it to user-mode

> On Wed, 15 Nov 2023 08:14:06 -0800 Stephen Hemminger wrote:
> > Jakub is right that in an ideal world, this could all be managed by
> > userspace. But the management of network devices in Linux is a
> > dumpster fire! Every distro invents there own solution, last time I
> > counted there were six different tools claiming to be the "one network
> > device manager to rule them all". And that doesn't include all the
> > custom scripts and vendor appliances.
>
> To be clear, I thought Long Li was saying that the goal is work around cases where
> VF is probed before netvsc. That seems like something that can be prevented by
> the hypervisor.

Hi Jakub,

I think you misunderstood my response, here is the response again.

(quote)

The current workflow in the kernel looks like this:
1. VF net device is created and expose to user-mode 2. VF is bonded to NETVSC (if NETVSC exists on the system)

With the current kernel behavior, the user-mode can possibly see the VF after 1, and before 2 when VF is bonded. When this happens, the user-mode doesn't know if the VF will be bonded in the future (it may never happen on systems without NETVSC). In this case, it doesn't know if it should configure the VF or not.

(end quote)

The problem is not that VF could be probed before netvsc. The problem is that it's possible that VF is probed, exposed to user-mode earlier than netvsc has a chance to bond it.

Thanks,

Long