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 3C62B45DB9 for ; Wed, 27 Nov 2024 18:21:28 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 383BC402DE; Wed, 27 Nov 2024 18:21:28 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 526BA40698 for ; Wed, 27 Nov 2024 18:21:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732728085; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=drmoMdOCiAU01PFOc+2trEx5/Lhtn9DMJKmiSLdZu58=; b=Ve/fXncj0zQgj0NkhIRxQLMXyMwzsLGHcBn7INPYEkAI0Eqm4Dzu09HaLvTeLKuBljy0hN Ae2cGg+QSgGJwrVNuh/OJhk1tpbbp/NYzsbXy5A1QGPlFheHkHny71OcCPSACWzwg0S2ag 2hzuqd+YkUE2eG6+4ySVgs1GG8gqaUk= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-332-H9rHbif-O_qAVHtcBuivEg-1; Wed, 27 Nov 2024 12:21:18 -0500 X-MC-Unique: H9rHbif-O_qAVHtcBuivEg-1 X-Mimecast-MFC-AGG-ID: H9rHbif-O_qAVHtcBuivEg Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5CBE21956046; Wed, 27 Nov 2024 17:21:17 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.192.52]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E220B30001A2; Wed, 27 Nov 2024 17:21:15 +0000 (UTC) From: Kevin Traynor To: Gagandeep Singh Cc: Hemant Agrawal , dpdk stable Subject: patch 'bus/dpaa: fix PFDRs leaks due to FQRNIs' has been queued to stable release 21.11.9 Date: Wed, 27 Nov 2024 17:17:56 +0000 Message-ID: <20241127171916.690404-49-ktraynor@redhat.com> In-Reply-To: <20241127171916.690404-1-ktraynor@redhat.com> References: <20241127171916.690404-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 3ZcrD5UyqZk9whAXI2iqMIyvJHGOS2BDyFzYHKp29bQ_1732728077 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true 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 21.11.9 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/02/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://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/b3787113fa8815a9c46c24ee7c5589e3031fc008 Thanks. Kevin --- >From b3787113fa8815a9c46c24ee7c5589e3031fc008 Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Tue, 1 Oct 2024 16:33:08 +0530 Subject: [PATCH] bus/dpaa: fix PFDRs leaks due to FQRNIs [ upstream commit b292acc3c4a8fd5104cfdfa5c6d3d0df95b6543b ] When a Retire FQ command is executed on a FQ in the Tentatively Scheduled or Parked states, in that case FQ is retired immediately and a FQRNI (Frame Queue Retirement Notification Immediate) message is generated. Software must read this message from MR and consume it to free the memory used by it. Although it is not mentioned about which memory to be used by FQRNIs in the RM but through experiments it is proven that it can use PFDRs. So if these messages are allowed to build up indefinitely then PFDR resources can become exhausted and cause enqueues to stall. Therefore software must consume these MR messages on a regular basis to avoid depleting the available PFDR resources. This is the PFDRs leak issue which user can experience while using the DPDK crypto driver and creating and destroying the sessions multiple times. On a session destroy, DPDK calls the qman_retire_fq() for each FQ used by the session, but it does not handle the FQRNIs generated and allowed them to build up indefinitely in MR. This patch fixes this issue by consuming the FQRNIs received from MR immediately after FQ retire by calling drain_mr_fqrni(). Please note that this drain_mr_fqrni() only look for FQRNI type messages to consume. If there are other type of messages like FQRN, FQRL, FQPN, ERN etc. also coming on MR then those messages need to be handled separately. Fixes: c47ff048b99a ("bus/dpaa: add QMAN driver core routines") Signed-off-by: Gagandeep Singh Acked-by: Hemant Agrawal --- drivers/bus/dpaa/base/qbman/qman.c | 46 ++++++++++++++++-------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/drivers/bus/dpaa/base/qbman/qman.c b/drivers/bus/dpaa/base/qbman/qman.c index aa8da96627..c5e66d4325 100644 --- a/drivers/bus/dpaa/base/qbman/qman.c +++ b/drivers/bus/dpaa/base/qbman/qman.c @@ -295,8 +295,30 @@ static inline void qman_stop_dequeues_ex(struct qman_portal *p) } +static inline void qm_mr_pvb_update(struct qm_portal *portal) +{ + register struct qm_mr *mr = &portal->mr; + const struct qm_mr_entry *res = qm_cl(mr->ring, mr->pi); + +#ifdef RTE_LIBRTE_DPAA_HWDEBUG + DPAA_ASSERT(mr->pmode == qm_mr_pvb); +#endif + /* when accessing 'verb', use __raw_readb() to ensure that compiler + * inlining doesn't try to optimise out "excess reads". + */ + if ((__raw_readb(&res->ern.verb) & QM_MR_VERB_VBIT) == mr->vbit) { + mr->pi = (mr->pi + 1) & (QM_MR_SIZE - 1); + if (!mr->pi) + mr->vbit ^= QM_MR_VERB_VBIT; + mr->fill++; + res = MR_INC(res); + } + dcbit_ro(res); +} + static int drain_mr_fqrni(struct qm_portal *p) { const struct qm_mr_entry *msg; loop: + qm_mr_pvb_update(p); msg = qm_mr_current(p); if (!msg) { @@ -320,4 +342,5 @@ loop: now = mfatb(); } while ((then + 10000) > now); + qm_mr_pvb_update(p); msg = qm_mr_current(p); if (!msg) @@ -482,25 +505,4 @@ static inline int qm_mr_init(struct qm_portal *portal, } -static inline void qm_mr_pvb_update(struct qm_portal *portal) -{ - register struct qm_mr *mr = &portal->mr; - const struct qm_mr_entry *res = qm_cl(mr->ring, mr->pi); - -#ifdef RTE_LIBRTE_DPAA_HWDEBUG - DPAA_ASSERT(mr->pmode == qm_mr_pvb); -#endif - /* when accessing 'verb', use __raw_readb() to ensure that compiler - * inlining doesn't try to optimise out "excess reads". - */ - if ((__raw_readb(&res->ern.verb) & QM_MR_VERB_VBIT) == mr->vbit) { - mr->pi = (mr->pi + 1) & (QM_MR_SIZE - 1); - if (!mr->pi) - mr->vbit ^= QM_MR_VERB_VBIT; - mr->fill++; - res = MR_INC(res); - } - dcbit_ro(res); -} - struct qman_portal * qman_init_portal(struct qman_portal *portal, @@ -1826,4 +1828,6 @@ int qman_retire_fq(struct qman_fq *fq, u32 *flags) out: FQUNLOCK(fq); + /* Draining FQRNIs, if any */ + drain_mr_fqrni(&p->p); return rval; } -- 2.47.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-11-27 17:17:39.821021435 +0000 +++ 0049-bus-dpaa-fix-PFDRs-leaks-due-to-FQRNIs.patch 2024-11-27 17:17:38.223269363 +0000 @@ -1 +1 @@ -From b292acc3c4a8fd5104cfdfa5c6d3d0df95b6543b Mon Sep 17 00:00:00 2001 +From b3787113fa8815a9c46c24ee7c5589e3031fc008 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit b292acc3c4a8fd5104cfdfa5c6d3d0df95b6543b ] + @@ -37 +38,0 @@ -Cc: stable@dpdk.org @@ -46 +47 @@ -index 301057723e..9c90ee25a6 100644 +index aa8da96627..c5e66d4325 100644 @@ -49 +50 @@ -@@ -293,8 +293,30 @@ static inline void qman_stop_dequeues_ex(struct qman_portal *p) +@@ -295,8 +295,30 @@ static inline void qman_stop_dequeues_ex(struct qman_portal *p) @@ -80 +81 @@ -@@ -318,4 +340,5 @@ loop: +@@ -320,4 +342,5 @@ loop: @@ -86 +87 @@ -@@ -480,25 +503,4 @@ static inline int qm_mr_init(struct qm_portal *portal, +@@ -482,25 +505,4 @@ static inline int qm_mr_init(struct qm_portal *portal, @@ -112 +113 @@ -@@ -1795,4 +1797,6 @@ int qman_retire_fq(struct qman_fq *fq, u32 *flags) +@@ -1826,4 +1828,6 @@ int qman_retire_fq(struct qman_fq *fq, u32 *flags)