kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Parav Pandit <parav@mellanox.com>
Cc: Jiri Pirko <jiri@mellanox.com>,
	"David S . Miller" <davem@davemloft.net>,
	Kirti Wankhede <kwankhede@nvidia.com>,
	Cornelia Huck <cohuck@redhat.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	cjia <cjia@nvidia.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH v2 0/2] Simplify mtty driver and mdev core
Date: Tue, 20 Aug 2019 22:20:51 -0600	[thread overview]
Message-ID: <20190820222051.7aeafb69@x1.home> (raw)
In-Reply-To: <AM0PR05MB486686D3C311F3C61BE0997DD1AA0@AM0PR05MB4866.eurprd05.prod.outlook.com>

On Wed, 21 Aug 2019 03:42:25 +0000
Parav Pandit <parav@mellanox.com> wrote:

> > -----Original Message-----
> > From: Alex Williamson <alex.williamson@redhat.com>
> > Sent: Tuesday, August 20, 2019 10:49 PM
> > To: Parav Pandit <parav@mellanox.com>
> > Cc: Jiri Pirko <jiri@mellanox.com>; David S . Miller <davem@davemloft.net>;
> > Kirti Wankhede <kwankhede@nvidia.com>; Cornelia Huck
> > <cohuck@redhat.com>; kvm@vger.kernel.org; linux-kernel@vger.kernel.org;
> > cjia <cjia@nvidia.com>; netdev@vger.kernel.org
> > Subject: Re: [PATCH v2 0/2] Simplify mtty driver and mdev core
> > 
> > On Tue, 20 Aug 2019 08:58:02 +0000
> > Parav Pandit <parav@mellanox.com> wrote:
> >   
> > > + Dave.
> > >
> > > Hi Jiri, Dave, Alex, Kirti, Cornelia,
> > >
> > > Please provide your feedback on it, how shall we proceed?
> > >
> > > Short summary of requirements.
> > > For a given mdev (mediated device [1]), there is one representor
> > > netdevice and devlink port in switchdev mode (similar to SR-IOV VF),
> > > And there is one netdevice for the actual mdev when mdev is probed.
> > >
> > > (a) representor netdev and devlink port should be able derive
> > > phys_port_name(). So that representor netdev name can be built
> > > deterministically across reboots.
> > >
> > > (b) for mdev's netdevice, mdev's device should have an attribute.
> > > This attribute can be used by udev rules/systemd or something else to
> > > rename netdev name deterministically.
> > >
> > > (c) IFNAMSIZ of 16 bytes is too small to fit whole UUID.
> > > A simple grep IFNAMSIZ in stack hints hundreds of users of IFNAMSIZ in
> > > drivers, uapi, netlink, boot config area and more. Changing IFNAMSIZ
> > > for a mdev bus doesn't really look reasonable option to me.  
> > 
> > How many characters do we really have to work with?  Your examples below
> > prepend various characters, ex. option-1 results in ens2f0_m10 or enm10.  Do
> > the extra 8 or 3 characters in these count against IFNAMSIZ?
> >   
> Maximum 15. Last is null termination.
> Some udev rules setting by user prefix the PF netdev interface. I took such example below where ens2f0 netdev named is prefixed.
> Some prefer not to prefix.
> 
> > > Hence, I would like to discuss below options.
> > >
> > > Option-1: mdev index
> > > Introduce an optional mdev index/handle as u32 during mdev create
> > > time. User passes mdev index/handle as input.
> > >
> > > phys_port_name=mIndex=m%u
> > > mdev_index will be available in sysfs as mdev attribute for udev to
> > > name the mdev's netdev.
> > >
> > > example mdev create command:
> > > UUID=$(uuidgen)
> > > echo $UUID index=10  
> > > > /sys/class/net/ens2f0/mdev_supported_types/mlx5_core_mdev/create  
> > 
> > Nit, IIRC previous discussions of additional parameters used comma separators,
> > ex. echo $UUID,index=10 >...
> >   
> Yes, ok.
> 
> > > > example netdevs:  
> > > repnetdev=ens2f0_m10	/*ens2f0 is parent PF's netdevice */  
> > 
> > Is the parent really relevant in the name?    
> No. I just picked one udev example who prefixed the parent netdev name.
> But there are users who do not prefix it.
> 
> > Tools like mdevctl are meant to
> > provide persistence, creating the same mdev devices on the same parent, but
> > that's simply the easiest policy decision.  We can also imagine that multiple
> > parent devices might support a specified mdev type and policies factoring in
> > proximity, load-balancing, power consumption, etc might be weighed such that
> > we really don't want to promote userspace creating dependencies on the
> > parent association.
> >   
> > > mdev_netdev=enm10
> > >
> > > Pros:
> > > 1. mdevctl and any other existing tools are unaffected.
> > > 2. netdev stack, ovs and other switching platforms are unaffected.
> > > 3. achieves unique phys_port_name for representor netdev 4. achieves
> > > unique mdev eth netdev name for the mdev using udev/systemd extension.
> > > 5. Aligns well with mdev and netdev subsystem and similar to existing
> > > sriov bdf's.  
> > 
> > A user provided index seems strange to me.  It's not really an index, just a user
> > specified instance number.  Presumably you have the user providing this
> > because if it really were an index, then the value depends on the creation order
> > and persistence is lost.  Now the user needs to both avoid uuid collision as well
> > as "index" number collision.  The uuid namespace is large enough to mostly
> > ignore this, but this is not.  This seems like a burden.
> >   
> I liked the term 'instance number', which is lot better way to say than index/handle.
> Yes, user needs to avoid both the collision.
> UUID collision should not occur in most cases, they way UUID are generated.
> So practically users needs to pick unique 'instance number', similar to how it picks unique netdev names.
> 
> Burden to user comes from the requirement to get uniqueness.
> 
> > > Option-2: shorter mdev name
> > > Extend mdev to have shorter mdev device name in addition to UUID.
> > > such as 'foo', 'bar'.
> > > Mdev will continue to have UUID.
> > > phys_port_name=mdev_name
> > >
> > > Pros:
> > > 1. All same as option-1, except mdevctl needs upgrade for newer usage.
> > > It is common practice to upgrade iproute2 package along with the
> > > kernel. Similar practice to be done with mdevctl.
> > > 2. Newer users of mdevctl who wants to work with non_UUID names, will
> > > use newer mdevctl/tools. Cons:
> > > 1. Dual naming scheme of mdev might affect some of the existing tools.
> > > It's unclear how/if it actually affects.
> > > mdevctl [2] is very recently developed and can be enhanced for dual
> > > naming scheme.  
> > 
> > I think we've already nak'ed this one, the device namespace becomes
> > meaningless if the name becomes just a string where a uuid might be an
> > example string.  mdevs are named by uuid.
> >   
> > > Option-3: mdev uuid alias
> > > Instead of shorter mdev name or mdev index, have alpha-numeric name
> > > alias. Alias is an optional mdev sysfs attribute such as 'foo', 'bar'.
> > > example mdev create command:
> > > UUID=$(uuidgen)
> > > echo $UUID alias=foo  
> > > > /sys/class/net/ens2f0/mdev_supported_types/mlx5_core_mdev/create
> > > > example netdevs:  
> > > examle netdevs:
> > > repnetdev = ens2f0_mfoo
> > > mdev_netdev=enmfoo
> > >
> > > Pros:
> > > 1. All same as option-1.
> > > 2. Doesn't affect existing mdev naming scheme.
> > > Cons:
> > > 1. Index scheme of option-1 is better which can number large number of
> > > mdevs with fewer characters, simplifying the management tool.  
> > 
> > No better than option-1, simply a larger secondary namespace, but still
> > requires the user to come up with two independent names for the device.
> >   
> > > Option-4: extend IFNAMESZ to be 64 bytes Extended IFNAMESZ from 16 to
> > > 64 bytes phys_port_name=mdev_UUID_string mdev_netdev_name=enmUUID
> > >
> > > Pros:
> > > 1. Doesn't require mdev extension
> > > Cons:
> > > 1. netdev stack, driver, uapi, user space, boot config wide changes 2.
> > > Possible user space extensions who assumed name size being 16
> > > characters 3. Single device type demands namesize change for all
> > > netdev types  
> > 
> > What about an alias based on the uuid?  For example, we use 160-bit sha1s
> > daily with git (uuids are only 128-bit), but we generally don't reference git
> > commits with the full 20 character string.  Generally 12 characters is
> > recommended to avoid ambiguity.  Could mdev automatically create an
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > abbreviated sha1 alias for the device?  If so, how many characters should we
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > use and what do we do on collision?  The colliding device could add enough
> > alias characters to disambiguate (we likely couldn't re-alias the existing device
> > to disambiguate, but I'm not sure it matters, userspace has sysfs to associate
> > aliases).  Ex.
> > 
> > UUID=$(uuidgen)
> > ALIAS=$(echo $UUID | sha1sum | colrm 13)
> >   
> I explained in previous reply to Cornelia, we should set UUID and ALIAS at the same time.
> Setting is via different sysfs attribute is lot code burden with no extra benefit.

Just an example of the alias, not proposing how it's set.  In fact,
proposing that the user does not set it, mdev-core provides one
automatically.
 
> > Since there seems to be some prefix overhead, as I ask about above in how
> > many characters we actually have to work with in IFNAMESZ, maybe we start
> > with 8 characters (matching your "index" namespace) and expand as necessary
> > for disambiguation.  If we can eliminate overhead in IFNAMESZ, let's start with
> > 12.  Thanks,
> >   
> If user is going to choose the alias, why does it have to be limited to sha1?
> Or you just told it as an example?
> 
> It can be an alpha-numeric string.

No, I'm proposing a different solution where mdev-core creates an alias
based on an abbreviated sha1.  The user does not provide the alias.
 
> Instead of mdev imposing number of characters on the alias, it should be best left to the user.
> Because in future if netdev improves on the naming scheme, mdev will be limiting it, which is not right.
> So not restricting alias size seems right to me.
> User configuring mdev for networking devices in a given kernel knows what user is doing.
> So user can choose alias name size as it finds suitable.

That's not what I'm proposing, please read again.  Thanks,

Alex

  reply	other threads:[~2019-08-21  4:20 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-02  6:59 [PATCH 0/2] Simplify mtty driver and mdev core Parav Pandit
2019-08-02  6:59 ` [PATCH 1/2] vfio-mdev/mtty: Simplify interrupt generation Parav Pandit
2019-08-06  8:15   ` Cornelia Huck
2019-08-02  6:59 ` [PATCH 2/2] vfio/mdev: Removed unused and redundant API for mdev name Parav Pandit
2019-08-06  8:29   ` Cornelia Huck
2019-08-06 13:12     ` Parav Pandit
2019-08-06 14:18 ` [PATCH v1 0/2] Simplify mtty driver and mdev core Parav Pandit
2019-08-06 14:18   ` [PATCH v1 1/2] vfio-mdev/mtty: Simplify interrupt generation Parav Pandit
2019-08-06 14:18   ` [PATCH v1 2/2] vfio/mdev: Removed unused and redundant API for mdev UUID Parav Pandit
2019-08-07  9:28     ` Cornelia Huck
2019-08-07 16:33       ` Parav Pandit
2019-08-08  8:29         ` Cornelia Huck
2019-08-08 14:01           ` Parav Pandit
2019-08-08 14:12 ` [PATCH v2 0/2] Simplify mtty driver and mdev core Parav Pandit
2019-08-08 14:12   ` [PATCH v2 1/2] vfio-mdev/mtty: Simplify interrupt generation Parav Pandit
2019-08-13 16:39     ` Christoph Hellwig
2019-08-23 20:48     ` Alex Williamson
2019-08-08 14:12   ` [PATCH v2 2/2] vfio/mdev: Removed unused and redundant API for mdev UUID Parav Pandit
2019-08-13 16:39     ` Christoph Hellwig
2019-08-16 15:22     ` Cornelia Huck
2019-08-08 23:02   ` [PATCH v2 0/2] Simplify mtty driver and mdev core Alex Williamson
2019-08-09  8:07     ` Cornelia Huck
2019-08-12 11:35     ` Kirti Wankhede
2019-08-13 14:40       ` Parav Pandit
2019-08-13 14:52         ` Alex Williamson
2019-08-13 16:28           ` Parav Pandit
2019-08-13 16:34             ` Cornelia Huck
2019-08-13 17:11             ` Alex Williamson
2019-08-14  5:54               ` Parav Pandit
2019-08-14  8:01                 ` Cornelia Huck
2019-08-14 12:27                   ` Parav Pandit
2019-08-14 13:09                     ` Cornelia Huck
2019-08-14 13:45                       ` Parav Pandit
2019-08-14 14:57                         ` Alex Williamson
2019-08-14 16:21                           ` Parav Pandit
2019-08-20  8:58                             ` Parav Pandit
2019-08-20  9:58                               ` Christophe de Dinechin
2019-08-20 11:25                                 ` Parav Pandit
2019-08-20 16:31                                   ` Cornelia Huck
2019-08-21  2:42                                     ` Parav Pandit
2019-08-20 17:19                               ` Alex Williamson
2019-08-20 17:55                                 ` Cornelia Huck
2019-08-21  3:57                                   ` Parav Pandit
2019-08-21  3:42                                 ` Parav Pandit
2019-08-21  4:20                                   ` Alex Williamson [this message]
2019-08-21  4:40                                     ` Parav Pandit
2019-08-21  4:57                                       ` Alex Williamson
2019-08-21  5:01                                         ` Parav Pandit
2019-08-21  5:26                                           ` Alex Williamson
2019-08-21  6:23                                             ` Parav Pandit
2019-08-22  9:29                                               ` Jiri Pirko
2019-08-22  9:42                                                 ` Parav Pandit
2019-08-22  9:58                                                   ` Jiri Pirko
2019-08-22 10:04                                                     ` Parav Pandit
2019-08-22 12:19                                                       ` Jiri Pirko
2019-08-22 13:33                                                         ` Parav Pandit
2019-08-23  8:12                                                           ` Jiri Pirko
2019-08-23  8:14                                                             ` Parav Pandit
2019-08-23 14:28                                                               ` Alex Williamson
2019-08-23 14:53                                                                 ` Parav Pandit
2019-08-23 15:04                                                                   ` Jiri Pirko
2019-08-23 15:52                                                                   ` Alex Williamson
2019-08-23 16:14                                                                     ` Parav Pandit
2019-08-23 17:16                                                                       ` Alex Williamson
2019-08-23 18:00                                                                         ` Parav Pandit
2019-08-23 19:43                                                                           ` Alex Williamson
2019-08-24  3:56                                                                             ` Parav Pandit
2019-08-24  4:45                                                                               ` Parav Pandit
2019-08-24  4:59                                                                               ` Alex Williamson
2019-08-24  5:22                                                                                 ` Parav Pandit
2019-08-13 16:37         ` Christoph Hellwig
2019-08-13 17:40           ` Greg Kroah-Hartman
2019-08-14  5:30             ` Parav Pandit
2019-08-13 14:48     ` Parav Pandit

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=20190820222051.7aeafb69@x1.home \
    --to=alex.williamson@redhat.com \
    --cc=cjia@nvidia.com \
    --cc=cohuck@redhat.com \
    --cc=davem@davemloft.net \
    --cc=jiri@mellanox.com \
    --cc=kvm@vger.kernel.org \
    --cc=kwankhede@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=parav@mellanox.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;
as well as URLs for NNTP newsgroup(s).