From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=40.93.201.13 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796178319; b=hVcGUzo9qd1skMhcGuIZcssz57OrrCxB9bP6Jk/RB+PkMHhjW8iMkDVeC4+rMvzsbSXT UyngQ9Nq80Z4JPRMbL//BmiMBaSmE9tIfxOGQBlo0O8D+kVbbMeUeUywu2XqYZPjss5XO 7a7krkmUPBesXIo72wLqVXW+e+GxY/3rxv2oY8KFKGEcVklnunT8xkgeJ6C5y6dSG0Eqb eGIgAwq3rT0YvvVtJF8v+rRPEsaZKM7ddRjqDc7HzWpt68p5f1s/kV2d3P1+BdnCJBVT7 hYLX4gCmL7cnHuDvfpESg0Cayp3KfXKvx6ewAo9tdNa1Ewtrcj/Yu2Ph57RghP8gXww== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796178319; h=DMARC-Filter:DKIM-Signature:Received:Received:Message-ID:Date: User-Agent:Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding:X-ClientProxiedBy:MIME-Version: X-MS-PublicTrafficType:X-MS-TrafficTypeDiagnostic: X-MS-Office365-Filtering-Correlation-Id:X-MS-Exchange-SenderADCheck: X-MS-Exchange-AntiSpam-Relay:X-Microsoft-Antispam: X-Microsoft-Antispam-Message-Info:X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-OriginatorOrg: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-CrossTenant-Id:X-MS-Exchange-CrossTenant-MailboxType: X-MS-Exchange-CrossTenant-UserPrincipalName: X-MS-Exchange-Transport-CrossTenantHeadersStamped; bh=mgMqplD0dldZd2LynuVkufRSbdoy90Mk0oBJzv4zrws=; b=MP7xI4WYvQGm9/fRPxFZFysWdqLl6CPVFsFf3kwokOxtkWPyFSUuXfniC9WYhCNv49wr CUp4MDcbVR0PvX4HrVImR9FuzKz1CSVGo6w65indP3Ofy/RLi3NWnfxuCUUffSbClL/ia t+WaxiodSFko5uwqxI8RQ6Cdjf1UzrBDU39I3yWDPFXm2xPInEZyD336uEa0al20m2rBj x5xGaTLwTFNp8ON4Bs3Gne5Q6FGCSKZPNyGMBYt4urQtyOOCSq0K8rCPq69oVfLRJFMm3 s+5YSmlPizJrYA/BdQZBr3ga6QdnHtVEQ+YIHZxsqqGGmtIdtIPYxjjG7470zGOTBvQ== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256 header.s=selector2 header.b="i/d/4P3J"; arc=pass header.oldest-pass=0 smtp.remote-ip=40.93.201.13 Received: from CY3PR05CU001.outbound.protection.outlook.com (mail-westcentralusazon11013013.outbound.protection.outlook.com [40.93.201.13]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C91FA606A33C; Wed, 2 Dec 2026 02:25:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C91FA606A33C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256 header.s=selector2 header.b=i/d/4P3J ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sIqdcgvlsvoAERDFmjuD8xJnf0LMymbbYkJNky/bcJwvY1trNMWP8HdxZS9Zc9Y7PZGu7sTn4slcTwq8C5s8P8JX7RZTgt/Gp/aSaxKjqAqIrK9IyZFOlpDXoezY0LdH0sl0SzG3rNhe14S8mFqt67OEvlU8mJBO2SEB2RvSuNpRBm64nTJZfZtRMCYBbjJ3nCtqwDOD8/YwzZ7diWA3RfdBXYat/m4KDRSxbXgzIm/sqAwRER85nBUelZct5bOsTVs9JVB5Uj7wZh5TEh+pEmgDuhdCkts6QSofpievK1d+hHD84Mc6EW21tp7EamGC1A81sSBBTLCcXndb+a1GqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mgMqplD0dldZd2LynuVkufRSbdoy90Mk0oBJzv4zrws=; b=TZFXkh7XPFPy96u5/UWklUb0yPaIZQJdYJs9tnd0pMbPQ1yw9mnBDjlvYthxTrIUFr1qRqoQf1mQmFht4bT51Y/E54t48ZXz9VDk4NjkGENjyq19tjzsPfxci6UVRjmC/h0fpFh4ckmI0KboURl6i0F7DuVjwl+8rron1vwkt4Ytm44025DucSBIGSBGYAGIVNHqIhwyAyAcHXp2b+b+35vEma+IJD0QBgOSeva/R2gPnMHjrNiSUGZPeil5Z6rVn9WRiS11izafK7d+/xMGOwH4D2/cKmbIkibfUp1QixZjnM1boSPtJnJvjrVp411/nJjhFPyreirIBlIqSLL+zw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mgMqplD0dldZd2LynuVkufRSbdoy90Mk0oBJzv4zrws=; b=i/d/4P3JdyWVifwuRYTQNrRZofXoBza9rxSNc+pMMYGKYbwMOXiUghXSsLgfAQ1gJf3bc/g/F96oXBpXHXWihGqFqOqSS9T2/uRuZCWUnYpeiOSQ1mSjGrmBYlz+wEJv7SRYvwrJMHj0pH4osCQ84HWhCmnR5rJOWbiFmoULC86xvKO8zFjeO+543DTTgoNJ7AODv/J5aLfSSQ7A8ySL/V1/Sf7Hp8KjeBqGWpBJ4LUKGErONoMM8vmL8x8Brg3rTi+LMuI7HLZ6MSW3Hm17/jSrxIcQ+QWwMfg4fvP5/cBcdBG2lgE7X0BmSl+dkP1yRQEV/k6CPwtFyBa/iTsTyw== Authentication-Results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from SAVPR12MB999143.namprd12.prod.outlook.com (2603:10b6:806:4e5::21) by CHBPR12MB443627.namprd12.prod.outlook.com (2603:10b6:610:36c::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.10; Wed, 2 Dec 2026 02:25:15 +0000 Received: from SAVPR12MB999143.namprd12.prod.outlook.com ([fe80::219e:6553:2ec0:3761]) by SAVPR12MB999143.namprd12.prod.outlook.com ([fe80::219e:6553:2ec0:3761%4]) with mapi id 15.21.0662.007; Wed, 2 Dec 2026 02:25:09 +0000 Message-ID: <9a7e1a14-4616-4374-b1bb-e9507fd40a67@nvidia.com> Date: Wed, 2 Dec 2026 10:25:01 +0800 User-Agent: Mozilla Thunderbird Subject: Re: Re: [PATCH net v3] net/mlx5e: Wait for flow setup outside encap_tbl_lock To: netdev-bot+sashiko@kernel.org, ziyuzhang201@gmail.com Cc: saeedm@nvidia.com, tariqt@nvidia.com, mbloch@nvidia.com, leon@kernel.org, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, roid@nvidia.com, baijiaju1990@gmail.com References: <20261130140215.66953-1-ziyuzhang201@gmail.com> <179613524627.3146.8229945560228350466@kernel.org> Content-Language: en-US From: Jianbo Liu In-Reply-To: <179613524627.3146.8229945560228350466@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: TP0P295CA0033.TWNP295.PROD.OUTLOOK.COM (2603:1096:910:4::14) To SAVPR12MB999143.namprd12.prod.outlook.com (2603:10b6:806:4e5::21) X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SAVPR12MB999143:EE_|CHBPR12MB443627:EE_ X-MS-Office365-Filtering-Correlation-Id: 12ef9474-6acc-4f0a-6e95-08df501b7c48 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|23010399003|366016|1800799024|7416014|376014|11063799006|5023799004|4143699003|18002099003|261009223027099003|22082099003|260925021311599003|260925022911599003|260925021911599003|10067099003|56012099006|261021123027099003|261026121527099003|261021121427099003|261028144727099003|261102123227099003|261026140227099003|261022075727099003|261022105027099003; X-Microsoft-Antispam-Message-Info: /AYd6XAM9DufTWOxdD5jWkT3sR90zvDUe+1DgbueGlnoYtjAc+Z8epRcY0BzK6PoBMftiwmB4zfHTJoOWR8OgAi86Ltuj1+Qnnz+zLPQRQaYsqn3hOm/eC6+LUbXCVYLjOGvyZvFqqOMN4HtL/+FiE29Fq2yzoPN0KprKo2HHDL5Z3YiLdVBaXUvcqrLKu96qqHOnWaztoYrYelYI8w/YIG80zUDAI5/VvV8tUSQFcSCTgPIFrebZIwfJzkyvoz7zIa75wpHP0phgL3L3q/7Fb4sltZZ1RGuGh1vkY5FxiDz1P+s4AHZ66aN2vHzfF39pGA6jCgRw902R3tMs6ZHZ5IK4r737Gut2HBoT7mE7urlzMuHkrc0JD8ASV36YndXmuwYQ92XSlBJbCv9Bk+q+yFSvy4HusOHo4INBtXM2RPYwUluzjBU8T+YiDG4Ty+DzI/sDqnsxvk7MDuPdNfmPhebZISS4M+UoDpM1P/3IO0sHCiqFzkX1w0sVV9MR1vajFmebXgFsyrVKyxW3kRTlQZSsf2kAAxTOIgK2RWYWeXOnvxGUhnOvyfY0uf44pVfyx5rvHNPrBgA7WEt0nwUk9D5jJTYoezUrLcefc/A1CTyMmrNJu0Z05pcfvbukhtpet8QPQz8ieRwYTduy6/SRRktY/B3eKWA1inmoxCSfaY= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SAVPR12MB999143.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(23010399003)(366016)(1800799024)(7416014)(376014)(11063799006)(5023799004)(4143699003)(18002099003)(261009223027099003)(22082099003)(260925021311599003)(260925022911599003)(260925021911599003)(10067099003)(56012099006)(261021123027099003)(261026121527099003)(261021121427099003)(261028144727099003)(261102123227099003)(261026140227099003)(261022075727099003)(261022105027099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?QmNkbTNCYmZPV01vOU5lSWRwRTBlcUU0Y0RuRTdBcHFFTjIvZW9XNE91Qi9x?= =?utf-8?B?dlNBbGJucXdIbVZXS3Y4alJucDdKNjRYai9jQjIrMnFkaFdOcXgzSGlNWGUr?= =?utf-8?B?UGhmSFhsb09aUi9YVng5WGVKQzJNZWo2VHBnVDVWTW01cGJwWHNtWGxSSFM1?= =?utf-8?B?aHhVemdZ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YzJkTVVHSkxuMituRU1Nd3hWV3RNdDdIZGRXM0Rn?= =?utf-8?B?M0J0ZEJkaHlqenBhMHZkY2oxQ0IweGF6ZXJqeUo3TWRHNGZlRGJjM29vbFlC?= =?utf-8?B?U1FLWHJPMlpjV3RjRjJHeGc2VFJ5eXR5a0JpN3dWRDBWKzA0SFRPUWNreVc0?= =?utf-8?B?cDJSRFB3eWxxbTM2MGdEbTN1YXVJM3kxWFlQT25jSVF1UnhaMTVhNUxZT0R4?= =?utf-8?B?ZEJNVTFlT3hCOFpUcW0zSWVGMjNSTnNadFdPZmhsQmlYSDBCTXd1VEhRVTEr?= =?utf-8?B?MlpEMzliWUpxU0dEbHI3alRPeEYwZ0pwUUYzeUxMaS9WZmJIc2lnRzI1ZzYy?= =?utf-8?B?NVMyMmNTL0tZT1lNZHowQWpqV0R4Wk9zaFNUQXdGSDRJTm83ZVVaUT09?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 12ef9474-6acc-4f0a-6e95-08df501b7c48 X-MS-Exchange-CrossTenant-AuthSource: SAVPR12MB999143.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Dec 2026 02:25:09.2837 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: qw9O+Wx3BpLSHKuxpYi8Gqn3dLCX1Fnk0VU+4irRHxRQaUjSWkDmVzcZ1D0onVtZUqZ/PkMZKL+ZSjmHbhrzxg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CHBPR12MB443627 On 12/1/2026 10:27 PM, netdev-bot+sashiko@kernel.org wrote: > Thank you for your contribution! Sashiko AI review found 4 potential > issue(s) to consider. > > Critical: 0 · High: 2 · Medium: 1 · Low: 1 > > If you believe none of the issues are legitimate, please reply to each > issue of Medium severity or higher and explain why the AI is wrong. > If any of them are legitimate and you plan to respin, please let patchwork > know by including "pw-bot: cr" as a separate line at the end of your reply > (one such reply per series is enough). > > - [High] The flow's extra-split post-action rule (flow->extra_split_attr) > keeps pointing at the encap entry's freed pkt_reformat, and the live-… > - [High] Lost wakeup when the flow and the neighbour waiter use different > eswitches: the neighbour worker can sleep forever in… > - [Medium] The new waits only finish when every flow on the entry or > route is ready at the same moment, and nothing guarantees that moment… > - [Low] The commit combines three separate fixes under one Fixes: tag. > > -- > > net/mlx5e: Wait for flow setup outside encap_tbl_lock > > This patch replaces the per-flow init_done completion with a bool and a > per-eswitch waitqueue. Neighbour and FIB updates now sleep with > encap_tbl_lock dropped until every flow on the affected encap entry or > route is ready. It also processes encap entries that have an empty flow > list, and removes post-action rules (including the extra split rule) > before signalling del_hw_done. > >> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c >> index e1ebc9b2d061d..1522458213bff 100644 >> --- a/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c >> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c >> @@ -103,6 +103,9 @@ void mlx5e_rep_update_flows(struct mlx5e_priv *priv, >> if (encap_connected == neigh_connected && ether_addr_equal(e->h_dest, ha)) >> goto unlock; >> >> + wait_event_cmd(esw->offloads.encap_flow_wait, mlx5e_encap_flows_ready(e), >> + mutex_unlock(&esw->offloads.encap_tbl_lock), >> + mutex_lock(&esw->offloads.encap_tbl_lock)); > > [Severity: High] > Can this waiter end up sleeping on a different eswitch's waitqueue than > the one the flow wakes? I think you need Shay's patch: https://lore.kernel.org/all/20261125210629.239095-1-tariqt@nvidia.com/ One still open: an entry owned by a socket direct secondary. Shay plans a separate fix: https://lore.kernel.org/all/1b7839bc-e300-4684-a771-5badc8a9c5df@nvidia.com/ > > Here esw comes from priv. mlx5e_rep_neigh_update() derives priv from > e->out_dev while it holds rtnl_lock: > > mlx5e_rep_neigh_update() > rtnl_lock(); > ... > while ((e = mlx5e_get_next_init_encap(nhe, e)) != NULL) > mlx5e_rep_update_flows(netdev_priv(e->out_dev), e, neigh_connected, ha); > > get_route_and_out_devs() can return a peer PF's uplink as out_dev. > mlx5e_is_valid_eswitch_fwd_dev() accepts it through is_lag_dev() or > is_multiport_eligible() in multipath/LAG or MPESW setups. The encap entry > and its e->flows list, though, belong to flow->priv's eswitch. > > The flow side only wakes the waitqueue of its own eswitch: > > __mlx5e_add_fdb_flow() > smp_store_release(&flow->init_done, true); > wake_up_all(&priv->mdev->priv.eswitch->offloads.encap_flow_wait); > > mlx5e_tc_del_fdb_flow() > if (!READ_ONCE(flow->init_done)) > wake_up_all(&esw->offloads.encap_flow_wait); > > Suppose a flow on PF0 is still being set up, its out_dev is PF1's uplink, > and a neighbour update for the tunnel nexthop arrives. Would the worker > then stay in TASK_UNINTERRUPTIBLE with rtnl_lock held until some > unrelated flow on PF1 happens to be added? > > The old per-flow completion did not depend on which eswitch the waiter > used. > > The repeated mlx5e_encap_flows_ready() walk also runs under the peer > eswitch's encap_tbl_lock, not the lock that protects e->flows. The > existing list walk in this function already had that problem, but the > rescan loop makes the window larger. > >> mlx5e_take_all_encap_flows(e, &flow_list); >> >> if ((e->flags & MLX5_ENCAP_ENTRY_VALID) && >> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c >> index 4f9f8beffbc8d..59fb5c15c875e 100644 >> --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c >> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c > > [ ... ] > >> @@ -1594,8 +1627,6 @@ static int mlx5e_update_route_encaps(struct mlx5e_priv *priv, >> LIST_HEAD(encap_flows); >> >> mlx5e_take_all_encap_flows(e, &encap_flows); >> - if (list_empty(&encap_flows)) >> - continue; > > [Severity: Low] > This isn't a bug, but the patch seems to put three separate changes under > one Fixes: tag: > > - replacing the init_done completion with a bool plus a waitqueue > - removing the list_empty() skip here > - deleting the post-act and extra split handles before > complete_all(&flow->del_hw_done) in mlx5e_tc_del_fdb_flow() > > The list_empty() skip came from 8914add2c9e5, and the extra_split_attr > handling was added by 16bb8c613379. Neither comes from the cited > 8300f225268b. > > The last two changes fix problems that occur even without an init_done > waiter. Could they go into their own patches with matching Fixes: tags, > so they can be backported, bisected and reverted separately? > >> >> if (mlx5e_route_entry_valid(r)) >> mlx5e_invalidate_encap(priv, e, &encap_flows); >> @@ -1704,6 +1735,12 @@ static void mlx5e_tc_fib_event_work(struct work_struct *work) >> if (!mlx5e_route_entry_valid(r) && !replace) >> goto out; >> >> + /* Setup and error unwind both need encap_tbl_lock. Rescan the route >> + * after waking, before changing any of its entries. >> + */ >> + wait_event_cmd(esw->offloads.encap_flow_wait, mlx5e_route_flows_ready(r), >> + mutex_unlock(&esw->offloads.encap_tbl_lock), >> + mutex_lock(&esw->offloads.encap_tbl_lock)); > > [Severity: Medium] > What guarantees that this wait finishes while new flows keep attaching to > the route? > > mlx5e_route_flows_ready() and mlx5e_encap_flows_ready() walk the live > r->encap_entries, e->flows and r->decap_flows lists. While > encap_tbl_lock is dropped, other __mlx5e_add_fdb_flow() callers can > attach new flows with init_done == false through mlx5e_attach_encap() or > mlx5e_attach_decap_route(). Flower offload on reps does not take rtnl. > > Each publish wakes the waiter, which can then find another unready flow > and go back to sleep. Consider a steady stream of inserts that share one > tunnel, for example OVS offloading many flows to the same VXLAN remote > from several handler threads. Could this worker then hold rtnl_lock in > TASK_UNINTERRUPTIBLE for as long as the stream lasts? It's new with this patch. Before, the wait was under encap_tbl_lock, so no new flow could attach and the wait ended with the flows already on the list. Now RTNL can be held for as long as flows keep being added on the same tunnel. > > The new wait in mlx5e_rep_update_flows() follows the same pattern. > > The old wait ran under encap_tbl_lock, so the set of flows it waited on > was fixed. > >> err = mlx5e_update_route_encaps(priv, r, &flow_list, replace); >> if (err) >> mlx5_core_warn(priv->mdev, "Failed to update route encaps, %d\n", >> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c >> index 011741553f5b9..1688f8951581e 100644 >> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c >> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c > > [ ... ] > >> @@ -2079,6 +2089,11 @@ static void mlx5e_tc_del_fdb_flow(struct mlx5e_priv *priv, >> else >> mlx5e_tc_unoffload_fdb_rules(esw, flow, attr); >> } >> + /* An encap update may free the reformat object once del_hw_done fires. */ >> + list_for_each_entry(post_attr, &flow->attrs, list) >> + mlx5e_del_post_act_handle(flow, post_attr); >> + if (flow->extra_split_attr) >> + mlx5e_del_post_act_handle(flow, flow->extra_split_attr); >> complete_all(&flow->del_hw_done); > > [Severity: High] > The commit message says the post-action rules, "including an extra split > rule", are removed "before signalling del_hw_done so the update can > release the reformat object safely". That covers flows being deleted. > What about live flows with an extra split rule during an encap update? > > extra_split_attr_dests() struct-copies the dests after split_count into > attr2, including pkt_reformat and the encap flags: > > for (i = split_count, j = 0; i < esw_attr->out_count; i++, j++) > esw_attr2->dests[j] = esw_attr->dests[i]; > > attr2 is offloaded as its own post-act rule. It is stored only in > flow->extra_split_attr and is not linked into flow->attrs. Both > mlx5e_tc_unoffload_flow_post_acts() and mlx5e_tc_offload_flow_post_acts() > only walk flow->attrs. > > On a neighbour down or MAC change, mlx5e_tc_encap_flows_del() calls > mlx5_packet_reformat_dealloc() on e->pkt_reformat. > mlx5e_invalidate_encap() does the same on a FIB event, and with this > patch it also runs when the flow list is empty. At that point the extra > split rule is still installed and still references the freed reformat. > > mlx5e_reoffload_encap() then updates only > mlx5e_tc_get_encap_attr(flow)->esw_attr->dests[]. The extra split rule > is never rebuilt with the new e->pkt_reformat. > > Take a rule with split_count > 0 (for example a vlan push) that has both > a plain uplink and an encap mirred after the split. Would the mirrored > copy then be sent through a released reformat object? In HWS/SWS modes > another tunnel could reuse that object. It is not caused by this patch. The neigh and FIB updates never handled the extra split rule. It needs a seperate fix. >