diff options
author | Yongxin Liu <yongxin.liu@windriver.com> | 2022-07-11 14:46:00 +0800 |
---|---|---|
committer | Anuj Mittal <anuj.mittal@intel.com> | 2022-07-13 17:11:28 +0800 |
commit | b06ab02b695041011a6bb9ed02f7a50e1e8c064d (patch) | |
tree | b717747c4ee7105890c22b3ba904a459daa66280 | |
parent | 09098721b1c78ee812ee287f6b366a47f4b5be87 (diff) | |
download | meta-dpdk-b06ab02b695041011a6bb9ed02f7a50e1e8c064d.tar.gz |
dpdk/21.11: fix illegal instruction on non-AVX CPU
Backport a patch from main branch to fix illegal instruction
issue on CPU which has no AVX instructions.
Reference:
https://bugs.dpdk.org/show_bug.cgi?id=1038
Signed-off-by: Yongxin Liu <yongxin.liu@windriver.com>
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
-rw-r--r-- | recipes-extended/dpdk/dpdk/0002-dma-idxd-fix-AVX2-in-non-datapath-functions.patch | 171 | ||||
-rw-r--r-- | recipes-extended/dpdk/dpdk_21.11.1.bb | 1 |
2 files changed, 172 insertions, 0 deletions
diff --git a/recipes-extended/dpdk/dpdk/0002-dma-idxd-fix-AVX2-in-non-datapath-functions.patch b/recipes-extended/dpdk/dpdk/0002-dma-idxd-fix-AVX2-in-non-datapath-functions.patch new file mode 100644 index 0000000..4cd5164 --- /dev/null +++ b/recipes-extended/dpdk/dpdk/0002-dma-idxd-fix-AVX2-in-non-datapath-functions.patch | |||
@@ -0,0 +1,171 @@ | |||
1 | From aa802b10237c2f7d3b0d0498de9b2fb438f9b9a2 Mon Sep 17 00:00:00 2001 | ||
2 | From: Bruce Richardson <bruce.richardson@intel.com> | ||
3 | Date: Fri, 17 Jun 2022 11:59:20 +0100 | ||
4 | Subject: [PATCH] dma/idxd: fix AVX2 in non-datapath functions | ||
5 | |||
6 | While all systems which will use the idxd driver for hardware will | ||
7 | support AVX2, if the driver is present the initialization functions e.g. | ||
8 | to register logs, will be called on all systems - irrespective of HW | ||
9 | support. This can cause issues if the system running DPDK does not have | ||
10 | AVX2, and the compiler has included AVX instructions in the | ||
11 | initialization code. | ||
12 | |||
13 | To fix this, remove AVX2 instruction set from the whole build of the | ||
14 | driver. Instead, we add "target(avx2)" attribute to all datapath | ||
15 | functions, so those - and only those functions - will having AVX2 | ||
16 | instructions in them. | ||
17 | |||
18 | Bugzilla ID: 1038 | ||
19 | Fixes: 3d36a0a1c7de ("dma/idxd: add data path job submission") | ||
20 | Cc: stable@dpdk.org | ||
21 | |||
22 | Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> | ||
23 | Acked-by: Conor Walsh <conor.walsh@intel.com> | ||
24 | |||
25 | Upstream-Status: Backport [http://git.dpdk.org/dpdk/commit/?id=aa802b10237c2f7d3b0d0498de9b2fb438f9b9a2] | ||
26 | |||
27 | Signed-off-by: Yongxin Liu <yongxin.liu@windriver.com> | ||
28 | --- | ||
29 | drivers/dma/idxd/idxd_common.c | 23 +++++++++++++++++++++++ | ||
30 | drivers/dma/idxd/meson.build | 1 - | ||
31 | 2 files changed, 23 insertions(+), 1 deletion(-) | ||
32 | |||
33 | diff --git a/drivers/dma/idxd/idxd_common.c b/drivers/dma/idxd/idxd_common.c | ||
34 | index ea6413cc7a..c77200a457 100644 | ||
35 | --- a/drivers/dma/idxd/idxd_common.c | ||
36 | +++ b/drivers/dma/idxd/idxd_common.c | ||
37 | @@ -13,12 +13,23 @@ | ||
38 | |||
39 | #define IDXD_PMD_NAME_STR "dmadev_idxd" | ||
40 | |||
41 | +/* systems with DSA all support AVX2 so allow our data-path functions to | ||
42 | + * always use at least that instruction set | ||
43 | + */ | ||
44 | +#ifndef __AVX2__ | ||
45 | +#define __use_avx2 __attribute__((target("avx2"))) | ||
46 | +#else | ||
47 | +#define __use_avx2 | ||
48 | +#endif | ||
49 | + | ||
50 | +__use_avx2 | ||
51 | static __rte_always_inline rte_iova_t | ||
52 | __desc_idx_to_iova(struct idxd_dmadev *idxd, uint16_t n) | ||
53 | { | ||
54 | return idxd->desc_iova + (n * sizeof(struct idxd_hw_desc)); | ||
55 | } | ||
56 | |||
57 | +__use_avx2 | ||
58 | static __rte_always_inline void | ||
59 | __idxd_movdir64b(volatile void *dst, const struct idxd_hw_desc *src) | ||
60 | { | ||
61 | @@ -28,6 +39,7 @@ __idxd_movdir64b(volatile void *dst, const struct idxd_hw_desc *src) | ||
62 | : "memory"); | ||
63 | } | ||
64 | |||
65 | +__use_avx2 | ||
66 | static __rte_always_inline void | ||
67 | __submit(struct idxd_dmadev *idxd) | ||
68 | { | ||
69 | @@ -74,6 +86,7 @@ __submit(struct idxd_dmadev *idxd) | ||
70 | _mm256_setzero_si256()); | ||
71 | } | ||
72 | |||
73 | +__use_avx2 | ||
74 | static __rte_always_inline int | ||
75 | __idxd_write_desc(struct idxd_dmadev *idxd, | ||
76 | const uint32_t op_flags, | ||
77 | @@ -112,6 +125,7 @@ __idxd_write_desc(struct idxd_dmadev *idxd, | ||
78 | return job_id; | ||
79 | } | ||
80 | |||
81 | +__use_avx2 | ||
82 | int | ||
83 | idxd_enqueue_copy(void *dev_private, uint16_t qid __rte_unused, rte_iova_t src, | ||
84 | rte_iova_t dst, unsigned int length, uint64_t flags) | ||
85 | @@ -126,6 +140,7 @@ idxd_enqueue_copy(void *dev_private, uint16_t qid __rte_unused, rte_iova_t src, | ||
86 | flags); | ||
87 | } | ||
88 | |||
89 | +__use_avx2 | ||
90 | int | ||
91 | idxd_enqueue_fill(void *dev_private, uint16_t qid __rte_unused, uint64_t pattern, | ||
92 | rte_iova_t dst, unsigned int length, uint64_t flags) | ||
93 | @@ -136,6 +151,7 @@ idxd_enqueue_fill(void *dev_private, uint16_t qid __rte_unused, uint64_t pattern | ||
94 | flags); | ||
95 | } | ||
96 | |||
97 | +__use_avx2 | ||
98 | int | ||
99 | idxd_submit(void *dev_private, uint16_t qid __rte_unused) | ||
100 | { | ||
101 | @@ -143,6 +159,7 @@ idxd_submit(void *dev_private, uint16_t qid __rte_unused) | ||
102 | return 0; | ||
103 | } | ||
104 | |||
105 | +__use_avx2 | ||
106 | static enum rte_dma_status_code | ||
107 | get_comp_status(struct idxd_completion *c) | ||
108 | { | ||
109 | @@ -163,6 +180,7 @@ get_comp_status(struct idxd_completion *c) | ||
110 | } | ||
111 | } | ||
112 | |||
113 | +__use_avx2 | ||
114 | int | ||
115 | idxd_vchan_status(const struct rte_dma_dev *dev, uint16_t vchan __rte_unused, | ||
116 | enum rte_dma_vchan_status *status) | ||
117 | @@ -180,6 +198,7 @@ idxd_vchan_status(const struct rte_dma_dev *dev, uint16_t vchan __rte_unused, | ||
118 | return 0; | ||
119 | } | ||
120 | |||
121 | +__use_avx2 | ||
122 | static __rte_always_inline int | ||
123 | batch_ok(struct idxd_dmadev *idxd, uint16_t max_ops, enum rte_dma_status_code *status) | ||
124 | { | ||
125 | @@ -224,6 +243,7 @@ batch_ok(struct idxd_dmadev *idxd, uint16_t max_ops, enum rte_dma_status_code *s | ||
126 | return -1; /* error case */ | ||
127 | } | ||
128 | |||
129 | +__use_avx2 | ||
130 | static inline uint16_t | ||
131 | batch_completed(struct idxd_dmadev *idxd, uint16_t max_ops, bool *has_error) | ||
132 | { | ||
133 | @@ -275,6 +295,7 @@ batch_completed(struct idxd_dmadev *idxd, uint16_t max_ops, bool *has_error) | ||
134 | return ret; | ||
135 | } | ||
136 | |||
137 | +__use_avx2 | ||
138 | static uint16_t | ||
139 | batch_completed_status(struct idxd_dmadev *idxd, uint16_t max_ops, enum rte_dma_status_code *status) | ||
140 | { | ||
141 | @@ -366,6 +387,7 @@ batch_completed_status(struct idxd_dmadev *idxd, uint16_t max_ops, enum rte_dma_ | ||
142 | return ret; | ||
143 | } | ||
144 | |||
145 | +__use_avx2 | ||
146 | uint16_t | ||
147 | idxd_completed(void *dev_private, uint16_t qid __rte_unused, uint16_t max_ops, | ||
148 | uint16_t *last_idx, bool *has_error) | ||
149 | @@ -383,6 +405,7 @@ idxd_completed(void *dev_private, uint16_t qid __rte_unused, uint16_t max_ops, | ||
150 | return ret; | ||
151 | } | ||
152 | |||
153 | +__use_avx2 | ||
154 | uint16_t | ||
155 | idxd_completed_status(void *dev_private, uint16_t qid __rte_unused, uint16_t max_ops, | ||
156 | uint16_t *last_idx, enum rte_dma_status_code *status) | ||
157 | diff --git a/drivers/dma/idxd/meson.build b/drivers/dma/idxd/meson.build | ||
158 | index f1396be945..dcc0a297d7 100644 | ||
159 | --- a/drivers/dma/idxd/meson.build | ||
160 | +++ b/drivers/dma/idxd/meson.build | ||
161 | @@ -5,7 +5,6 @@ build = dpdk_conf.has('RTE_ARCH_X86') | ||
162 | reason = 'only supported on x86' | ||
163 | |||
164 | deps += ['bus_pci'] | ||
165 | -cflags += '-mavx2' # all platforms with idxd HW support AVX | ||
166 | sources = files( | ||
167 | 'idxd_common.c', | ||
168 | 'idxd_pci.c', | ||
169 | -- | ||
170 | 2.32.0 | ||
171 | |||
diff --git a/recipes-extended/dpdk/dpdk_21.11.1.bb b/recipes-extended/dpdk/dpdk_21.11.1.bb index f0d7f74..a54fc85 100644 --- a/recipes-extended/dpdk/dpdk_21.11.1.bb +++ b/recipes-extended/dpdk/dpdk_21.11.1.bb | |||
@@ -2,6 +2,7 @@ include dpdk.inc | |||
2 | 2 | ||
3 | SRC_URI += " \ | 3 | SRC_URI += " \ |
4 | file://0001-meson.build-march-and-mcpu-already-passed-by-Yocto-21.11.patch \ | 4 | file://0001-meson.build-march-and-mcpu-already-passed-by-Yocto-21.11.patch \ |
5 | file://0002-dma-idxd-fix-AVX2-in-non-datapath-functions.patch \ | ||
5 | " | 6 | " |
6 | 7 | ||
7 | STABLE = "-stable" | 8 | STABLE = "-stable" |