DPDK patches and discussions
 help / color / mirror / Atom feed
From: Timothy McDaniel <timothy.mcdaniel@intel.com>
To: jerinj@marvell.com
Cc: dev@dpdk.org, timothy.mcdaniel@intel.com
Subject: [PATCH v2 4/5] event/dlb2: fix cq depth override credit deadlock
Date: Sat,  2 Jul 2022 11:03:39 -0500	[thread overview]
Message-ID: <20220702160340.1591058-5-timothy.mcdaniel@intel.com> (raw)
In-Reply-To: <20220702160340.1591058-1-timothy.mcdaniel@intel.com>

This commit fixes a bug, where we could encounter a credit
deadlock due to changing the CQ depth. To remedy this situation,
the commit reduces the maximum CQ depth from 1024 to 128,
and also allows configuring the maximum enqueue depth. Maximum
enqueue depth must be tuned to the CQ depth, if the CQ depth
is increased.

Fixes: 86fe66d45667 ("event/dlb2: allow CQ depths up to 1024")
Cc: timothy.mcdaniel@intel.com

Signed-off-by: Timothy McDaniel <timothy.mcdaniel@intel.com>
---
 drivers/event/dlb2/dlb2.c       | 51 +++++++++++++++++++++++++++++++++
 drivers/event/dlb2/dlb2_priv.h  |  8 +++++-
 drivers/event/dlb2/pf/dlb2_pf.c |  3 +-
 3 files changed, 60 insertions(+), 2 deletions(-)

diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c
index b50cd8e5ce..8a68c25c93 100644
--- a/drivers/event/dlb2/dlb2.c
+++ b/drivers/event/dlb2/dlb2.c
@@ -326,6 +326,36 @@ set_max_cq_depth(const char *key __rte_unused,
 	return 0;
 }
 
+static int
+set_max_enq_depth(const char *key __rte_unused,
+		  const char *value,
+		  void *opaque)
+{
+	int *max_enq_depth = opaque;
+	int ret;
+
+	if (value == NULL || opaque == NULL) {
+		DLB2_LOG_ERR("NULL pointer\n");
+		return -EINVAL;
+	}
+
+	ret = dlb2_string_to_int(max_enq_depth, value);
+	if (ret < 0)
+		return ret;
+
+	if (*max_enq_depth < DLB2_MIN_ENQ_DEPTH_OVERRIDE ||
+	    *max_enq_depth > DLB2_MAX_ENQ_DEPTH_OVERRIDE ||
+	    !rte_is_power_of_2(*max_enq_depth)) {
+		DLB2_LOG_ERR("dlb2: max_enq_depth %d and %d and a power of 2\n",
+		DLB2_MIN_ENQ_DEPTH_OVERRIDE,
+		DLB2_MAX_ENQ_DEPTH_OVERRIDE);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+
 static int
 set_max_num_events(const char *key __rte_unused,
 		   const char *value,
@@ -4514,6 +4544,15 @@ dlb2_primary_eventdev_probe(struct rte_eventdev *dev,
 
 	evdev_dlb2_default_info.max_event_port_dequeue_depth = dlb2->max_cq_depth;
 
+	if (dlb2_args->max_enq_depth != 0)
+		dlb2->max_enq_depth = dlb2_args->max_enq_depth;
+	else
+		dlb2->max_enq_depth = DLB2_DEFAULT_CQ_DEPTH;
+
+	evdev_dlb2_default_info.max_event_port_enqueue_depth =
+		dlb2->max_enq_depth;
+
+
 	err = dlb2_iface_open(&dlb2->qm_instance, name);
 	if (err < 0) {
 		DLB2_LOG_ERR("could not open event hardware device, err=%d\n",
@@ -4650,6 +4689,7 @@ dlb2_parse_params(const char *params,
 					     DLB2_DEPTH_THRESH_ARG,
 					     DLB2_VECTOR_OPTS_ENAB_ARG,
 					     DLB2_MAX_CQ_DEPTH,
+					     DLB2_MAX_ENQ_DEPTH,
 					     DLB2_CQ_WEIGHT,
 					     DLB2_PORT_COS,
 					     DLB2_COS_BW,
@@ -4789,6 +4829,17 @@ dlb2_parse_params(const char *params,
 				return ret;
 			}
 
+			ret = rte_kvargs_process(kvlist,
+						 DLB2_MAX_ENQ_DEPTH,
+						 set_max_enq_depth,
+						 &dlb2_args->max_enq_depth);
+			if (ret != 0) {
+				DLB2_LOG_ERR("%s: Error parsing vector opts enabled",
+					     name);
+				rte_kvargs_free(kvlist);
+				return ret;
+			}
+
 			ret = rte_kvargs_process(kvlist,
 					DLB2_CQ_WEIGHT,
 					set_cq_weight,
diff --git a/drivers/event/dlb2/dlb2_priv.h b/drivers/event/dlb2/dlb2_priv.h
index 8744efa79d..1edea83a5b 100644
--- a/drivers/event/dlb2/dlb2_priv.h
+++ b/drivers/event/dlb2/dlb2_priv.h
@@ -29,7 +29,10 @@
 #define DLB2_SW_CREDIT_C_QUANTA_DEFAULT 256 /* Consumer */
 #define DLB2_DEPTH_THRESH_DEFAULT 256
 #define DLB2_MIN_CQ_DEPTH_OVERRIDE 32
-#define DLB2_MAX_CQ_DEPTH_OVERRIDE 1024
+#define DLB2_MAX_CQ_DEPTH_OVERRIDE 128
+#define DLB2_MIN_ENQ_DEPTH_OVERRIDE 32
+#define DLB2_MAX_ENQ_DEPTH_OVERRIDE 1024
+
 
 /*  command line arg strings */
 #define NUMA_NODE_ARG "numa_node"
@@ -44,6 +47,7 @@
 #define DLB2_DEPTH_THRESH_ARG "default_depth_thresh"
 #define DLB2_VECTOR_OPTS_ENAB_ARG "vector_opts_enable"
 #define DLB2_MAX_CQ_DEPTH "max_cq_depth"
+#define DLB2_MAX_ENQ_DEPTH "max_enqueue_depth"
 #define DLB2_CQ_WEIGHT "cq_weight"
 #define DLB2_PORT_COS "port_cos"
 #define DLB2_COS_BW "cos_bw"
@@ -585,6 +589,7 @@ struct dlb2_eventdev {
 	int num_dir_credits_override;
 	bool vector_opts_enabled;
 	int max_cq_depth;
+	int max_enq_depth;
 	volatile enum dlb2_run_state run_state;
 	uint16_t num_dir_queues; /* total num of evdev dir queues requested */
 	union {
@@ -660,6 +665,7 @@ struct dlb2_devargs {
 	int default_depth_thresh;
 	bool vector_opts_enabled;
 	int max_cq_depth;
+	int max_enq_depth;
 	struct dlb2_cq_weight cq_weight;
 	struct dlb2_port_cos port_cos;
 	struct dlb2_cos_bw cos_bw;
diff --git a/drivers/event/dlb2/pf/dlb2_pf.c b/drivers/event/dlb2/pf/dlb2_pf.c
index 0627f06a6e..086d4a1cc7 100644
--- a/drivers/event/dlb2/pf/dlb2_pf.c
+++ b/drivers/event/dlb2/pf/dlb2_pf.c
@@ -708,7 +708,8 @@ dlb2_eventdev_pci_init(struct rte_eventdev *eventdev)
 		.sw_credit_quanta = DLB2_SW_CREDIT_QUANTA_DEFAULT,
 		.hw_credit_quanta = DLB2_SW_CREDIT_BATCH_SZ,
 		.default_depth_thresh = DLB2_DEPTH_THRESH_DEFAULT,
-		.max_cq_depth = DLB2_DEFAULT_CQ_DEPTH
+		.max_cq_depth = DLB2_DEFAULT_CQ_DEPTH,
+		.max_enq_depth = DLB2_MAX_ENQUEUE_DEPTH
 	};
 	struct dlb2_eventdev *dlb2;
 
-- 
2.25.1


  parent reply	other threads:[~2022-07-02 16:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-29 15:36 [PATCH 0/2] DLB2 Bug Fixes Timothy McDaniel
2022-06-29 15:36 ` [PATCH 1/2] event/dlb2: fix port_cos array sizing Timothy McDaniel
2022-06-29 15:36 ` [PATCH 2/2] event/dlb2: Fix initialization of cos bandwidth args Timothy McDaniel
2022-07-02 16:03 ` [PATCH v2 0/5] DLB2 Bug Fixes Timothy McDaniel
2022-07-02 16:03   ` [PATCH v2 1/5] event/dlb2: fix port_cos array sizing Timothy McDaniel
2022-07-02 16:03   ` [PATCH v2 2/5] event/dlb2: fix initialization of cos bandwidth args Timothy McDaniel
2022-07-02 16:03   ` [PATCH v2 3/5] event/dlb2: fix cq depth override Timothy McDaniel
2022-07-02 16:03   ` Timothy McDaniel [this message]
2022-07-02 16:03   ` [PATCH v2 5/5] event/dlb2: fix port COS initialization Timothy McDaniel
2022-07-02 16:22 ` [PATCH v3 0/5] DLB2 Bug Fixes Timothy McDaniel
2022-07-02 16:22   ` [PATCH v3 1/5] event/dlb2: fix port_cos array sizing Timothy McDaniel
2022-07-02 16:22   ` [PATCH v3 2/5] event/dlb2: fix initialization of cos bandwidth args Timothy McDaniel
2022-07-02 16:22   ` [PATCH v3 3/5] event/dlb2: fix cq depth override Timothy McDaniel
2022-07-02 16:22   ` [PATCH v3 4/5] event/dlb2: fix cq depth override credit deadlock Timothy McDaniel
2022-07-02 16:22   ` [PATCH v3 5/5] event/dlb2: fix port COS initialization Timothy McDaniel
2022-07-04 16:11     ` Jerin Jacob

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220702160340.1591058-5-timothy.mcdaniel@intel.com \
    --to=timothy.mcdaniel@intel.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).