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=-4.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED 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 449DEC10F0E for ; Fri, 12 Apr 2019 13:29:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F2B0F20693 for ; Fri, 12 Apr 2019 13:29:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="Yg9j5iYH" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726847AbfDLN3C (ORCPT ); Fri, 12 Apr 2019 09:29:02 -0400 Received: from mail-eopbgr00058.outbound.protection.outlook.com ([40.107.0.58]:44461 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726244AbfDLN3B (ORCPT ); Fri, 12 Apr 2019 09:29:01 -0400 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=up4kqvyha7NdwpTETvFwV+GwNkHcq7ommvgX0fwG5Xk=; b=Yg9j5iYH1AJt4/gXJ6XSdOIPuvAtHaoyVo0QsZuhj19JBRF7WPaM8TJ3sgBqGEJfwr8sqXod2pkUjqoDkfMMHfuyJow3sC6P7yEtgvKTrudg1z/j4bsvAw1vbrUhFPE17XGTInUyfSNn7koPB9xWwhTBTLmSGeMK9QsZo3EfUeM= Received: from AM0PR05MB6100.eurprd05.prod.outlook.com (20.178.119.209) by AM0PR05MB6420.eurprd05.prod.outlook.com (20.179.34.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1771.16; Fri, 12 Apr 2019 13:28:58 +0000 Received: from AM0PR05MB6100.eurprd05.prod.outlook.com ([fe80::8c3:74d4:724a:9f35]) by AM0PR05MB6100.eurprd05.prod.outlook.com ([fe80::8c3:74d4:724a:9f35%4]) with mapi id 15.20.1792.016; Fri, 12 Apr 2019 13:28:58 +0000 From: Ido Schimmel To: Vlad Buslov CC: "netdev@vger.kernel.org" , "jhs@mojatatu.com" , "xiyou.wangcong@gmail.com" , "jiri@resnulli.us" , "davem@davemloft.net" , "idosch@idosch.org" Subject: Re: [PATCH net-next] net: sched: flower: fix filter net reference counting Thread-Topic: [PATCH net-next] net: sched: flower: fix filter net reference counting Thread-Index: AQHU8S+07i18XvMJokOUpWiuaQ7X/qY4hPqA Date: Fri, 12 Apr 2019 13:28:58 +0000 Message-ID: <20190412132855.GA21114@splinter> References: <20190411215419.5417-1-vladbu@mellanox.com> In-Reply-To: <20190411215419.5417-1-vladbu@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM6P193CA0097.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:88::38) To AM0PR05MB6100.eurprd05.prod.outlook.com (2603:10a6:208:12e::17) authentication-results: spf=none (sender IP is ) smtp.mailfrom=idosch@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [79.176.7.115] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 7a635aa4-3f7d-4da5-9af9-08d6bf4ad13b x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600139)(711020)(4605104)(4618075)(2017052603328)(7193020);SRVR:AM0PR05MB6420; x-ms-traffictypediagnostic: AM0PR05MB6420: x-microsoft-antispam-prvs: x-forefront-prvs: 0005B05917 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(7916004)(376002)(136003)(366004)(346002)(39860400002)(396003)(199004)(189003)(11346002)(97736004)(476003)(71190400001)(5660300002)(14444005)(105586002)(1076003)(6512007)(256004)(33656002)(9686003)(81156014)(8936002)(106356001)(7736002)(2906002)(186003)(26005)(66066001)(229853002)(305945005)(8676002)(81166006)(68736007)(6636002)(99286004)(6116002)(76176011)(316002)(386003)(3846002)(53936002)(6506007)(71200400001)(86362001)(14454004)(446003)(102836004)(6436002)(486006)(52116002)(25786009)(6486002)(6246003)(54906003)(4326008)(33716001)(478600001)(6862004);DIR:OUT;SFP:1101;SCL:1;SRVR:AM0PR05MB6420;H:AM0PR05MB6100.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: D0rHFBqfB4T5p3156SDu3TVi1qKrn/bcS8U8De92aGQw4w0uSMgBwhZV6y/pHkODIAfbGRzoUKkHswiVjWoLfoy9Sf856n2eTUE99I9av4+yU2fFroM/xaVeBwGvA8UxkjFnSwrAMnRDkqJ/oAwlKPEEUlL+0Id5b93yhFSXxjJYCzKq61LziOS5f8xUYuT8gZvnOgN9bpiqisgZlANpLauj6sroxcDOvvS7x8wkRH1usE7Iy9Ct3/JPdbtHTh3pqDQok2mgLLcHYtmFuSZtRMzwu9oEpYlPPwXcld0gYEKtXyZJbzA9NaCyYMofSAs9fxE+x9Z4dZ3P7OpaPIALZF0pca1QIRbftexio7q+T3ja4Q+6sc2kKxHFFZIVLUxI0WkdsywwSOQeIovsiDySygZQmvICnFOdFWw4BMn5VBY= Content-Type: text/plain; charset="us-ascii" Content-ID: <9B5920499AADED4C9EBB8F6D1DD830E6@eurprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7a635aa4-3f7d-4da5-9af9-08d6bf4ad13b X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Apr 2019 13:28:58.1455 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB6420 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Fri, Apr 12, 2019 at 12:54:19AM +0300, Vlad Buslov wrote: > Fix net reference counting in fl_change() and remove redundant call to > tcf_exts_get_net() from __fl_delete(). __fl_put() already tries to get ne= t > before releasing exts and deallocating a filter, so this code caused flow= er > classifier to obtain net twice per filter that is being deleted. >=20 > Implementation of __fl_delete() called tcf_exts_get_net() to pass its > result as 'async' flag to fl_mask_put(). However, 'async' flag is redunda= nt > and only complicates fl_mask_put() implementation. This functionality see= ms > to be copied from filter cleanup code, where it was added by Cong with > following explanation: >=20 > This patchset tries to fix the race between call_rcu() and > cleanup_net() again. Without holding the netns refcnt the > tc_action_net_exit() in netns workqueue could be called before > filter destroy works in tc filter workqueue. This patchset > moves the netns refcnt from tc actions to tcf_exts, without > breaking per-netns tc actions. >=20 > This doesn't apply to flower mask, which doesn't call any tc action code > during cleanup. Simplify fl_mask_put() by removing the flag parameter and > always use tcf_queue_work() to free mask objects. >=20 > Fixes: 061775583e35 ("net: sched: flower: introduce reference counting fo= r filters") > Fixes: 1f17f7742eeb ("net: sched: flower: insert filter to ht before offl= oading it to hw") > Fixes: 05cd271fd61a ("cls_flower: Support multiple masks per priority") > Reported-by: Ido Schimmel > Signed-off-by: Vlad Buslov I see the patch was already applied, but FWIW: Tested-by: Ido Schimmel