patch 'dma/idxd: fix AVX2 in non-datapath functions' has been queued to stable release 21.11.2

Kevin Traynor ktraynor at redhat.com
Tue Jun 28 17:19:15 CEST 2022


Hi,

FYI, your patch has been queued to stable release 21.11.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 06/30/22. 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/d6e109f8aaac7b80ae2ba3a43419ae63739ac4d6

Thanks.

Kevin

---
>From d6e109f8aaac7b80ae2ba3a43419ae63739ac4d6 Mon Sep 17 00:00:00 2001
From: Bruce Richardson <bruce.richardson at intel.com>
Date: Fri, 17 Jun 2022 11:59:20 +0100
Subject: [PATCH] dma/idxd: fix AVX2 in non-datapath functions

[ upstream commit aa802b10237c2f7d3b0d0498de9b2fb438f9b9a2 ]

While all systems which will use the idxd driver for hardware will
support AVX2, if the driver is present the initialization functions e.g.
to register logs, will be called on all systems - irrespective of HW
support. This can cause issues if the system running DPDK does not have
AVX2, and the compiler has included AVX instructions in the
initialization code.

To fix this, remove AVX2 instruction set from the whole build of the
driver. Instead, we add "target(avx2)" attribute to all datapath
functions, so those - and only those functions - will having AVX2
instructions in them.

Bugzilla ID: 1038
Fixes: 3d36a0a1c7de ("dma/idxd: add data path job submission")

Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
Acked-by: Conor Walsh <conor.walsh at intel.com>
---
 drivers/dma/idxd/idxd_common.c | 23 +++++++++++++++++++++++
 drivers/dma/idxd/meson.build   |  1 -
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/idxd/idxd_common.c b/drivers/dma/idxd/idxd_common.c
index ea6413cc7a..c77200a457 100644
--- a/drivers/dma/idxd/idxd_common.c
+++ b/drivers/dma/idxd/idxd_common.c
@@ -14,4 +14,14 @@
 #define IDXD_PMD_NAME_STR "dmadev_idxd"
 
+/* systems with DSA all support AVX2 so allow our data-path functions to
+ * always use at least that instruction set
+ */
+#ifndef __AVX2__
+#define __use_avx2 __attribute__((target("avx2")))
+#else
+#define __use_avx2
+#endif
+
+__use_avx2
 static __rte_always_inline rte_iova_t
 __desc_idx_to_iova(struct idxd_dmadev *idxd, uint16_t n)
@@ -20,4 +30,5 @@ __desc_idx_to_iova(struct idxd_dmadev *idxd, uint16_t n)
 }
 
+__use_avx2
 static __rte_always_inline void
 __idxd_movdir64b(volatile void *dst, const struct idxd_hw_desc *src)
@@ -29,4 +40,5 @@ __idxd_movdir64b(volatile void *dst, const struct idxd_hw_desc *src)
 }
 
+__use_avx2
 static __rte_always_inline void
 __submit(struct idxd_dmadev *idxd)
@@ -75,4 +87,5 @@ __submit(struct idxd_dmadev *idxd)
 }
 
+__use_avx2
 static __rte_always_inline int
 __idxd_write_desc(struct idxd_dmadev *idxd,
@@ -113,4 +126,5 @@ __idxd_write_desc(struct idxd_dmadev *idxd,
 }
 
+__use_avx2
 int
 idxd_enqueue_copy(void *dev_private, uint16_t qid __rte_unused, rte_iova_t src,
@@ -127,4 +141,5 @@ idxd_enqueue_copy(void *dev_private, uint16_t qid __rte_unused, rte_iova_t src,
 }
 
+__use_avx2
 int
 idxd_enqueue_fill(void *dev_private, uint16_t qid __rte_unused, uint64_t pattern,
@@ -137,4 +152,5 @@ idxd_enqueue_fill(void *dev_private, uint16_t qid __rte_unused, uint64_t pattern
 }
 
+__use_avx2
 int
 idxd_submit(void *dev_private, uint16_t qid __rte_unused)
@@ -144,4 +160,5 @@ idxd_submit(void *dev_private, uint16_t qid __rte_unused)
 }
 
+__use_avx2
 static enum rte_dma_status_code
 get_comp_status(struct idxd_completion *c)
@@ -164,4 +181,5 @@ get_comp_status(struct idxd_completion *c)
 }
 
+__use_avx2
 int
 idxd_vchan_status(const struct rte_dma_dev *dev, uint16_t vchan __rte_unused,
@@ -181,4 +199,5 @@ idxd_vchan_status(const struct rte_dma_dev *dev, uint16_t vchan __rte_unused,
 }
 
+__use_avx2
 static __rte_always_inline int
 batch_ok(struct idxd_dmadev *idxd, uint16_t max_ops, enum rte_dma_status_code *status)
@@ -225,4 +244,5 @@ batch_ok(struct idxd_dmadev *idxd, uint16_t max_ops, enum rte_dma_status_code *s
 }
 
+__use_avx2
 static inline uint16_t
 batch_completed(struct idxd_dmadev *idxd, uint16_t max_ops, bool *has_error)
@@ -276,4 +296,5 @@ batch_completed(struct idxd_dmadev *idxd, uint16_t max_ops, bool *has_error)
 }
 
+__use_avx2
 static uint16_t
 batch_completed_status(struct idxd_dmadev *idxd, uint16_t max_ops, enum rte_dma_status_code *status)
@@ -367,4 +388,5 @@ batch_completed_status(struct idxd_dmadev *idxd, uint16_t max_ops, enum rte_dma_
 }
 
+__use_avx2
 uint16_t
 idxd_completed(void *dev_private, uint16_t qid __rte_unused, uint16_t max_ops,
@@ -384,4 +406,5 @@ idxd_completed(void *dev_private, uint16_t qid __rte_unused, uint16_t max_ops,
 }
 
+__use_avx2
 uint16_t
 idxd_completed_status(void *dev_private, uint16_t qid __rte_unused, uint16_t max_ops,
diff --git a/drivers/dma/idxd/meson.build b/drivers/dma/idxd/meson.build
index f1396be945..dcc0a297d7 100644
--- a/drivers/dma/idxd/meson.build
+++ b/drivers/dma/idxd/meson.build
@@ -6,5 +6,4 @@ reason = 'only supported on x86'
 
 deps += ['bus_pci']
-cflags += '-mavx2' # all platforms with idxd HW support AVX
 sources = files(
         'idxd_common.c',
-- 
2.34.3

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-06-28 16:18:04.131063251 +0100
+++ 0003-dma-idxd-fix-AVX2-in-non-datapath-functions.patch	2022-06-28 16:18:03.998387177 +0100
@@ -1 +1 @@
-From aa802b10237c2f7d3b0d0498de9b2fb438f9b9a2 Mon Sep 17 00:00:00 2001
+From d6e109f8aaac7b80ae2ba3a43419ae63739ac4d6 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit aa802b10237c2f7d3b0d0498de9b2fb438f9b9a2 ]
+
@@ -20 +21,0 @@
-Cc: stable at dpdk.org



More information about the stable mailing list