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=-1.0 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS 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 D4A4FC10F0E for ; Thu, 18 Apr 2019 18:15:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A028720675 for ; Thu, 18 Apr 2019 18:15:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=netronome-com.20150623.gappssmtp.com header.i=@netronome-com.20150623.gappssmtp.com header.b="ToNKfuvF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392014AbfDRSPs (ORCPT ); Thu, 18 Apr 2019 14:15:48 -0400 Received: from mail-qt1-f193.google.com ([209.85.160.193]:32913 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391943AbfDRSPr (ORCPT ); Thu, 18 Apr 2019 14:15:47 -0400 Received: by mail-qt1-f193.google.com with SMTP id k14so3213523qtb.0 for ; Thu, 18 Apr 2019 11:15:47 -0700 (PDT) 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=6n4rV4tLKhNJ2GMbypTWr2Alq89dVDrI9TeaLmc5B4s=; b=ToNKfuvFrX2SWHilaloJnm1uR54I5k1CgBY5SByhSPDWvMkMfP+Byju20lwsuO+b+u jQfQDGslKx68UnbipnZye396VW2NznSapf80e4V+5eKwIlUVHmdNjRooRAGH5Rr9iKyf NmMYoWX7BYp6YNiuHS/rxLedfouO5J3aETIc6d/CBoCWAUA/7P4PPJPwbU8wDMHjTeqF zN0LlvoySr1ruibOElG/gOPgDajvGk04ykYgaqBGBkQaXn42IfnKf6pyxt7AWeVVVLw0 DWWeBKqQXkZxd6pVX5dQMu4MpJpDy0gtcR+RR8cnX5+Ua+2trkaeEFAH+3fIbLy+Nsmh aTcQ== 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=6n4rV4tLKhNJ2GMbypTWr2Alq89dVDrI9TeaLmc5B4s=; b=jK4HvWiK1mz1iIBaGDruyZLDtSmjzBDKoJo4GN4vSeFLW1iFYPQy37++fmwedpJIMq BP6qhAcseoO9r6LUTjfpfLnODpQGy6UIbHpP7Uhu9lXgeJfBgwz0EupDmVIrOIbX2mJy EBs18JM0GMppJUOwrpt7+Ml5kUA5muwXdnC3nEDSkQVBJLa9E1564riPfkr5QX9IBjgr QMsrr9i6fPNqNnqS0w21hgD+r5hsFjQ+akmYYY6iK4VCzaJKqmhrbGmUkOfmsWKQcdUN bJa2EpLUwPg3SREtG0R9tTZ/enKRMzOgBHpxjUaViZMyZYAXUmID4BBu9JI0a0n/nu3X vbsQ== X-Gm-Message-State: APjAAAUo5UaFEP8l+cgvpyOaj5QI9U6ZXYZvkrDtm5Cm7x4jYl7A/abJ 4xRNL7YnyA1ir7RTiv0qjcm62Q== X-Google-Smtp-Source: APXvYqwDwSMLLqkXhKjaLvrDx70Z2NHdKQCLuv/CIu2pk8J08ZhbHeM4yNYYVvS1+IrrATSpxvlYYA== X-Received: by 2002:a0c:8a59:: with SMTP id 25mr77669347qvu.191.1555611346727; Thu, 18 Apr 2019 11:15:46 -0700 (PDT) Received: from cakuba.netronome.com ([66.60.152.14]) by smtp.gmail.com with ESMTPSA id c21sm1140499qkm.8.2019.04.18.11.15.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Apr 2019 11:15:46 -0700 (PDT) Date: Thu, 18 Apr 2019 11:15:42 -0700 From: Jakub Kicinski To: Vlad Buslov Cc: "netdev@vger.kernel.org" , "jhs@mojatatu.com" , "xiyou.wangcong@gmail.com" , "jiri@resnulli.us" , "davem@davemloft.net" Subject: Re: [RFC PATCH net-next] net: sched: flower: refactor reoffload for concurrent access Message-ID: <20190418111542.09203e7b@cakuba.netronome.com> In-Reply-To: References: <20190410100014.784a7f9a@cakuba.netronome.com> <20190416142047.3453-1-vladbu@mellanox.com> <20190416144933.4ddb0e68@cakuba.netronome.com> <20190417093432.495dcda6@cakuba.netronome.com> <20190418104619.096a4703@cakuba.netronome.com> <20190418110216.406df370@cakuba.netronome.com> Organization: Netronome Systems, Ltd. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Thu, 18 Apr 2019 18:13:37 +0000, Vlad Buslov wrote: > On Thu 18 Apr 2019 at 21:02, Jakub Kicinski wrote: > > On Thu, 18 Apr 2019 17:58:26 +0000, Vlad Buslov wrote: =20 > >> On Thu 18 Apr 2019 at 20:46, Jakub Kicinski wrote: =20 > >> > On Thu, 18 Apr 2019 16:33:22 +0000, Vlad Buslov wrote: =20 > >> >> Considering this, I tried to improve my solution to remove possibil= ity > >> >> of multiple adds of same filter and it seems to me that it would be > >> >> enough to move hw_filters list management in flower offloads functi= ons: > >> >> add filter to list while holding rtnl lock in fl_hw_replace_filter(= ) and > >> >> remove it from list while holding rtnl lock in fl_hw_destroy_filter= (). > >> >> What do you think? =20 > >> > > >> > Sounds good for now, but I presume the plan is to get rid of rtnl > >> > around the driver call.. at which point we would switch to a rwlock?= :) =20 > >>=20 > >> Yes, but I would like the lock to be in cls hw offloads API > >> (tc_setup_cb_replace(), etc) and not in flower itself. That would also > >> solve deadlock issue and make code reusable for any further unlocked > >> classifiers implementations. =20 > > > > And then the HW list goes along with it into the common code? > > That'd be quite nice. =20 >=20 > The goal is to have a lock in tcf_block and use it synchronize cb_list > and all related counters (offloadcnt, etc). Now I also want to use it to > protect hw_filters list and prevent the double-add issue. Meanwhile rtnl > lock can do the job. SGTM =F0=9F=91=8D