pipeline: fix multiple emit pattern detection

Message ID 20201112145013.21778-1-cristian.dumitrescu@intel.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series pipeline: fix multiple emit pattern detection |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/travis-robot success Travis build: passed
ci/iol-mellanox-Performance success Performance Testing PASS

Commit Message

Cristian Dumitrescu Nov. 12, 2020, 2:50 p.m. UTC
  Fix the detection of instruction pattern with multiple emits followed
by TX. Once detected, this is one of the instruction patterns that is
internally replaced with a single optimized instruction, as long as
none of the instructions to be replaced is referenced by a jump
instruction. The fix enforces this check for the TX instruction of
the pattern.

Fixes: 31035e87b207 ("pipeline: add SWX instruction optimizer")

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 lib/librte_pipeline/rte_swx_pipeline.c | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

David Marchand Nov. 15, 2020, 3:59 p.m. UTC | #1
On Thu, Nov 12, 2020 at 3:50 PM Cristian Dumitrescu
<cristian.dumitrescu@intel.com> wrote:
>
> Fix the detection of instruction pattern with multiple emits followed
> by TX. Once detected, this is one of the instruction patterns that is
> internally replaced with a single optimized instruction, as long as
> none of the instructions to be replaced is referenced by a jump
> instruction. The fix enforces this check for the TX instruction of
> the pattern.
>
> Fixes: 31035e87b207 ("pipeline: add SWX instruction optimizer")
>
> Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>

Applied, thanks.
  

Patch

diff --git a/lib/librte_pipeline/rte_swx_pipeline.c b/lib/librte_pipeline/rte_swx_pipeline.c
index fe8bfc8b3..eaaed7a0a 100644
--- a/lib/librte_pipeline/rte_swx_pipeline.c
+++ b/lib/librte_pipeline/rte_swx_pipeline.c
@@ -5796,6 +5796,9 @@  instr_pattern_emit_many_tx_detect(struct instruction *instr,
 	if (instr[i].type != INSTR_TX)
 		return 0;
 
+	if (data[i].n_users)
+		return 0;
+
 	i++;
 
 	*n_pattern_instr = i;