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=-2.5 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, URIBL_BLOCKED,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 146E9C10F13 for ; Tue, 16 Apr 2019 08:59:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BC1EC2073F for ; Tue, 16 Apr 2019 08:59:40 +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="ZqbnNqDX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728727AbfDPI7j (ORCPT ); Tue, 16 Apr 2019 04:59:39 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:42338 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726576AbfDPI7j (ORCPT ); Tue, 16 Apr 2019 04:59:39 -0400 Received: by mail-wr1-f67.google.com with SMTP id g3so25837331wrx.9 for ; Tue, 16 Apr 2019 01:59:38 -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=I8Ga5XXvbeMKpzlDvLvtdU35m0AXWJcA9JpIPhtXZQQ=; b=ZqbnNqDXhdrsj+iZxsv4/xtVI46AlHrifGUqBP2cRknRcGp2GW7jCwoLJO3It/IYuo FfUldaB+t2nR+cenW7XHZ12cAhNhu56O9asHeV5FzjckckkR2PMfZCZXsS1gyWInf3SW UmuYPUQGhNXVznUfl8kAbpHDSH6G7o+G4bxNumfrVQyq6kzJJ/OxJxT46W7I+LYol/gC CMhG2p+SkJ2nLNUtjseWNIFPtxPvPhV6JV835RsEBeQsMcPnl8TSlri2mseRJ7ofAQDi WJEqPdz0VKotOmgGnCUZCEivjWfmQxaV5hfrGYqKjtyeDM3uYHYIJXnofs/vCLIls0dq sk5w== 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=I8Ga5XXvbeMKpzlDvLvtdU35m0AXWJcA9JpIPhtXZQQ=; b=f/W5esYxzYAYGgL2rDOFEIGA03d154qTCgMC4B6V0Pn3uzFVamkLBh4mzYjIeQg+p/ V1jReyWiRRJyEiL/aX2jI7HbBw6TyfVdg9FRfjHOymLh6S7CS0ogd2KkmKzfKRXh2+a6 sClUtW6KK7tfuBzSPlP5CuF0SuEiMghF/wJMjkuZoaBEWjAudqv6JFkevEtQNkezuSN9 s4W2MHzRlSz4PsC2nBgeuuGu2s6KBLp3Lp7fgPyTpPwWBbzkBjjM5pD8GykmGIPCDECf HivDDAnJ3wNTVW+MbieT2X8dnHxt6mAsv0SlYkwg5zZlhUvcTAcdUpPDdcf4PNnCD5AC wKyg== X-Gm-Message-State: APjAAAV0yJQjiluq4mbDWMc2mwAGuPGV/tmPedcB4uvrbcIDPKgBaueM woKjs6/0yYo/WyF6qBjw/gWcYw== X-Google-Smtp-Source: APXvYqy80spobcBezcZBM6XE3HYUtaFVVB9PWc+OrPu0Yse0SvG6pkPke6OUavMyykwgzq402w0QNg== X-Received: by 2002:adf:b3d4:: with SMTP id x20mr2012301wrd.284.1555405177961; Tue, 16 Apr 2019 01:59:37 -0700 (PDT) Received: from localhost (mail.chocen-mesto.cz. [85.163.43.2]) by smtp.gmail.com with ESMTPSA id z84sm25041465wmg.24.2019.04.16.01.59.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Apr 2019 01:59:37 -0700 (PDT) Date: Tue, 16 Apr 2019 10:59:37 +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: <20190416085937.GC2122@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 :) > >> 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. Also, I plan to implement port splitting in follow-up patchset. All flows are there as well. > >> 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? > >> - 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.