[dpdk-dev] [PATCH v1 03/30] bus/dpaa: remove un-necessary thread affinity

Sachin Saxena sachin.saxena at nxp.com
Tue Aug 27 09:07:03 CEST 2019


From: Nipun Gupta <nipun.gupta at nxp.com>

Thread affinity is already taken care by DPDK. Remove them from bus.

Signed-off-by: Nipun Gupta <nipun.gupta at nxp.com>
---
 drivers/bus/dpaa/base/qbman/qman_driver.c | 56 ++---------------------
 drivers/bus/dpaa/dpaa_bus.c               | 13 ------
 2 files changed, 3 insertions(+), 66 deletions(-)

diff --git a/drivers/bus/dpaa/base/qbman/qman_driver.c b/drivers/bus/dpaa/base/qbman/qman_driver.c
index ba153396d..5c773669a 100644
--- a/drivers/bus/dpaa/base/qbman/qman_driver.c
+++ b/drivers/bus/dpaa/base/qbman/qman_driver.c
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
  *
  * Copyright 2008-2016 Freescale Semiconductor Inc.
- * Copyright 2017 NXP
+ * Copyright 2017,2019 NXP
  *
  */
 
@@ -32,31 +32,9 @@ static __thread struct dpaa_ioctl_portal_map map = {
 
 static int fsl_qman_portal_init(uint32_t index, int is_shared)
 {
-	cpu_set_t cpuset;
 	struct qman_portal *portal;
-	int loop, ret;
 	struct dpaa_ioctl_irq_map irq_map;
-
-	/* Verify the thread's cpu-affinity */
-	ret = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t),
-				     &cpuset);
-	if (ret) {
-		error(0, ret, "pthread_getaffinity_np()");
-		return ret;
-	}
-	qpcfg.cpu = -1;
-	for (loop = 0; loop < CPU_SETSIZE; loop++)
-		if (CPU_ISSET(loop, &cpuset)) {
-			if (qpcfg.cpu != -1) {
-				pr_err("Thread is not affine to 1 cpu\n");
-				return -EINVAL;
-			}
-			qpcfg.cpu = loop;
-		}
-	if (qpcfg.cpu == -1) {
-		pr_err("Bug in getaffinity handling!\n");
-		return -EINVAL;
-	}
+	int ret;
 
 	/* Allocate and map a qman portal */
 	map.index = index;
@@ -145,14 +123,11 @@ void qman_thread_irq(void)
 
 struct qman_portal *fsl_qman_portal_create(void)
 {
-	cpu_set_t cpuset;
 	struct qman_portal *res;
-
 	struct qm_portal_config *q_pcfg;
-	int loop, ret;
 	struct dpaa_ioctl_irq_map irq_map;
 	struct dpaa_ioctl_portal_map q_map = {0};
-	int q_fd;
+	int q_fd, ret;
 
 	q_pcfg = kzalloc((sizeof(struct qm_portal_config)), 0);
 	if (!q_pcfg) {
@@ -160,31 +135,6 @@ struct qman_portal *fsl_qman_portal_create(void)
 		return NULL;
 	}
 
-	/* Verify the thread's cpu-affinity */
-	ret = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t),
-				     &cpuset);
-	if (ret) {
-		error(0, ret, "pthread_getaffinity_np()");
-		kfree(q_pcfg);
-		return NULL;
-	}
-
-	q_pcfg->cpu = -1;
-	for (loop = 0; loop < CPU_SETSIZE; loop++)
-		if (CPU_ISSET(loop, &cpuset)) {
-			if (q_pcfg->cpu != -1) {
-				pr_err("Thread is not affine to 1 cpu\n");
-				kfree(q_pcfg);
-				return NULL;
-			}
-			q_pcfg->cpu = loop;
-		}
-	if (q_pcfg->cpu == -1) {
-		pr_err("Bug in getaffinity handling!\n");
-		kfree(q_pcfg);
-		return NULL;
-	}
-
 	/* Allocate and map a qman portal */
 	q_map.type = dpaa_portal_qman;
 	q_map.index = QBMAN_ANY_PORTAL_IDX;
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index f7d1a5b63..b0e68c4a4 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -250,11 +250,9 @@ dpaa_clean_device_list(void)
 
 int rte_dpaa_portal_init(void *arg)
 {
-	pthread_t id;
 	unsigned int cpu, lcore = rte_lcore_id();
 	int ret;
 	struct dpaa_portal *dpaa_io_portal;
-	rte_cpuset_t cpuset;
 
 	BUS_INIT_FUNC_TRACE();
 
@@ -266,17 +264,6 @@ int rte_dpaa_portal_init(void *arg)
 
 	cpu = rte_lcore_to_cpu_id(lcore);
 
-	/* Set CPU affinity for this thread.*/
-	id = pthread_self();
-	cpuset = rte_lcore_cpuset(lcore);
-	ret = pthread_setaffinity_np(id, sizeof(cpu_set_t),
-				     &cpuset);
-	if (ret) {
-		DPAA_BUS_LOG(ERR, "pthread_setaffinity_np failed on core :%u"
-			     " (lcore=%u) with ret: %d", cpu, lcore, ret);
-		return ret;
-	}
-
 	/* Initialise bman thread portals */
 	ret = bman_thread_init();
 	if (ret) {
-- 
2.17.1



More information about the dev mailing list