Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp6036682imm; Sat, 19 May 2018 15:46:24 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpzTizP7SSKyoxH3Rqa9uSEF5RT5V1HXLZXNm6qGEp6DAR39swxRHmwydwOs3mVz3DIQK83 X-Received: by 2002:a63:2f41:: with SMTP id v62-v6mr11446192pgv.33.1526769983943; Sat, 19 May 2018 15:46:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526769983; cv=none; d=google.com; s=arc-20160816; b=SnsXdnXfkFOWOjz2y3fH80qcGmNMjc8QROkGCu6dvxKiS9jt7sTJQS/cg2InttwAcI UW/Thkv1X1PXDuNg239ng25BlfXuFZTzVpezgPSNQ1BCXia83TGJVaQDCRiQnJlkHjTi U+nquT6uj2x1gMGlFpMzlwB0FxfmXjYZRJv+7E2TkmyVXTujtA8YwKfGOklCUJ1fiOsx tzuiDBpiv6F9Uui5u9zPFSHTQHSDQiAaXbMG6wXc4YiUpuq147YQMOr+kpUeZ/KZrOH8 y/dwgRW9lCpQ4ZEj9PXqUXsmkhQ3uT6tOXWIqwBnCkSGfuuCdDTMqK117Li3J/uLUUMB hSVQ== 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=w5AqynWYTJKXEe7BYQhy+ICsKqZrVWO57qOqSBUIdRQ=; b=f72tTrFJuOQq0HiLyBGxxddNo4dlcwcAzrJM3nP9gW8ChK4LLrADek5Qb+h533fpSR fqdbuWc/S6qR4HRt1ial4ydw/rbK4/CWKfKFjBjuOA9+JVc66Oi8Cbaq47ZRyJ+kx8AU H5LW48MZPXBL3t2hxJdxGJOCBe65lNRQR+Y/0/mWWw2LYgEahfMaKwi6NfNK3jV57hO6 Zs9wFiH3nB0vXRmdroEAkKPEtxjTVmHqK6nc2PVW+N+R6FASSbUjScYjhWb3LFSaKupI 9InF5oaUdKS0stqTWH7oHRuZ6yRUDV0v6faqu/kd/J6kvDERu18flMB+aQKaLm/P7JeQ qteQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qVNBeiR9; 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 c20-v6si10599189pls.557.2018.05.19.15.46.09; Sat, 19 May 2018 15:46:23 -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=qVNBeiR9; 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 S1752521AbeESWp4 (ORCPT + 99 others); Sat, 19 May 2018 18:45:56 -0400 Received: from mail-qt0-f194.google.com ([209.85.216.194]:35561 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752280AbeESWpy (ORCPT ); Sat, 19 May 2018 18:45:54 -0400 Received: by mail-qt0-f194.google.com with SMTP id f5-v6so14778961qth.2; Sat, 19 May 2018 15:45:54 -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=w5AqynWYTJKXEe7BYQhy+ICsKqZrVWO57qOqSBUIdRQ=; b=qVNBeiR9fOJ/1uD4QY4OtwHC2CHBLExaz6ngJvqOU7WUdgBf1Zb3gEXfpyn/jYLn1Q 476qxKa77FtNmFNM9JA4wOvmOUJr4RO4dwtPUvZufo5eiHn6aU19fCupz+5bx5QfmVD6 jbDFSw9zC1LyN1KLXPQxqUtMFymFzDrdcJOVyOuCYsSFkBacOQrMRFGm7dx/opaJa0eg N/4aIdn1IdcVajsJrImuv8V+02WnxMjOz2392UCRq3x/KLy5CvXoz0hq5IRrTPI2ZnCk 1FEgb5DKLDztaiLCIIytrwL97hNQxUe30uuYBMnTEiZlqn8ncm/lGfkAI4TK7nnB+btM 5ggA== 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=w5AqynWYTJKXEe7BYQhy+ICsKqZrVWO57qOqSBUIdRQ=; b=no7mfE3fevQmQ+aFkcEzijrWjt9EO9WuevH+A5AFl8IU/JwOVOgV3oXwBIz2tcct2U CoHxGlsX0cWv5FbUmBdJHGThIyxc5FXba4/tygVr+IRCTxsw73Z//lrBaVc438C3V8eY Mkvha82Qkpsuuws7K4Uq+QQqhibM8lWhb2LahfPWISTQZ3HiuM4Et5KfOENQA7foB1aH AT3K1t9gzutUfk8qXFbE8Z0fm2zqGZ+8oE821BIwwrsYn5MAAuFisJy+sZRCPKcKO/mq d921y8R04HveA13jtt1Z2QnilUYhyhHFx34Mblf4dBnbTMOc7nNdKSLvr8bzLuXkJQ3E yM9Q== X-Gm-Message-State: ALKqPweq5pJNKvIKcdzBRlPHo9dhs6/W8s0Xk3nd2yBv8p6Kf/Dty7NS 46zkx41U/CcU3spBOOgRHaU= X-Received: by 2002:a0c:91b5:: with SMTP id n50-v6mr13567858qvn.20.1526769953413; Sat, 19 May 2018 15:45:53 -0700 (PDT) Received: from localhost.localdomain ([45.4.239.227]) by smtp.gmail.com with ESMTPSA id c20-v6sm7111842qkm.59.2018.05.19.15.45.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 19 May 2018 15:45:52 -0700 (PDT) Received: by localhost.localdomain (Postfix, from userid 1000) id CA5C81809E3; Sat, 19 May 2018 19:45:49 -0300 (-03) Date: Sat, 19 May 2018 19:45:49 -0300 From: Marcelo Ricardo Leitner To: Vlad Buslov Cc: Jiri Pirko , 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: <20180519224549.GH5488@localhost.localdomain> References: <1526308035-12484-1-git-send-email-vladbu@mellanox.com> <1526308035-12484-15-git-send-email-vladbu@mellanox.com> <20180516094850.GF1972@nanopsycho> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Wed, May 16, 2018 at 12:58:38PM +0300, Vlad Buslov wrote: > > On Wed 16 May 2018 at 09:48, Jiri Pirko wrote: > > 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. AFAICT this also means it is leaking idr's till this patch is applied. Maybe I missed something. > > > > 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. > > Already moved this for V2 patchset to: > - Add delete callback to ops and implement it for all actions in single > patch. > - Move this patch before delete first use. > > Will now remove the conditional as well. > > > > > [...] >