From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A7C1145E41 for ; Sat, 7 Dec 2024 09:03:26 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9CFBE40E4D; Sat, 7 Dec 2024 09:03:26 +0100 (CET) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2083.outbound.protection.outlook.com [40.107.92.83]) by mails.dpdk.org (Postfix) with ESMTP id 7D19240E4D for ; Sat, 7 Dec 2024 09:03:25 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SA3Bjc+SRJQ/5oGLlyuh61Ncrlst0mRbbf1nA98tE7Kr9U6B4RWeOEGbiALJMrWyWWwxhRgK8lBy82VLuxgSDC1VF/CcTT2vfiNIwTX7KO92qyMRo6C/XgFvbnka24Ex8xW/1L2ZBKyljX1fUqlU9sIt0o30GIFd2kFIlKItBDf73Gb+Lu6Xs1k2tpqLoWyFw8ArmDFeNDduAmXNYv6MrB6uFZmL1uty88QsMAGaZoIojy8uEywN26uJviJ4VRJfbD2xtTQHXVjHxGN0epEIZNJ8WyeP5HrXA8ISTho2B+al28eWBfOZ6fqp5I3fPj+eSLrSSjtheTjeOrhB4gUU9A== 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=sTAI2kL53TLZDJezzVik7/jfwLzoG0KX94PxXfv/P3k=; b=Pl19xr+UsSEaEkSG3cCaa1RQr6/B1hd3uQOEOT6+ceM2AAfuS4th3cI++rTApCbpRIqQZ7Urk0ETdKOemB7C1JXj8AQgtivVpfd41cGFpfG3ae+1yWHni8AlB84aoJmFA84a4SBN19YtQIHVkbygamr0+Of8OmWLzYu7pPB6jVz+De87ApiCxZ5jZn1Zeoib1aE9Pier2sUdj+wAQgCq+Mgln/6FmTzhikmGvsqawcKyeXDhqFGLdTjnTDULb1HI0EJf0mF/VcWh8oBJtLNQ/z9n/B0FuNrrQbY0xQ/ZyKFfnpDYj0BNOe1vBI/6LbG0MiH9b+e7hRj8N3ZV0p4Ndw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=nxp.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=sTAI2kL53TLZDJezzVik7/jfwLzoG0KX94PxXfv/P3k=; b=keScF7zkeMgwk/XfGWyAYiTZV1+f9MxuZdsSDITaWizyNR7hFSqHwNTqCOOLUiGmjIY5gQSXB4yGx6pds1rwt+gc6ObV5QoE+6qRmMOhXe7rtXFrU/dM/RFt6R5e1KZRlDRzftFZ55TwkhyUxTDUYNLLponht5DZZy7HU3e7gKioHd8iz+t3MbeRb9tyxnir/G4Cj/HY6H5COQp/yw1fS/A786BjI6fOglOicdYlYEM9ewDxQ6OFEnCDkwXYjqROP8PZhSuOVYZSTQv+LklQ2BU7lFWzuEhcGpJridYpI41gtSWYOwcKB2nlkSCkcwY/daQ9VpA/AioyOcO/90Z4jg== Received: from BYAPR11CA0039.namprd11.prod.outlook.com (2603:10b6:a03:80::16) by DS7PR12MB6286.namprd12.prod.outlook.com (2603:10b6:8:95::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.11; Sat, 7 Dec 2024 08:03:21 +0000 Received: from SJ1PEPF00001CE3.namprd05.prod.outlook.com (2603:10b6:a03:80:cafe::d0) by BYAPR11CA0039.outlook.office365.com (2603:10b6:a03:80::16) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.10 via Frontend Transport; Sat, 7 Dec 2024 08:03:20 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by SJ1PEPF00001CE3.mail.protection.outlook.com (10.167.242.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.7 via Frontend Transport; Sat, 7 Dec 2024 08:03:20 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Sat, 7 Dec 2024 00:03:12 -0800 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Sat, 7 Dec 2024 00:03:10 -0800 From: Xueming Li To: Gagandeep Singh CC: Xueming Li , Hemant Agrawal , dpdk stable Subject: patch 'net/dpaa2: fix memory corruption in TM' has been queued to stable release 23.11.3 Date: Sat, 7 Dec 2024 15:59:41 +0800 Message-ID: <20241207080055.488538-24-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241207080055.488538-1-xuemingl@nvidia.com> References: <20241111062847.216344-122-xuemingl@nvidia.com> <20241207080055.488538-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00001CE3:EE_|DS7PR12MB6286:EE_ X-MS-Office365-Filtering-Correlation-Id: bd730919-146b-4619-ba0d-08dd16959daa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|82310400026|1800799024|36860700013|7053199007; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?VWb95gSqRLfNmHpfncDZuZbY+3V3bDgl0+hBPf/7WU+aAdbeKUNeVd4vnZJw?= =?us-ascii?Q?ykk+SyXGMZgqsi8K7C1b9W+4/N9u1GrvL3MKeIYtX9t/xFvj6xYb4larUNn8?= =?us-ascii?Q?PjkX3L5EUwgWBLu7+JtvcWS7LaV9GeuCPSTo5ea4+L5cZdKzhjMIDSR2IHiK?= =?us-ascii?Q?7JW6WedgKEB+juOQhfiNqRJwHMIm7loOXBHBioCCGKWad5PMb4oL6OIVd0+u?= =?us-ascii?Q?T95TYqyrTErtkWHGyeKt+54m57dE3zXvfSCd+I6hoBxQGZfn4mqVvh7odeQP?= =?us-ascii?Q?9y6k4WAb6jt2029TpD6BLboEmSTyvYZdY+KuEykLpvJCqgYbutyLiuW3XYV3?= =?us-ascii?Q?qPz/ggJS6hRYzNZ46AmYaT3dRJ44QvauTDDCGGyp7OzyQ6yGP2g63l8zS83D?= =?us-ascii?Q?sbeQXgJKKQaiyH2pUaQ2P1jtm2Euk4Sr+z8Il2EPfTRz4PAt01KJmMvF0a0u?= =?us-ascii?Q?57xmWCNfIZe/zflXag/6u21pqcM8VI8ro9JNuINE0kkPOopeh1Mrciw1sOH9?= =?us-ascii?Q?fQFRet+BtAm2IAg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ascii?Q?g1SLYod1N1tqoosW8VPGaV5dMsOlnEi4?= X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230040)(376014)(82310400026)(1800799024)(36860700013)(7053199007); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Dec 2024 08:03:20.6534 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bd730919-146b-4619-ba0d-08dd16959daa X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF00001CE3.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6286 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 23.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 12/10/24. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://git.dpdk.org/dpdk-stable/log/?h=23.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=2069d39f4189a95a38b119191ce0a48c83f1a1d4 Thanks. Xueming Li --- >From 2069d39f4189a95a38b119191ce0a48c83f1a1d4 Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Wed, 23 Oct 2024 17:29:47 +0530 Subject: [PATCH] net/dpaa2: fix memory corruption in TM Cc: Xueming Li [ upstream commit d77cb0c44cf6b68dc71684bd302fd3138b36e5f1 ] driver was reserving memory in an array for 8 queues only, but it can support many more queues configuration. This patch fixes the memory corruption issue by defining the queue array with correct size. Fixes: 72100f0dee21 ("net/dpaa2: support level 2 in traffic management") Signed-off-by: Gagandeep Singh Acked-by: Hemant Agrawal --- drivers/net/dpaa2/dpaa2_tm.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/drivers/net/dpaa2/dpaa2_tm.c b/drivers/net/dpaa2/dpaa2_tm.c index 3c0f282ec3..c4efdf0af8 100644 --- a/drivers/net/dpaa2/dpaa2_tm.c +++ b/drivers/net/dpaa2/dpaa2_tm.c @@ -684,6 +684,7 @@ dpaa2_hierarchy_commit(struct rte_eth_dev *dev, int clear_on_fail, struct dpaa2_tm_node *leaf_node, *temp_leaf_node, *channel_node; struct fsl_mc_io *dpni = (struct fsl_mc_io *)dev->process_private; int ret, t; + bool conf_schedule = false; /* Populate TCs */ LIST_FOREACH(channel_node, &priv->nodes, next) { @@ -757,7 +758,7 @@ dpaa2_hierarchy_commit(struct rte_eth_dev *dev, int clear_on_fail, } LIST_FOREACH(channel_node, &priv->nodes, next) { - int wfq_grp = 0, is_wfq_grp = 0, conf[DPNI_MAX_TC]; + int wfq_grp = 0, is_wfq_grp = 0, conf[priv->nb_tx_queues]; struct dpni_tx_priorities_cfg prio_cfg; memset(&prio_cfg, 0, sizeof(prio_cfg)); @@ -767,6 +768,7 @@ dpaa2_hierarchy_commit(struct rte_eth_dev *dev, int clear_on_fail, if (channel_node->level_id != CHANNEL_LEVEL) continue; + conf_schedule = false; LIST_FOREACH(leaf_node, &priv->nodes, next) { struct dpaa2_queue *leaf_dpaa2_q; uint8_t leaf_tc_id; @@ -789,6 +791,7 @@ dpaa2_hierarchy_commit(struct rte_eth_dev *dev, int clear_on_fail, if (leaf_node->parent != channel_node) continue; + conf_schedule = true; leaf_dpaa2_q = (struct dpaa2_queue *)dev->data->tx_queues[leaf_node->id]; leaf_tc_id = leaf_dpaa2_q->tc_index; /* Process sibling leaf nodes */ @@ -829,8 +832,8 @@ dpaa2_hierarchy_commit(struct rte_eth_dev *dev, int clear_on_fail, goto out; } is_wfq_grp = 1; - conf[temp_leaf_node->id] = 1; } + conf[temp_leaf_node->id] = 1; } if (is_wfq_grp) { if (wfq_grp == 0) { @@ -851,6 +854,9 @@ dpaa2_hierarchy_commit(struct rte_eth_dev *dev, int clear_on_fail, } conf[leaf_node->id] = 1; } + if (!conf_schedule) + continue; + if (wfq_grp > 1) { prio_cfg.separate_groups = 1; if (prio_cfg.prio_group_B < prio_cfg.prio_group_A) { @@ -864,6 +870,16 @@ dpaa2_hierarchy_commit(struct rte_eth_dev *dev, int clear_on_fail, prio_cfg.prio_group_A = 1; prio_cfg.channel_idx = channel_node->channel_id; + DPAA2_PMD_DEBUG("########################################"); + DPAA2_PMD_DEBUG("Channel idx = %d", prio_cfg.channel_idx); + for (t = 0; t < DPNI_MAX_TC; t++) + DPAA2_PMD_DEBUG("tc = %d mode = %d, delta = %d", t, + prio_cfg.tc_sched[t].mode, + prio_cfg.tc_sched[t].delta_bandwidth); + + DPAA2_PMD_DEBUG("prioritya = %d, priorityb = %d, separate grps" + " = %d", prio_cfg.prio_group_A, + prio_cfg.prio_group_B, prio_cfg.separate_groups); ret = dpni_set_tx_priorities(dpni, 0, priv->token, &prio_cfg); if (ret) { ret = -rte_tm_error_set(error, EINVAL, @@ -871,15 +887,6 @@ dpaa2_hierarchy_commit(struct rte_eth_dev *dev, int clear_on_fail, "Scheduling Failed\n"); goto out; } - DPAA2_PMD_DEBUG("########################################"); - DPAA2_PMD_DEBUG("Channel idx = %d", prio_cfg.channel_idx); - for (t = 0; t < DPNI_MAX_TC; t++) { - DPAA2_PMD_DEBUG("tc = %d mode = %d ", t, prio_cfg.tc_sched[t].mode); - DPAA2_PMD_DEBUG("delta = %d", prio_cfg.tc_sched[t].delta_bandwidth); - } - DPAA2_PMD_DEBUG("prioritya = %d", prio_cfg.prio_group_A); - DPAA2_PMD_DEBUG("priorityb = %d", prio_cfg.prio_group_B); - DPAA2_PMD_DEBUG("separate grps = %d", prio_cfg.separate_groups); } return 0; -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-12-06 23:26:44.912192917 +0800 +++ 0023-net-dpaa2-fix-memory-corruption-in-TM.patch 2024-12-06 23:26:43.903044828 +0800 @@ -1 +1 @@ -From d77cb0c44cf6b68dc71684bd302fd3138b36e5f1 Mon Sep 17 00:00:00 2001 +From 2069d39f4189a95a38b119191ce0a48c83f1a1d4 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit d77cb0c44cf6b68dc71684bd302fd3138b36e5f1 ] @@ -13 +15,0 @@ -Cc: stable@dpdk.org @@ -22 +24 @@ -index fb8c384ca4..ab3e355853 100644 +index 3c0f282ec3..c4efdf0af8 100644