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 55774A0C47 for ; Mon, 26 Jul 2021 15:56:23 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4EEE1410E6; Mon, 26 Jul 2021 15:56:23 +0200 (CEST) Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) by mails.dpdk.org (Postfix) with ESMTP id 5C860410EA for ; Mon, 26 Jul 2021 15:56:21 +0200 (CEST) Received: by mail-wr1-f53.google.com with SMTP id c16so1353520wrp.13 for ; Mon, 26 Jul 2021 06:56:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7DqSipdC4nLUBm1mcT989Sk4oGxKis+058+Vbrg+gng=; b=nOO6mavfdL4lLJPZRdgQ6gA225ogx9jqX12xbOPTXxMeLiNnKcXV7WH3JDunVCURGB z+w2pf3tN0AnOVT4pJGYK3PJOHDsCy2pxpYntuURTYUBBb7ZWiTTaLPDToeU6T027EVW /+Zs00YLRBEXNbGrXjrKzNUDzJKWEfgmELXUiZ7FKO7aoH1E4VKonaXZZWiMvAvhgkMQ xGVaCO4fu784Rdwg3uS95E6A+6Lh2AS38OZF8OiZKOBNGSfcTH7Fr7PpeX113EoO9awL YEdxkeGZdD2i1D0xlzC9WS4EBVyPTVum1bB/h0uqgIzQ4wog/T6XPPSVf+JvUiI3QLLl I/6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7DqSipdC4nLUBm1mcT989Sk4oGxKis+058+Vbrg+gng=; b=JbNFnFjUqkrBkcrkY5gQc70XpE8lw3erPsoTbDKzOBrgA2o6tKGasRnTgPHc2gEs1i xGOLVVblzYXg9Z/gUjtf20gZ2WFJvrqYMqzayxdZVIjBAbJnDsfYAkLdjPeN8dZcSmIW y2QMtGcc6kwGLmDvOLxiAtRAcy4nfP4Zwxx826riGR2aOciZDdO+JeBOwnjyfNTzklZC UkNFc/JG0tp7XN06vf069/QVwthJMS65ndXpy69D9ZRQkNuG8czsmGRh4T6CdurucZu8 xPH2qZHgbyPFxsmQvwQEEhhe9Iz66vnzHyNwm7BMIYqJvabDyYjEn5yjNsILj1FoUFcz PnpA== X-Gm-Message-State: AOAM5312y4TWRAch/pv/dGTJbJ45wbEpUU+S7lyjeV4svBGjIsKIhzQR AzMKU8MSIVyJEggLuLIK0Is= X-Google-Smtp-Source: ABdhPJxcThX616ZfO0DUw0GfhuM4uzCFJk8wdxPXMUSLheHvoIIHNUqXG1eWXVKO2yf+FWztfrEtng== X-Received: by 2002:adf:e4c3:: with SMTP id v3mr19291419wrm.362.1627307781105; Mon, 26 Jul 2021 06:56:21 -0700 (PDT) Received: from localhost ([137.220.125.106]) by smtp.gmail.com with ESMTPSA id g138sm43497512wmg.32.2021.07.26.06.56.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jul 2021 06:56:20 -0700 (PDT) From: luca.boccassi@gmail.com To: Huisong Li Cc: Min Hu , Cristian Dumitrescu , dpdk stable Date: Mon, 26 Jul 2021 14:53:20 +0100 Message-Id: <20210726135322.149850-57-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210726135322.149850-1-luca.boccassi@gmail.com> References: <20210712130551.2462159-1-luca.boccassi@gmail.com> <20210726135322.149850-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'sched: rework configuration failure handling' has been queued to stable release 20.11.3 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 Sender: "stable" Hi, FYI, your patch has been queued to stable release 20.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 07/28/21. 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://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/36c937ac722fe6dd55f2e3c2626bb77e16c88af6 Thanks. Luca Boccassi --- >From 36c937ac722fe6dd55f2e3c2626bb77e16c88af6 Mon Sep 17 00:00:00 2001 From: Huisong Li Date: Fri, 23 Apr 2021 19:01:12 +0800 Subject: [PATCH] sched: rework configuration failure handling [ upstream commit c6ccd1e3922ac346333a52e584d6c9fa7a43f237 ] Currently, rte_sched_free_memory() is called multiple times by the exception handling code in rte_sched_subport_config() and rte_sched_pipe_config(). This patch optimizes them into a unified outlet to free memory. Fixes: ac6fcb841b0f ("sched: update subport rate dynamically") Fixes: 34a90f86657c ("sched: modify pipe functions for config flexibility") Fixes: ce7c4fd7c2ac ("sched: add pipe config to subport level") Signed-off-by: Huisong Li Signed-off-by: Min Hu (Connor) Acked-by: Cristian Dumitrescu --- lib/librte_sched/rte_sched.c | 56 +++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c index df0ab5cab9..a858f61f95 100644 --- a/lib/librte_sched/rte_sched.c +++ b/lib/librte_sched/rte_sched.c @@ -1090,6 +1090,7 @@ rte_sched_subport_config(struct rte_sched_port *port, uint32_t n_subport_pipe_queues, i; uint32_t size0, size1, bmp_mem_size; int status; + int ret; /* Check user parameters */ if (port == NULL) { @@ -1101,17 +1102,16 @@ rte_sched_subport_config(struct rte_sched_port *port, if (subport_id >= port->n_subports_per_port) { RTE_LOG(ERR, SCHED, "%s: Incorrect value for subport id\n", __func__); - - rte_sched_free_memory(port, n_subports); - return -EINVAL; + ret = -EINVAL; + goto out; } if (subport_profile_id >= port->n_max_subport_profiles) { RTE_LOG(ERR, SCHED, "%s: " "Number of subport profile exceeds the max limit\n", __func__); - rte_sched_free_memory(port, n_subports); - return -EINVAL; + ret = -EINVAL; + goto out; } /** Memory is allocated only on first invocation of the api for a @@ -1127,9 +1127,8 @@ rte_sched_subport_config(struct rte_sched_port *port, RTE_LOG(NOTICE, SCHED, "%s: Port scheduler params check failed (%d)\n", __func__, status); - - rte_sched_free_memory(port, n_subports); - return -EINVAL; + ret = -EINVAL; + goto out; } /* Determine the amount of memory to allocate */ @@ -1143,9 +1142,8 @@ rte_sched_subport_config(struct rte_sched_port *port, if (s == NULL) { RTE_LOG(ERR, SCHED, "%s: Memory allocation fails\n", __func__); - - rte_sched_free_memory(port, n_subports); - return -ENOMEM; + ret = -ENOMEM; + goto out; } n_subports++; @@ -1185,12 +1183,11 @@ rte_sched_subport_config(struct rte_sched_port *port, params->red_params[i][j].min_th, params->red_params[i][j].max_th, params->red_params[i][j].maxp_inv) != 0) { - rte_sched_free_memory(port, n_subports); - RTE_LOG(NOTICE, SCHED, "%s: RED configuration init fails\n", __func__); - return -EINVAL; + ret = -EINVAL; + goto out; } } } @@ -1238,9 +1235,8 @@ rte_sched_subport_config(struct rte_sched_port *port, if (s->bmp == NULL) { RTE_LOG(ERR, SCHED, "%s: Subport bitmap init error\n", __func__); - - rte_sched_free_memory(port, n_subports); - return -EINVAL; + ret = -EINVAL; + goto out; } for (i = 0; i < RTE_SCHED_PORT_N_GRINDERS; i++) @@ -1285,6 +1281,11 @@ rte_sched_subport_config(struct rte_sched_port *port, rte_sched_port_log_subport_profile(port, subport_profile_id); return 0; + +out: + rte_sched_free_memory(port, n_subports); + + return ret; } int @@ -1299,6 +1300,7 @@ rte_sched_pipe_config(struct rte_sched_port *port, struct rte_sched_pipe_profile *params; uint32_t n_subports = subport_id + 1; uint32_t deactivate, profile, i; + int ret; /* Check user parameters */ profile = (uint32_t) pipe_profile; @@ -1313,26 +1315,23 @@ rte_sched_pipe_config(struct rte_sched_port *port, if (subport_id >= port->n_subports_per_port) { RTE_LOG(ERR, SCHED, "%s: Incorrect value for parameter subport id\n", __func__); - - rte_sched_free_memory(port, n_subports); - return -EINVAL; + ret = -EINVAL; + goto out; } s = port->subports[subport_id]; if (pipe_id >= s->n_pipes_per_subport_enabled) { RTE_LOG(ERR, SCHED, "%s: Incorrect value for parameter pipe id\n", __func__); - - rte_sched_free_memory(port, n_subports); - return -EINVAL; + ret = -EINVAL; + goto out; } if (!deactivate && profile >= s->n_pipe_profiles) { RTE_LOG(ERR, SCHED, "%s: Incorrect value for parameter pipe profile\n", __func__); - - rte_sched_free_memory(port, n_subports); - return -EINVAL; + ret = -EINVAL; + goto out; } sp = port->subport_profiles + s->profile; @@ -1406,6 +1405,11 @@ rte_sched_pipe_config(struct rte_sched_port *port, } return 0; + +out: + rte_sched_free_memory(port, n_subports); + + return ret; } int -- 2.30.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-07-26 13:53:19.270538474 +0100 +++ 0057-sched-rework-configuration-failure-handling.patch 2021-07-26 13:53:15.969295145 +0100 @@ -1 +1 @@ -From c6ccd1e3922ac346333a52e584d6c9fa7a43f237 Mon Sep 17 00:00:00 2001 +From 36c937ac722fe6dd55f2e3c2626bb77e16c88af6 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit c6ccd1e3922ac346333a52e584d6c9fa7a43f237 ] + @@ -15 +16,0 @@ -Cc: stable@dpdk.org @@ -21 +22 @@ - lib/sched/rte_sched.c | 56 +++++++++++++++++++++++-------------------- + lib/librte_sched/rte_sched.c | 56 +++++++++++++++++++----------------- @@ -24 +25 @@ -diff --git a/lib/sched/rte_sched.c b/lib/sched/rte_sched.c +diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c @@ -26,2 +27,2 @@ ---- a/lib/sched/rte_sched.c -+++ b/lib/sched/rte_sched.c +--- a/lib/librte_sched/rte_sched.c ++++ b/lib/librte_sched/rte_sched.c