app/compress-perf: fix floating point exception

Message ID 20190806103738.16224-1-adamx.dybkowski@intel.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series app/compress-perf: fix floating point exception |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-Compile-Testing success Compile Testing PASS
ci/intel-Performance-Testing fail Performance Testing issues
ci/Intel-compilation fail Compilation issues
ci/mellanox-Performance-Testing success Performance Testing PASS

Commit Message

Dybkowski, AdamX Aug. 6, 2019, 10:37 a.m. UTC
  This patch fixes the floating point exception that happened
when the number of cores to be used during the benchmark
was zero. After the fix such situation is detected, the error
message is printed and the benchmark application exits.

Fixes: 424dd6c8c1a8 ("app/compress-perf: add weak functions for multicore test")

Signed-off-by: Adam Dybkowski <adamx.dybkowski@intel.com>
---
 app/test-compress-perf/main.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
  

Comments

Artur Trybula Sept. 9, 2019, 2:03 p.m. UTC | #1
This patch fixes the floating point exception that happened when the number of cores to be used during the benchmark was zero. After the fix such situation is detected, the error message is printed and the benchmark application exits.

Fixes: 424dd6c8c1a8 ("app/compress-perf: add weak functions for multicore test")

Signed-off-by: Adam Dybkowski <adamx.dybkowski@intel.com>
Acked-by: Artur Trybula <arturx.trybula@intel.com>
---
  
Akhil Goyal Sept. 19, 2019, 2:52 p.m. UTC | #2
> 
> This patch fixes the floating point exception that happened
> when the number of cores to be used during the benchmark
> was zero. After the fix such situation is detected, the error
> message is printed and the benchmark application exits.
> 
> Fixes: 424dd6c8c1a8 ("app/compress-perf: add weak functions for multicore
> test")
> 
> Signed-off-by: Adam Dybkowski <adamx.dybkowski@intel.com>
> ---
Applied to dpdk-next-crypto

Thanks.
  

Patch

diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
index e7ac412e6..6f095b548 100644
--- a/app/test-compress-perf/main.c
+++ b/app/test-compress-perf/main.c
@@ -127,9 +127,13 @@  comp_perf_initialize_compressdev(struct comp_test_data *test_data,
 	 * if there are more available than cores.
 	 */
 	if (enabled_cdev_count > nb_lcores) {
+		if (nb_lcores == 0) {
+			RTE_LOG(ERR, USER1, "Cannot run with 0 cores! Increase the number of cores\n");
+			return -EINVAL;
+		}
 		enabled_cdev_count = nb_lcores;
 		RTE_LOG(INFO, USER1,
-			" There's more available devices than cores!"
+			"There's more available devices than cores!"
 			" The number of devices has been aligned to %d cores\n",
 			nb_lcores);
 	}