netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: Jakub Kicinski <jakub.kicinski@netronome.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, mlxsw@mellanox.com
Subject: Re: [patch net-next rfc 00/15] netdevsim: impement proper device model
Date: Fri, 19 Apr 2019 07:25:01 +0200	[thread overview]
Message-ID: <20190419052501.GA2247@nanopsycho> (raw)
In-Reply-To: <20190418100748.04efa546@cakuba.netronome.com>

Thu, Apr 18, 2019 at 07:07:48PM CEST, jakub.kicinski@netronome.com wrote:
>On Thu, 18 Apr 2019 09:22:56 +0200, Jiri Pirko wrote:
>> Tue, Apr 16, 2019 at 08:04:59PM CEST, jakub.kicinski@netronome.com wrote:
>> >On Tue, 16 Apr 2019 10:59:37 +0200, Jiri Pirko wrote:  
>> >> >> 4) netdevsim instances are created by "ip link add" which is great for
>> >> >>    soft devices with no hw backend. The rtnl core allocates netdev and
>> >> >>    calls into driver holding rtnl mutex. For hw-backed devices, this
>> >> >>    flow is wrong as it breaks order in which things are done.
>> >> >> 
>> >> >> This patchset adjust netdevsim to fix all above.
>> >> >> 
>> >> >> In order to support proper devlink and devlink port instances and to be
>> >> >> able to emulate real devices, there is need to implement bus probe and
>> >> >> instantiate everything from there. User can specify device id and port
>> >> >> count to be instantianted. For example:
>> >> >> 
>> >> >> echo "10 4" > /sys/bus/netdevsim/new_device    
>> >> >
>> >> >I really don't like the design where ID has to be allocated by user
>> >> >space.  It's a step back.
>> >> >
>> >> >I also dislike declaring ports from the start.  In real drivers ports
>> >> >are never "atomically" registered, they are crated and destroyed one     
>> >> 
>> >> Care to define "atomically" here? It is done in a very similar way
>> >> to how it is done in mlxsw for example. Same flows.
>> >> 
>> >>   
>> >> >by one, and a lot of races/UAFs/bugs lie in those small periods of
>> >> >time where one netdev got unregistered, but other are still around...    
>> >> 
>> >> Same here. Not sure where do you see the differences.  
>> >
>> >The difference is that today I can do this:
>> >
>> >create a netdevsim1 with shared dev 1
>> >create some state associated with shared dev 1
>> >create a netdevsim2 with shared dev 1
>> >check if all the shared dev 1 state created for netdevsim1 is visible
>> >	via netdevsim2  
>> 
>> Hmm, you are testing netdevsim implementation then, not the kernel
>> interfaces. What is the point of testing netdevsim?
>
>BPF offload tries to leave as much code as possible in the core, and
>make the drivers simple.  I'm testing whether the core reacts correctly,
>netdevsim just calls register/unregister.
>
>> >destroy netdevsim1
>> >check the shared dev 1 state again
>> >
>> >If I say "give me 2 ports" from the start, that makes the testing
>> >(which is the whole point of this code) harder.
>> >  
>> >> Also, I plan to implement port splitting in follow-up patchset. All
>> >> flows are there as well.  
>> >
>> >Sure, let's just be clear that we won't be merging an ABI that has just
>> >a netdevsim implementation, right?  I have some reservations about the  
>> 
>> So what do you suggest? Allow to somehow add and remove ports during
>> test? You can already do that with VFs. Do you want to do that with
>> netdevsim "physical" ports? If yes, how? I can imagine to extend devlink
>> port api with something like:
>> 
>> $ sudo devlink dev
>> netdevsim/netdevsim0
>> $ sudo devlink port
>> netdevsim/netdevsim0/0: type eth netdev eth0 flavour physical
>> 
>> $ sudo devlink dev port add netdevsim/netdevsim0 index 22
>> $ sudo devlink port
>> netdevsim/netdevsim0/0: type eth netdev eni0p1 flavour physical
>> netdevsim/netdevsim0/22: type eth netdev eni0p23 flavour physical
>> 
>> $ sudo devlink port del netdevsim/netdevsim0/0
>> $ sudo devlink port
>> netdevsim/netdevsim0/22: type eth netdev eni0p23 flavour physical
>> 
>> But I see only usecase for this extension for netdevsim, not for real
>> devices..
>
>Hm.. I'm getting lost, sorry, I'm probably confusing myself here..
>
>Netdevsim is supposed to test real, existing kernel interfaces and core
>code.  What we do today with linking based on netdevs is quite simple
>and works very well for the BPF offload tests.
>
>If you want to test some devlink code, that's also real, perfect.
>
>For BPF tests we want the ability to add and remove netdevs to a sdev
>during tests, yes.  That ability cannot be lost.

Yeah, but since the api is changing, the original approach of using
IFLA_LINK cannot be used anymore. Not to mention is is abuse of the API
from the very beginning. You want to add/del ports during lifetime, I'm
trying to find interface. Basically whe have two options:
1) devlink extension I suggested above
2) sysfs files to add/del ports. Similar to "new_device" and
   "del_device".

I like the idea of having 2) better, the reason is this is very speficic
to netdevsim and not really applicable on real devices.


>
>
>> >"port splitting" or device slicing, which should be discussed over real
>> >code, not netdevsim.  

  reply	other threads:[~2019-04-19 19:33 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-13 16:20 [patch net-next rfc 00/15] netdevsim: impement proper device model Jiri Pirko
2019-04-13 16:20 ` [patch net-next rfc 01/15] netdevsim: move device registration on bus to be done earlier in init Jiri Pirko
2019-04-13 16:20 ` [patch net-next rfc 02/15] netdevsim: create devlink instance per netdevsim instance Jiri Pirko
2019-04-15  2:24   ` David Ahern
2019-04-15  5:41     ` Jiri Pirko
2019-04-15 15:07       ` David Ahern
2019-04-15 15:39         ` Jiri Pirko
2019-04-13 16:21 ` [patch net-next rfc 03/15] netdevsim: rename devlink.c to dev.c to contain per-dev(asic) items Jiri Pirko
2019-04-13 16:21 ` [patch net-next rfc 04/15] netdevsim: put netdevsim bus code into separate file Jiri Pirko
2019-04-14 20:27   ` David Miller
2019-04-15  5:40     ` Jiri Pirko
2019-04-13 16:21 ` [patch net-next rfc 05/15] netdevsim: move device registration and related code to bus.c Jiri Pirko
2019-04-13 16:21 ` [patch net-next rfc 06/15] netdevsim: add stub netdevsim driver implementation Jiri Pirko
2019-04-13 16:21 ` [patch net-next rfc 07/15] netdevsim: use ida for bus device ids Jiri Pirko
2019-04-13 16:21 ` [patch net-next rfc 08/15] netdevsim: add bus attributes to add new and delete devices Jiri Pirko
2019-04-13 16:21 ` [patch net-next rfc 09/15] netdevsim: rename dev_init/exit() functions and make them independent on ns Jiri Pirko
2019-04-13 16:21 ` [patch net-next rfc 10/15] netdevsim: merge sdev into dev Jiri Pirko
2019-04-15 20:49   ` Jakub Kicinski
2019-04-16  8:49     ` Jiri Pirko
2019-04-13 16:21 ` [patch net-next rfc 11/15] netdevsim: generate random switch id instead of using dev id Jiri Pirko
2019-04-13 16:21 ` [patch net-next rfc 12/15] netdevsim: change debugfs tree topology Jiri Pirko
2019-04-13 16:21 ` [patch net-next rfc 13/15] netdevsim: implement dev probe/remove skeleton with port initialization Jiri Pirko
2019-04-13 16:21 ` [patch net-next rfc 14/15] netdevsim: move netdev creation/destruction to dev probe Jiri Pirko
2019-04-13 16:21 ` [patch net-next rfc 15/15] netdevsim: implement ndo_get_devlink_port Jiri Pirko
2019-04-15 19:27 ` [patch net-next rfc 00/15] netdevsim: impement proper device model Jakub Kicinski
2019-04-16  8:53   ` Jiri Pirko
2019-04-16 17:58     ` Jakub Kicinski
2019-04-16  8:59   ` Jiri Pirko
2019-04-16 18:04     ` Jakub Kicinski
2019-04-18  7:22       ` Jiri Pirko
2019-04-18 17:07         ` Jakub Kicinski
2019-04-19  5:25           ` Jiri Pirko [this message]
2019-04-19 21:00             ` Jakub Kicinski

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=20190419052501.GA2247@nanopsycho \
    --to=jiri@resnulli.us \
    --cc=davem@davemloft.net \
    --cc=jakub.kicinski@netronome.com \
    --cc=mlxsw@mellanox.com \
    --cc=netdev@vger.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;
as well as URLs for NNTP newsgroup(s).