Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp5979519imm; Sat, 19 May 2018 14:11:38 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrpz6zk9sIGACC9OZx88EKZRvjrSC8qqOLuzE9aVQSlNHBPlKe9f5kty4EPhGWcED17C1FN X-Received: by 2002:a17:902:7601:: with SMTP id k1-v6mr14562057pll.200.1526764298228; Sat, 19 May 2018 14:11:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526764298; cv=none; d=google.com; s=arc-20160816; b=d6Eo+J1tWlbnRRdiwod3jgjAuJBtM9UlkUd2H1QhR4lRdrvt/GI1HiU4I7hk1DoTeY zGB+SvpKoNdxIYMvNa+0/w8WMZgCq9WJY65MIhT+wg26Nx1jz1F91FfHrVw0dFTd0/Kk 9QYLM+LvwBPZX9Jjcin9xL6lm3yk+SN2bTdhSghtD1j+LLs5YOK48rqQk+feaxWAKPtd IliTxBSMgmYugUE0ABAUQbWi0w8Oexl43A9vLPPdMT5+cQFk+hG60cOao5h+JMEH9LFi cZyD75TeciR69shjyiIySNIN/0dTAlBNnSOgei7SKq1o9BOBD/KpPistrwRynqmfPwl9 60ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=1E6d/Ny6sXoMWFfKRNmtRgfP2BbKpFBroyZFF2qcOhw=; b=sPMzfH3Ap5Y5Kc+4LJ9GnKU3p2BRYLbHw3aCK1ktDP890i9DoUtCEiWyJCn78d9DP0 eWGMKhsCyDYpmgs++HeTbYghHJR0eQUONu5gUoxpnPRvVqCQM7ZADblM/ah5g8KZ+tcP gzXqcFJgBij5F2K1cAjSupvb89+gweTtx0NONpthgc4stthkGGpKpC+eYEG+ktVPXhfL 95w1XBGqQsapaJb2sJb6fwoTjYlkeAPh6A+Aj3EgZrqxjhsgV+jhNa3qoaSzir13yNW3 RFoY2FkLm4BiADf0xTmSrCpl7Bx6yEcAsDe824PbrxHMHCHs6Z/UMlLvlO53FmfKkxM2 MJBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RmEYfhYq; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d4-v6si563477pln.206.2018.05.19.14.11.23; Sat, 19 May 2018 14:11:38 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=RmEYfhYq; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752567AbeESVLL (ORCPT + 99 others); Sat, 19 May 2018 17:11:11 -0400 Received: from mail-qt0-f194.google.com ([209.85.216.194]:37893 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752515AbeESVLJ (ORCPT ); Sat, 19 May 2018 17:11:09 -0400 Received: by mail-qt0-f194.google.com with SMTP id m9-v6so14631110qtb.5; Sat, 19 May 2018 14:11:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=1E6d/Ny6sXoMWFfKRNmtRgfP2BbKpFBroyZFF2qcOhw=; b=RmEYfhYq5jytR1H2RuP3u3EEFzijOejTqKJJ3U4ce4IC62X4XNYw2UbttwgNluxHbi g54EvhifqRkmCfRx1xedpEboU9TxwSz7osDLQopGoEBbDVqg0nAlrrJJ2r45vclmXZ2i QRYBR9OE81ojNTrgeLz3lw6XCuRLf0BItCwQkJKJf0XgPOJryeNeTHVJ+AlE/Edim7V9 afkfiTlvo+wVwh/kkevAAVJBbAwBsi3vNkdDlU1Zc5+rCyt24yC2e/PlPCZuK9UTPd/o NP4OZFCe9Y8KvoGqd+SUBWNMLaGIMRApCCa19KmPUGPKhNpLjzu9sIqI4x51WqY0FfTk RQ+Q== 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=1E6d/Ny6sXoMWFfKRNmtRgfP2BbKpFBroyZFF2qcOhw=; b=IvVckBPQLcQpo7BbX9zG61FvQ5IDG76gjyngQFYHk2Df+kTJ/0VEVBbCPTN4vqZpQs Nu9+H2dg2QFqroV71ec+unWdFlG0+WZSOt7hi6c1mI64sL0Kvy+ZTqy0UubEmux+pQda jZkDJWZaK+Gm6wyzfWxZsW27r7tK4giCplDt6ctSsPcEo4+iM+Nh2ZRS/2WpbNspIYS8 MgbxOuvec0YJjXsxBpp00zzOesgnxQvs5esolRqkkwq216nF1nI9qPiqkhRqo0vMyHjw ZcLO6gHT19zUFJ1hDLSNr5tVjmr0wAyuvMkFQRWBuCl1ybPSRVjW0yT6tCfmrZvaoXlL 5j4A== X-Gm-Message-State: ALKqPwe6nYzkhwD91lT9dMzAEHGm59bFNK0XOKt5GvkSwUfwKriZwpNA KM9dUX3dvq4gHIMCpDqFkSo= X-Received: by 2002:a0c:d0b2:: with SMTP id z47-v6mr13053482qvg.207.1526764268337; Sat, 19 May 2018 14:11:08 -0700 (PDT) Received: from localhost.localdomain ([45.4.239.227]) by smtp.gmail.com with ESMTPSA id r26-v6sm7798276qki.0.2018.05.19.14.11.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 19 May 2018 14:11:07 -0700 (PDT) Received: by localhost.localdomain (Postfix, from userid 1000) id B219D181078; Sat, 19 May 2018 18:11:04 -0300 (-03) Date: Sat, 19 May 2018 18:11:04 -0300 From: Marcelo Ricardo Leitner To: Jiri Pirko Cc: Vlad Buslov , netdev@vger.kernel.org, davem@davemloft.net, jhs@mojatatu.com, xiyou.wangcong@gmail.com, pablo@netfilter.org, kadlec@blackhole.kfki.hu, fw@strlen.de, ast@kernel.org, daniel@iogearbox.net, edumazet@google.com, keescook@chromium.org, linux-kernel@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, kliteyn@mellanox.com Subject: Re: [PATCH 04/14] net: sched: implement unlocked action init API Message-ID: <20180519211104.GB5488@localhost.localdomain> References: <1526308035-12484-1-git-send-email-vladbu@mellanox.com> <1526308035-12484-5-git-send-email-vladbu@mellanox.com> <20180514151641.GD1848@nanopsycho> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180514151641.GD1848@nanopsycho> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 14, 2018 at 05:16:41PM +0200, Jiri Pirko wrote: > Mon, May 14, 2018 at 04:27:05PM CEST, vladbu@mellanox.com wrote: > >Add additional 'unlocked' argument to act API init functions. > >Argument is true when rtnl lock is not taken and false otherwise. > >It is required to implement actions that need to release rtnl lock before > >loading kernel module and reacquire if afterwards. > > > >Signed-off-by: Vlad Buslov > > [...] > > > >@@ -721,9 +722,11 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, > > a_o = tc_lookup_action_n(act_name); > > if (a_o == NULL) { > > #ifdef CONFIG_MODULES > >- rtnl_unlock(); > >+ if (!unlocked) > >+ rtnl_unlock(); > > request_module("act_%s", act_name); > >- rtnl_lock(); > >+ if (!unlocked) > >+ rtnl_lock(); > > Although I don't like this conditional locking scheme, I see no other > way to solve this :/ But I think would be better perhaps to rename > "unlocked" to something like "rtnl_held". Agreed. "rtnl_held" also removes the double negation, "!un...".