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.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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 90219C43381 for ; Tue, 19 Feb 2019 14:08:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 540862177E for ; Tue, 19 Feb 2019 14:08:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="AVP8poaa" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728280AbfBSOIv (ORCPT ); Tue, 19 Feb 2019 09:08:51 -0500 Received: from mail-eopbgr10089.outbound.protection.outlook.com ([40.107.1.89]:53888 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726146AbfBSOIu (ORCPT ); Tue, 19 Feb 2019 09:08:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KqQUsN0hFW6aM4P7ep4TrNEJUIDk/Ut3yL4KYU/OQ0k=; b=AVP8poaa9h0gzQsdyD7zk9VuZeeg9OwWSIBFMuiNJNiPlIGBZNUyMwvOrdSu5rngALdjd5GejFBwBtsREi0Wd9K6scE2pHtvwfP2jzc8J9ckQtBkRSpTF0GJrBmJAEiRGEzjtXTbBxpn2rY1FB2/qOsJDEWslEpf/h8XTBwUc2M= Received: from VI1PR0502MB3647.eurprd05.prod.outlook.com (52.134.7.141) by VI1PR0502MB3903.eurprd05.prod.outlook.com (52.134.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1622.16; Tue, 19 Feb 2019 14:08:46 +0000 Received: from VI1PR0502MB3647.eurprd05.prod.outlook.com ([fe80::d058:d17:78fc:969a]) by VI1PR0502MB3647.eurprd05.prod.outlook.com ([fe80::d058:d17:78fc:969a%6]) with mapi id 15.20.1622.018; Tue, 19 Feb 2019 14:08:46 +0000 From: Vlad Buslov To: Cong Wang CC: Linux Kernel Network Developers , Jamal Hadi Salim , Jiri Pirko , David Miller Subject: Re: [PATCH net-next 09/12] net: sched: flower: handle concurrent tcf proto deletion Thread-Topic: [PATCH net-next 09/12] net: sched: flower: handle concurrent tcf proto deletion Thread-Index: AQHUxDmXpoqOdxHtF0umkf97S0RSAqXmDgAAgAEiyQA= Date: Tue, 19 Feb 2019 14:08:46 +0000 Message-ID: References: <20190214074712.17846-1-vladbu@mellanox.com> <20190214074712.17846-10-vladbu@mellanox.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: LO2P265CA0358.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:d::34) To VI1PR0502MB3647.eurprd05.prod.outlook.com (2603:10a6:803:f::13) authentication-results: spf=none (sender IP is ) smtp.mailfrom=vladbu@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [37.142.13.130] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 1ef8a171-5a59-464c-6a15-08d69673c36c x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020);SRVR:VI1PR0502MB3903; x-ms-traffictypediagnostic: VI1PR0502MB3903: x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1;VI1PR0502MB3903;23:hveWvLAO3Y/au71rKOE9su/9cXDjfAPp0PMYJ?= =?iso-8859-1?Q?FmaZA7pkANS8v4oFZ0GC08mKriTpByQE2vl3XCKzRnvXiUKSPJffbvnRA2?= =?iso-8859-1?Q?vXIhs9CAJKM+cQRoXlIPiYWZ9JWdaVKw/MRPjkAV1ugA/lANK7yqHzCG7b?= =?iso-8859-1?Q?R9Fdg1ZtyMFH23EsbMkV3XC8P0DdkmjvpVd5GiSD2gbIcN4K3N4dbAXyA2?= =?iso-8859-1?Q?h2U9Li7GNqrpvfS1t+MgGciqOiYQ3A0QsKQyNtEdne4859At4Mcl8hm4Ig?= =?iso-8859-1?Q?+lJaPDVeuGe5R+C45dlELJpX9sjfLlv3f5q7cCvJmNV/Ge49sTfEKFahyt?= =?iso-8859-1?Q?NYNkqBW7BKoq6q33VF9p8ef0Sa6n+sLyx0Ie4foHYLS5nXxlkctLYxRbPo?= =?iso-8859-1?Q?bYjepKdPFY7ChK0KqQDcjvRJP0GNqw3uWzWR10SmLd1gxCggNABIaILSXO?= =?iso-8859-1?Q?YA5udT9knz0dA5TuCH5Df6Zw4OaaiaLpxuYZT7zzYnZ0UYIwoV5SMncSoF?= =?iso-8859-1?Q?i9tO8SE6iIYE8DE66buvHeWs8AWPiOV4L7wUtp/vli7RTIcSaawxc13qg6?= =?iso-8859-1?Q?9Oi0nJSM8d0pUp4w94Aw42JIznBkPkHEff9X0t3dBtzWDzzoyVhPHK9Xp+?= =?iso-8859-1?Q?euSCLm9r5LhyW+NzXB/5Ao0WZNioLlWgMJw7w4e9MDqdaE21JvYvhO2V0C?= =?iso-8859-1?Q?sRf+JL+1aTqhwg/hh8w8FQ4rAJ7hRNe8guuFFl3dUyFCb29CNg04HI3dsx?= =?iso-8859-1?Q?DP8atjTxf8gkET81ddBqDdT9udEApdZYuah/RokNUFcED1l5wpFOotD/rZ?= =?iso-8859-1?Q?25aG469pQTNCksWVww9nh94wTAqlJiBaGIry62mWbwY+TDRtpRH1D3sGx6?= =?iso-8859-1?Q?2cHlfJmqKHX84iKj6am7+kYMPWecGrPsRFwzh1Je5rKcbp/bzkCVUK5aW6?= =?iso-8859-1?Q?ZrPUcAXUYEOpy/TCmJAJoaBV5fZ3PGrdmjJlHpkE8qoBlkP+0qC8/rQiYx?= =?iso-8859-1?Q?r6Hwe0/MC9amwD5Ylbf6lVBnVkoX7ijZbVt8ylbw8+T5BTRo4qr71T6IT1?= =?iso-8859-1?Q?jRj4/US43OWXraqNzGeztpJn816Cqv6t95pueaDKRkib3YBaR2Y7XFWiTu?= =?iso-8859-1?Q?PpQMveM/qRAZW7bbVBjl7ix3Jww9XV9lZhud0/1klvStwtvvY/NmYaOry1?= =?iso-8859-1?Q?59QDRxEW8eOJkslFF82VUWxCUhtipbMcQniGSfaZ7ju3q4h7OOko5SBNoz?= =?iso-8859-1?Q?vjpq8J+BIoJ42FhE/3LNcWADoKwvNINKA7mwB+jQC0ghPtqvEdJa4fzesW?= =?iso-8859-1?Q?mM5hF+aewQTqjhfTOYEHnB9Cl?= x-microsoft-antispam-prvs: x-forefront-prvs: 09538D3531 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(136003)(376002)(396003)(39860400002)(366004)(346002)(54534003)(199004)(189003)(105586002)(6512007)(6916009)(316002)(99286004)(106356001)(6506007)(386003)(53936002)(229853002)(256004)(14444005)(6436002)(66066001)(6486002)(2906002)(86362001)(68736007)(54906003)(446003)(71200400001)(6116002)(8676002)(81156014)(81166006)(71190400001)(53546011)(486006)(3846002)(186003)(26005)(36756003)(8936002)(2616005)(476003)(102836004)(11346002)(76176011)(478600001)(7736002)(97736004)(25786009)(5660300002)(52116002)(14454004)(305945005)(4326008)(6246003);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR0502MB3903;H:VI1PR0502MB3647.eurprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: HYk9GygKHJg9rjLnsYXjir1DI7RYEGKVgBNkwY+BvizPJmCLVnmEt6nkW+jBb0F6Ab7nLraoIFkzpZvhmHCYlxWg61leLtlVvSxH2dGirpHMsOksZG5GiIwuKBKUdK00abRLg1mnxSmUIK647lWj70+dtPCJeA2DeR8OgoFtsy7+UvsFNfnOGTuKUU8W40rkJOVpLm/XixUdPSqXv/Mms4JiF22oXoXwsNL97+aBBFBHTLb32SM3YOkRsQZKhCm7YNYHtMJGg8Ok4p2k6NetPHF8L2ZyOMo4vhAndfCNkyyWI9tf6dCxuuBIlqe5vnKOvKM0M1aks0nMkPHitHkyOPV+Wrcs8GkUBfpHyUzgp2te8Act2TqcSYl2DKeSfH938SKq1JMOfd1BUe/GEXNBqcbpqnoGmrSsd/CEeyshlpY= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1ef8a171-5a59-464c-6a15-08d69673c36c X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Feb 2019 14:08:45.6546 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0502MB3903 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Mon 18 Feb 2019 at 20:47, Cong Wang wrote: > On Wed, Feb 13, 2019 at 11:47 PM Vlad Buslov wrote: >> >> Without rtnl lock protection tcf proto can be deleted concurrently. Chec= k >> tcf proto 'deleting' flag after taking tcf spinlock to verify that no >> concurrent deletion is in progress. Return EAGAIN error if concurrent >> deletion detected, which will cause caller to retry and possibly create = new >> instance of tcf proto. >> > > Please state the reason why you prefer retry over locking the whole > tp without retrying, that is why and how it is better? > > Personally I always prefer non-retry logic, because it is very easy > to understand and justify its correctness. > > As you prefer otherwise, please share your reasoning in changelog. > > Thanks! At the moment filter removal code is implemented by cls API in following fashion: 1) tc_del_tfilter() obtains opaque void pointer to filter by calling tp->ops->get() 2) Pass filter pointer to tfilter_del_notify() which prepares skb with all necessary info about filter that is being removed and... 3) ... calls tp->ops->delete() to actually delete filter. Between 1) and 3) filter can be removed concurrently and there is nothing we can do about it in flower, besides account for that with some kind of retry logic. I will explain why I prefer cls API to not just lock whole classifier instance when modifying it in any way in reply to cls API patch "net: sched: protect filter_chain list with filter_chain_lock mutex" discussion.