Received: by 10.223.164.202 with SMTP id h10csp698940wrb; Thu, 30 Nov 2017 18:06:30 -0800 (PST) X-Google-Smtp-Source: AGs4zMaTayY0hgI2zep1rVVsoT7bwpu0PMzAqx6VU2HsD0gouNiDKK4nx8JFsxZshXO9lB+q5dF7 X-Received: by 10.101.67.140 with SMTP id m12mr4160322pgp.51.1512093990176; Thu, 30 Nov 2017 18:06:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512093990; cv=none; d=google.com; s=arc-20160816; b=siET0zsDC9aSqUOo2IYwef0B7lAJlKhN05G8P8c5BipAIGKAwJb4DGT62NjUQbmpQM /JzcVMgrIOZWQ2txFZjBHuUu8IoPH0P3pPLE2b5zCx6XdfmdU3d2qzLoXQtTLq2z1P8a KDAgllcjAArubP5XiPxrJgGI3Obvm9JnsDBLvlBaZ/VcDW8DT+3ugN068ZBtlLF/8H49 ZBVEUAgfRhUBPclJ/OJbPkeq4YEoCylHCFpfwww0QDu5gzwQwkH3fjUwzkr5UMAIIqlK LoPSA+A+7NnJ0p68J61AaRXl97cQESVP5jagO6jEqoq53mAtS/ppt/lDuDW1JwVDr0d9 QkvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature:arc-authentication-results; bh=vvpSDDuPecz280saFdDe90v2XWGb7R4+1vi5gUmJXO8=; b=rBTAipjmOl3PI0cr0x/S9K0p3y7d14zNoQ2eVb+EqDypNmbdmwyCNuFvOaWsxzqLxu /2rSedUWkePvtdcLK5ZQ9ltK3d90HhYn0m5140SV0xZJ80syZf7RgFIPH5fhl30SckUU 2nGpjr+1CDia3wbfJTREfNHOLeIja4YWnkW3CFsvQk/qrL6yvRVp63KT7rROa8yz6++W iri1kjE7R+AUmJTJubjMCrgKDHrUDYqNFU1EakYMdODWjG/ChomDLIMAtami0hqofeI4 HljiQ/E5wTmik4TThPqkOrKpsInF3/r3s/PbNc/LoCcu36Rwf/L7hNHVzJGB4wbjn8ZT hJ0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=tzDdeQ2D; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w5si4055073plz.57.2017.11.30.18.06.16; Thu, 30 Nov 2017 18:06:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=tzDdeQ2D; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752058AbdLACGC (ORCPT + 99 others); Thu, 30 Nov 2017 21:06:02 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:36187 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750735AbdLACGA (ORCPT ); Thu, 30 Nov 2017 21:06:00 -0500 Received: by mail-pf0-f195.google.com with SMTP id p84so3972238pfd.3 for ; Thu, 30 Nov 2017 18:06:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-transfer-encoding; bh=vvpSDDuPecz280saFdDe90v2XWGb7R4+1vi5gUmJXO8=; b=tzDdeQ2DeevzAGUOk1VEoT4XOcpgxZDtOpxY32T24aAYQqhZ8M22UPPGHjKBiP2ztl /m/dELTFaQ0Ml2JXQiKJSpFNexI/eEILrcxYbIDC4laV33fTWQqfdKIAowFb/5ltL57l P6ETSQgYp0XBP3tl+h7pymnoZzEbkbLXCa63lOCr1ER//Tvu5GRmnWZjYvZg2uCw9vIt x4Q0Lxr2PkK6Rw35y25hlFve0h+N+MzWp90lX7IFOuKjzHyB7Au9SEN8ss7P6JLsSxKX Fwrow6dWHdwtdHTQLNFSyeTiAa3iRks/jl+VhVoOEPjJObt5aD/KeQ3hGJHE6U8lF9oH 4t5Q== 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:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=vvpSDDuPecz280saFdDe90v2XWGb7R4+1vi5gUmJXO8=; b=MK2BdOGek4+NaX6m4T8oeEhTU1GxtebePf5IvwHwCbSaTBLdAbZKjXAGmX4H1v6x9L yAt3tqNDOf9KJ8e0UtshJ/oHEucEkCxStH1KSw6lTH39tZ6XxEBuv/gFpEzBlykkGx+o G3Tuv6rwnunbVLh0gGajcX9uMvitg31mf4j/i9xg505EpQOVZZ7QmDdhlIR4tLy6npRm 8DvbFkwShDaccG8gTum7Jr2Gba4wYXWeos2MB1kjjchzjH5no6p94Wr40Ll/I1rtZMaI 7TeHaW7k3XnZC2BnELSQVZkIxOL0x/DqyePZOY/MFEcrxxMXRbH55+6Lj1QaaAg3UPXi Lihg== X-Gm-Message-State: AJaThX48qr3UBUv/QHEqxnUsZLgrw3Q4d7qGXHluTXe/GyNuK0bky0gW XL7YTEDfqjHZAc2YlKP8+aIh0g== X-Received: by 10.99.127.84 with SMTP id p20mr4340565pgn.204.1512093959727; Thu, 30 Nov 2017 18:05:59 -0800 (PST) Received: from cakuba.netronome.com ([75.53.12.129]) by smtp.gmail.com with ESMTPSA id 77sm9839148pfh.43.2017.11.30.18.05.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 30 Nov 2017 18:05:59 -0800 (PST) Date: Thu, 30 Nov 2017 18:05:56 -0800 From: Jakub Kicinski To: Kirill Tkhai Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, oss-drivers@netronome.com, alexei.starovoitov@gmail.com, daniel@iogearbox.net, "Eric W . Biederman" Subject: Re: [RFC] bpf: offload: report device information for offloaded programs Message-ID: <20171130180556.2913ecdb@cakuba.netronome.com> In-Reply-To: <85513945-bcd2-b2b4-24e7-5fbb3e695419@virtuozzo.com> References: <20171130002251.30498-1-jakub.kicinski@netronome.com> <85513945-bcd2-b2b4-24e7-5fbb3e695419@virtuozzo.com> Organization: Netronome Systems, Ltd. MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Kirill, On Thu, 30 Nov 2017 16:19:13 +0300, Kirill Tkhai wrote: > > @@ -164,6 +166,38 @@ int bpf_prog_offload_compile(struct bpf_prog *prog) > > return bpf_prog_offload_translate(prog); > > } > > > > +int bpf_prog_offload_info_fill(struct bpf_prog_info *info, > > + struct bpf_prog *prog) > > +{ > > + struct bpf_dev_offload *offload = prog->aux->offload; > > + struct inode *ns_inode; > > + struct path ns_path; > > + struct net *net; > > + int ret = 0; > > + void *ptr; > > + > > + info->dev_bound = 1; > > + > > + rtnl_lock(); > > rtnl_lock() is too big lock and it is already overused in kernel. > Can't we use smaller lock in this driver to protect bpf_prog_offload_devs? > I suppose rwlock would be appropriate for that. > > (Then, we may completely remove rtnl_lock() from bpf_prog_offload_init() > and use readlocked dev_base_lock for __dev_get_by_index() instead and > the new small_rwlock to link in the list. > > Not sure about bpf_prog_offload_verifier_prep() and bpf_prog_offload_translate() > and which context expect net_device_ops->ndo_bpf users. Either they need rtnl > or not). Thanks for the comments, removing the use of rtnl_lock is definitely on my todo list! From 1585497267871643141@xxx Thu Nov 30 13:20:23 +0000 2017 X-GM-THRID: 1585448462384013049 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread