Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1771665imm; Wed, 16 May 2018 02:51:08 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoN1979bmB+geu134ufxv52tl1imYMW3q2vGimuTDxKt2fgsE+zc/UNz3N3UGFrrxl3M9m/ X-Received: by 2002:a62:1549:: with SMTP id 70-v6mr182164pfv.91.1526464268397; Wed, 16 May 2018 02:51:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526464268; cv=none; d=google.com; s=arc-20160816; b=uNpHgGfKSrtopJvMd/GyYvR3A2J9ub7O1ycs426P/3QpFV9ZEVSc9KiBNU8bV4Q0WR MdSIhnApsXbom3+TV7brPd1Llwn0kVYfE3cl4u8VnTs/adg2JpJZIwZL10DZflMg79g6 aOiDouSXl29mlifUvUSwhizPca9HXnFkLvdow57eISv8J6uwgJC/If+Jm5j158UCnxc2 vPkDS80iArQkYb+mEmJcWBBsoTyzDk/HXTrnUTm0SU4weky0x/bBoeo+RXLOsDLU4pr+ jPge+uqBSOxrznzuTqGZDUR4CHO4e06K+6aDTCBcZiiOwpFrSpxbyil0wH9eBhLuLuaJ 67nw== 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=2wZW4OScmos4gntFwg4qHmup13evkNqjtnnNFR0bVUs=; b=eR5Nrugv2Oo5yLGl/oMNkO9HyaoXcxM0I/75enLLSKSibPfAtn8aHwEJtwEjq7XhSW RKi6Ol80DKFk+cuOf6Ct5eitSRsY4E7GAvVHg4boQkVsMerbUisPRJdjr33FhIdTTJJ5 VwY8aXi00Qs8qGVnMyZ+DOzcghPGNWjVE8oZkbi7SdO6HFd2NANyiBsjUeItsPuFBXNA FdSLZ/AuctxKuRkBNXLTv3dHve/9inMO0WvBol1nPOeGAwztOm96slvaRUjGvYJHXmRj iJlNLTBOK/ghgEP8JijAaziZCTHbcE2ENoTFFFuFLg8EZaU4wk1ggTJ0eSzVc6fvRf4d oWjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@resnulli-us.20150623.gappssmtp.com header.s=20150623 header.b=NblJinwN; 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 u12-v6si2167262plz.563.2018.05.16.02.50.54; Wed, 16 May 2018 02:51:08 -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=@resnulli-us.20150623.gappssmtp.com header.s=20150623 header.b=NblJinwN; 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 S1753348AbeEPJtL (ORCPT + 99 others); Wed, 16 May 2018 05:49:11 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:43400 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752514AbeEPJs5 (ORCPT ); Wed, 16 May 2018 05:48:57 -0400 Received: by mail-wr0-f196.google.com with SMTP id v15-v6so183303wrm.10 for ; Wed, 16 May 2018 02:48:57 -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=2wZW4OScmos4gntFwg4qHmup13evkNqjtnnNFR0bVUs=; b=NblJinwNNj3/cLNYwtq1tJplZixDLTcRml77wNmyOD2EFfLmRbtZlkVSlFosX97u8v cMgNJpYsg+40lhnbhgCZxssIKcAQXU6FPKwCwwgHumDHHiQxWE9cfhKtmOSC3oGkF0V4 qOIzD6mY1Mc1gyjFSfLRM0conPJb56FwyAEn1VjHhhA7nvktD5RK2k/FewTwsb1qSw2C K2feS4x5G2YYtSJcgz/gRVSBU4akb5f9wS2KjosnEe1gsWoQRE8+4k3BQ3RNYgiC8Sbt 9VwUDsAxBB2xy1df1oFOVVPRvVxxCwdgkjytR1SgfkAqp4On+93bu2wnfTkfV0XsMjLJ FyYg== 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=2wZW4OScmos4gntFwg4qHmup13evkNqjtnnNFR0bVUs=; b=pzs0SQ5YzEujXYZh14xakVJxzKzoleX0jRzM2B/OMQYpp8bhoDXgqO1dvGKZTcuiKj 3mXkYqmHpWfXeOdaCceC3oTwp4BmmLkFUIbHVW/Es4hceGboWSwxv7dFSdgRnT8mXRln PBxIdS7Hsz0tJCyIWAiQDIqwBsA6tpv7Y2rV7kiWBerX4xlbEQKi21dKA6l6VsmdWPiX nx8Em6CDE+UysDB6nsuDOkDiXe7BUZpazuIhR0SNH7V/To7WmD7FL58lG6h64f2+C0F5 tfeLHfkZ/xNWezGujz/oyHZLrH7/DICHX9SO5cWXCJXgM9dKqz3VKax/lMT5fZHq1ANb EXuQ== X-Gm-Message-State: ALKqPwfuWflLlyH1PtmK2zt3AZMUYHNLcCbzt9zrucIlFy0ieSckMYhL nfZOpasJHizmCANeBQCTjewaZI37 X-Received: by 2002:adf:81c2:: with SMTP id 60-v6mr164219wra.13.1526464136304; Wed, 16 May 2018 02:48:56 -0700 (PDT) Received: from localhost (ip-94-113-127-8.net.upcbroadband.cz. [94.113.127.8]) by smtp.gmail.com with ESMTPSA id s15-v6sm2305053wrg.70.2018.05.16.02.48.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 May 2018 02:48:55 -0700 (PDT) Date: Wed, 16 May 2018 11:48:50 +0200 From: Jiri Pirko To: Vlad Buslov Cc: 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 14/14] net: sched: implement delete for all actions Message-ID: <20180516094850.GF1972@nanopsycho> References: <1526308035-12484-1-git-send-email-vladbu@mellanox.com> <1526308035-12484-15-git-send-email-vladbu@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1526308035-12484-15-git-send-email-vladbu@mellanox.com> 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 Mon, May 14, 2018 at 04:27:15PM CEST, vladbu@mellanox.com wrote: >Implement delete function that is required to delete actions without >holding rtnl lock. Use action API function that atomically deletes action >only if it is still in action idr. This implementation prevents concurrent >threads from deleting same action twice. > >Signed-off-by: Vlad Buslov >--- > net/sched/act_bpf.c | 8 ++++++++ > net/sched/act_connmark.c | 8 ++++++++ > net/sched/act_csum.c | 8 ++++++++ > net/sched/act_gact.c | 8 ++++++++ > net/sched/act_ife.c | 8 ++++++++ > net/sched/act_ipt.c | 16 ++++++++++++++++ > net/sched/act_mirred.c | 8 ++++++++ > net/sched/act_nat.c | 8 ++++++++ > net/sched/act_pedit.c | 8 ++++++++ > net/sched/act_police.c | 8 ++++++++ > net/sched/act_sample.c | 8 ++++++++ > net/sched/act_simple.c | 8 ++++++++ > net/sched/act_skbedit.c | 8 ++++++++ > net/sched/act_skbmod.c | 8 ++++++++ > net/sched/act_tunnel_key.c | 8 ++++++++ > net/sched/act_vlan.c | 8 ++++++++ > 16 files changed, 136 insertions(+) > >diff --git a/net/sched/act_bpf.c b/net/sched/act_bpf.c >index 0bf4ecf..36f7f66 100644 >--- a/net/sched/act_bpf.c >+++ b/net/sched/act_bpf.c >@@ -394,6 +394,13 @@ static int tcf_bpf_search(struct net *net, struct tc_action **a, u32 index, > return tcf_idr_search(tn, a, index); > } > >+static int tcf_bpf_delete(struct net *net, u32 index) >+{ >+ struct tc_action_net *tn = net_generic(net, bpf_net_id); >+ >+ return tcf_idr_find_delete(tn, index); >+} >+ > static struct tc_action_ops act_bpf_ops __read_mostly = { > .kind = "bpf", > .type = TCA_ACT_BPF, >@@ -404,6 +411,7 @@ static struct tc_action_ops act_bpf_ops __read_mostly = { > .init = tcf_bpf_init, > .walk = tcf_bpf_walker, > .lookup = tcf_bpf_search, >+ .delete = tcf_bpf_delete, I wonder, right before this patch, how the idr index got removed? delete op is NULL and I didn't find anyone else to do it. Also, after this patch, does it make sense to have following check in tcf_action_del_1()? if (ops->delete) err = ops->delete(net, index); Looks like ops->delete is non-null for all. Seems to me that you need to introduce this patch filling up the delete op in all acts and only after that introduce a code that actually calls it. [...]