From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.5 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFF23C10F13 for ; Tue, 16 Apr 2019 08:53:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8D8702086A for ; Tue, 16 Apr 2019 08:53:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=resnulli-us.20150623.gappssmtp.com header.i=@resnulli-us.20150623.gappssmtp.com header.b="xzbzb5zT" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728798AbfDPIxP (ORCPT ); Tue, 16 Apr 2019 04:53:15 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:37927 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727783AbfDPIxO (ORCPT ); Tue, 16 Apr 2019 04:53:14 -0400 Received: by mail-wm1-f66.google.com with SMTP id w15so24174407wmc.3 for ; Tue, 16 Apr 2019 01:53:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=RBnD29cM7N5w5q+LS9CQavhjplz/Npsb4oFYDsKfQts=; b=xzbzb5zTP7XVB9Ea7rq54aFwlC4q7HyQUBdGGcqUiXJ/KyTr45l0XD3k4eIJuYUSlf +xEpSv2lsnnNYs+idVpS9C9ruZwtIIp3FUEeHzyeq9dv3PbTA+2YKQiJZ2kY6tpeXs2m Ub1pmHYZC9UZ67CWUYSf3q+v4EZWQKab4LHUacjyRfbpwv9oiF6H1qayr2V7FIxC4ATc i62e3yLqk2777SKcdHqBuAc5G/QAFhhIdAT9lvazdFVez6c2NWhQm3vKfHAqK4cNmSGf DVkTUjxO2p4AGOH0H4Ox7GYL8bIMUyXzV4EaIrYwikzZ/RQnNaGecWQcRPg4E/EvmqIw AxwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=RBnD29cM7N5w5q+LS9CQavhjplz/Npsb4oFYDsKfQts=; b=fxE6XKVysBSLErE2Dl0plZgERe0hxCD7oj0uoBrQRfp3ZaGHKJhCI1je813o2zIlRZ ZiVgmpPHTHufnFrLc1fhnTaHwZ7JqKOxv/SU0qEjDqpAC19pAzQSlGGlc4OI/Dro/Rci bSXvrFRPxZoEBGnfB3Bh6fsVI5GXIKCGRJaTzwFm+QUX10/N+hysg5Gq2ADZUrhe8bQu I7ZZnsc6t1iAlroYBz5C9W70umezzQcLDLoKsG6YWs7EtAPmGdXy8vRLKepcaoYAbn7s ptF/7kpjtTYcJhWgnBkxZjNOEbU0O3CAHqR1XRmVcWTEdizeDEAQzAoju9XJv42EKKj+ pMVA== X-Gm-Message-State: APjAAAWLmqL5vjKxiNJHN3eO8pmuwJQkM9wGx3JXRdX0SBe9FY131lTP nDcutLR50dZEKC+cxnitmnK17w== X-Google-Smtp-Source: APXvYqyMI4GfudWQUhQqUKIbheOfCdRy7J+E1BIpctv0UWImi7I3sHjOJp+P/Gr3FIarMVzJtbbPxw== X-Received: by 2002:a1c:44d7:: with SMTP id r206mr26765164wma.129.1555404793375; Tue, 16 Apr 2019 01:53:13 -0700 (PDT) Received: from localhost (mail.chocen-mesto.cz. [85.163.43.2]) by smtp.gmail.com with ESMTPSA id f11sm72174214wrm.30.2019.04.16.01.53.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Apr 2019 01:53:12 -0700 (PDT) Date: Tue, 16 Apr 2019 10:53:12 +0200 From: Jiri Pirko To: Jakub Kicinski Cc: netdev@vger.kernel.org, davem@davemloft.net, mlxsw@mellanox.com Subject: Re: [patch net-next rfc 00/15] netdevsim: impement proper device model Message-ID: <20190416085312.GB2122@nanopsycho> References: <20190413162112.8203-1-jiri@resnulli.us> <20190415122709.45dd4b09@cakuba.netronome.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190415122709.45dd4b09@cakuba.netronome.com> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Mon, Apr 15, 2019 at 09:27:09PM CEST, jakub.kicinski@netronome.com wrote: >On Sat, 13 Apr 2019 18:20:57 +0200, Jiri Pirko wrote: >> From: Jiri Pirko >> >> Currently the model of netdevsim is a bit odd in multiple ways. >> 1) devlink instance is not in any way related with actual netdevsim >> netdevices. Instead, it is created per-namespace. >> 2) multi-port netdevsim device is done using "link" attribute. >> 3) netdevsim bus is there only to have something to bind the netdev to, >> it really does not act as a bus. > >Nope, it's there to expose SR-IOV ops :) They are not on the bus, they are on the device. > >> 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. The reason is the then the address, devlink handles and netdev names are predictable. If it would be auto-generated, how could you know what did you just created? > >I also dislike declaring ports from the start. In real drivers ports >are never "atomically" registered, they are crated and destroyed one >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... So what do you suggest? > >> Then devlink shows this: >> >> $ devlink dev >> netdevsim/netdevsim10 >> >> $ devlink port >> netdevsim/netdevsim10/0: type eth netdev netdevsim10p1 flavour physical >> netdevsim/netdevsim10/1: type eth netdev netdevsim10p2 flavour physical >> netdevsim/netdevsim10/2: type eth netdev netdevsim10p3 flavour physical >> netdevsim/netdevsim10/3: type eth netdev netdevsim10p4 flavour physical >> >> Debugfs topology is also adjusted a bit. The rest stays the same as >> before. >> >> TODO: >> - teach udev to rename netdevsim netdevices similarly to pci netdevices > >So we can test udev as well? https://github.com/systemd/systemd/pull/12328 > >> - fix tools/testing/selftests/bpf/test_offload.py to work with new iface > >That'd step 0 :) > >BTW are you testing all this with the various sysfs/kobject debug >checks? I don't remember all the deets now, but there were certainly >ordering considerations coming from there. Yes.