From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 116DBA051C for ; Tue, 11 Feb 2020 12:23:50 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0A70E1BF7B; Tue, 11 Feb 2020 12:23:50 +0100 (CET) Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by dpdk.org (Postfix) with ESMTP id 0CDC11BF7B for ; Tue, 11 Feb 2020 12:23:49 +0100 (CET) Received: by mail-wr1-f50.google.com with SMTP id w15so11880399wru.4 for ; Tue, 11 Feb 2020 03:23:49 -0800 (PST) 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=fgdHkTPHFNPeyxqiIxcy9U8SrUL/E9Hz9X8pt+r6izs=; b=pkoW6Hb7RjV1uQBAK0/sUXxKnQO6A0DmcQCNHJg5qBxV0pbGqcONNpqgPswN9DCPCo HI6qcqIvdjmlfdUPYxWetQcwTWeFLohfMlsCNPNg271XCHj33JGG+T61ly8xdlJMiC2I h0zM7E6PwISnaBCdkw4wnUWXL4XoLqgaEEa+z1EP0OodctqqdQb2bYqZcAAcyDA5tL7b RCov2xHSdB8TrwM831bgYOptfMBlkKBrdruYaLmy/I+0PoYkmk6YozRAp3PjKSCjHXvP 7RKXvfuJqJJ0xMe2HpID6aAEuHauz42gASb7fEjuV1wLGRt67E3wI5FtHSXZpRB5AhBU vZ0g== 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=fgdHkTPHFNPeyxqiIxcy9U8SrUL/E9Hz9X8pt+r6izs=; b=O3LgRMFtRi6Nk0oac3f/Rg8Lib28nGxfltMvxUzFD6vFD9pntP7XGwG/LfaOogEeiO 7jD2fqzHch57+ZqugeORjJVlvZHglxnGNR6/EH5FNbqAOpLPudfYQjhVIrp+g6XwWnAb ITWYFc3NX39CmKghPLsRAG6cYpXxZ6E3KoJ0xmOGOkZzB5tiuGUH3iY/5s86GqWtFjP0 /dG+Eq2PyFP40TRDcti0oSqRRSDmpvCI33SRG0VOqs3kU7q10/L4tRYmIj7O/0ysfT2A ztOc7lFuWmX9+kUb94UUcFFMUJYeQcYOoEXXWer4K+dA6/RMcNHDfaFJQ/dpAdXWN89B 3nxA== X-Gm-Message-State: APjAAAXGulXr66xLKzCBTFM3NavJl7iJMkz8T9QOHDycoz8ZWl5ZQuRQ cvbzez91LGsefM3yfMQREZUxMqoO X-Google-Smtp-Source: APXvYqwqtd/S33JQ7O6rduNJxRJC1rc5SMAO5/JMv4wzftOpHJhpOUuWr2T1rodtDUcwjDshUkOQhg== X-Received: by 2002:a5d:6b82:: with SMTP id n2mr8668837wrx.153.1581420228273; Tue, 11 Feb 2020 03:23:48 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id t12sm4904426wrq.97.2020.02.11.03.23.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Feb 2020 03:23:47 -0800 (PST) From: luca.boccassi@gmail.com To: =?UTF-8?q?Mattias=20R=C3=B6nnblom?= Cc: dpdk stable Date: Tue, 11 Feb 2020 11:19:23 +0000 Message-Id: <20200211112216.3929-17-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200211112216.3929-1-luca.boccassi@gmail.com> References: <20200211112216.3929-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'event/dsw: avoid credit leak on oversized enqueue bursts' has been queued to stable release 19.11.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 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 19.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/13/20. 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. Thanks. Luca Boccassi --- >From 93757d0880c31bd6e7a98301799aba13f331b81e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20R=C3=B6nnblom?= Date: Tue, 14 Jan 2020 19:03:38 +0100 Subject: [PATCH] event/dsw: avoid credit leak on oversized enqueue bursts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [ upstream commit 0c4155c7b5b51a60f676c1d7279bfcd1b14acd38 ] If an application issues rte_event_enqueue_new_burst() or rte_event_enqueue_forward_burst() call with a burst of events longer than the configured max enqueue burst size, DSW allocates credits not only for events actually enqueued, but for the complete burst. If this process is repeated, enough credits will have leaked to cause the event device to backpressure (i.e. disallow) any new enqueue operations. In addition, the port-level enqueue xstats will log the wrong number of events enqueued for oversized enqueues. This patch makes DSW gracefully handle oversized enqueue bursts. Fixes: 1c8e3caa3bfb ("event/dsw: add event scheduling and device start/stop") Signed-off-by: Mattias Rönnblom --- drivers/event/dsw/dsw_event.c | 38 ++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/drivers/event/dsw/dsw_event.c b/drivers/event/dsw/dsw_event.c index 1641c2d06e..eae53b2404 100644 --- a/drivers/event/dsw/dsw_event.c +++ b/drivers/event/dsw/dsw_event.c @@ -1018,12 +1018,12 @@ dsw_event_enqueue(void *port, const struct rte_event *ev) } static __rte_always_inline uint16_t -dsw_event_enqueue_burst_generic(void *port, const struct rte_event events[], +dsw_event_enqueue_burst_generic(struct dsw_port *source_port, + const struct rte_event events[], uint16_t events_len, bool op_types_known, uint16_t num_new, uint16_t num_release, uint16_t num_non_release) { - struct dsw_port *source_port = port; struct dsw_evdev *dsw = source_port->dsw; bool enough_credits; uint16_t i; @@ -1047,13 +1047,10 @@ dsw_event_enqueue_burst_generic(void *port, const struct rte_event events[], */ if (unlikely(events_len == 0)) { dsw_port_note_op(source_port, DSW_MAX_PORT_OPS_PER_BG_TASK); - dsw_port_flush_out_buffers(dsw, port); + dsw_port_flush_out_buffers(dsw, source_port); return 0; } - if (unlikely(events_len > source_port->enqueue_depth)) - events_len = source_port->enqueue_depth; - dsw_port_note_op(source_port, events_len); if (!op_types_known) @@ -1109,24 +1106,41 @@ uint16_t dsw_event_enqueue_burst(void *port, const struct rte_event events[], uint16_t events_len) { - return dsw_event_enqueue_burst_generic(port, events, events_len, false, - 0, 0, 0); + struct dsw_port *source_port = port; + + if (unlikely(events_len > source_port->enqueue_depth)) + events_len = source_port->enqueue_depth; + + return dsw_event_enqueue_burst_generic(source_port, events, + events_len, false, 0, 0, 0); } uint16_t dsw_event_enqueue_new_burst(void *port, const struct rte_event events[], uint16_t events_len) { - return dsw_event_enqueue_burst_generic(port, events, events_len, true, - events_len, 0, events_len); + struct dsw_port *source_port = port; + + if (unlikely(events_len > source_port->enqueue_depth)) + events_len = source_port->enqueue_depth; + + return dsw_event_enqueue_burst_generic(source_port, events, + events_len, true, events_len, + 0, events_len); } uint16_t dsw_event_enqueue_forward_burst(void *port, const struct rte_event events[], uint16_t events_len) { - return dsw_event_enqueue_burst_generic(port, events, events_len, true, - 0, 0, events_len); + struct dsw_port *source_port = port; + + if (unlikely(events_len > source_port->enqueue_depth)) + events_len = source_port->enqueue_depth; + + return dsw_event_enqueue_burst_generic(source_port, events, + events_len, true, 0, 0, + events_len); } uint16_t -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-02-11 11:17:39.684414691 +0000 +++ 0017-event-dsw-avoid-credit-leak-on-oversized-enqueue-bur.patch 2020-02-11 11:17:38.315999776 +0000 @@ -1,4 +1,4 @@ -From 0c4155c7b5b51a60f676c1d7279bfcd1b14acd38 Mon Sep 17 00:00:00 2001 +From 93757d0880c31bd6e7a98301799aba13f331b81e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20R=C3=B6nnblom?= Date: Tue, 14 Jan 2020 19:03:38 +0100 Subject: [PATCH] event/dsw: avoid credit leak on oversized enqueue bursts @@ -6,6 +6,8 @@ Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit +[ upstream commit 0c4155c7b5b51a60f676c1d7279bfcd1b14acd38 ] + If an application issues rte_event_enqueue_new_burst() or rte_event_enqueue_forward_burst() call with a burst of events longer than the configured max enqueue burst size, DSW allocates credits not @@ -20,7 +22,6 @@ This patch makes DSW gracefully handle oversized enqueue bursts. Fixes: 1c8e3caa3bfb ("event/dsw: add event scheduling and device start/stop") -Cc: stable@dpdk.org Signed-off-by: Mattias Rönnblom ---