|
620 | 620 |
|
621 | 621 | /* optional macro to add sleep between tests */
|
622 | 622 | #ifndef TEST_SLEEP
|
623 |
| - /* stub the sleep macro */ |
624 |
| - #define TEST_SLEEP() WC_DO_NOTHING |
| 623 | + #define TEST_SLEEP() WC_RELAX_LONG_LOOP() |
625 | 624 | #endif
|
626 | 625 |
|
627 | 626 | #define TEST_STRING "Everyone gets Friday off."
|
@@ -2347,10 +2346,18 @@ static WC_INLINE void bench_stats_start(int* count, double* start)
|
2347 | 2346 | #ifdef WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS
|
2348 | 2347 | #define bench_stats_start(count, start) do { \
|
2349 | 2348 | SAVE_VECTOR_REGISTERS(pr_err( \
|
2350 |
| - "SAVE_VECTOR_REGISTERS failed for benchmark run."); \ |
| 2349 | + "ERROR: SAVE_VECTOR_REGISTERS failed for benchmark run."); \ |
2351 | 2350 | return; ); \
|
2352 | 2351 | bench_stats_start(count, start); \
|
2353 | 2352 | } while (0)
|
| 2353 | +#elif defined(WOLFSSL_LINUXKM) |
| 2354 | + /* we're using floating point to figure the statistics, so we need to |
| 2355 | + * FPU save+lock even without SIMD. |
| 2356 | + */ |
| 2357 | + #define bench_stats_start(count, start) do { \ |
| 2358 | + kernel_fpu_begin(); \ |
| 2359 | + bench_stats_start(count, start); \ |
| 2360 | + } while (0) |
2354 | 2361 | #endif
|
2355 | 2362 |
|
2356 | 2363 | static WC_INLINE int bench_stats_check(double start)
|
@@ -2543,8 +2550,6 @@ static void bench_stats_sym_finish(const char* desc, int useDeviceID,
|
2543 | 2550 |
|
2544 | 2551 | total = current_time(0) - start;
|
2545 | 2552 |
|
2546 |
| - WC_RELAX_LONG_LOOP(); |
2547 |
| - |
2548 | 2553 | #if defined(WOLFSSL_ESPIDF) && defined(DEBUG_WOLFSSL_BENCHMARK_TIMING)
|
2549 | 2554 | ESP_LOGI(TAG, "%s total_cycles = %llu", desc, total_cycles);
|
2550 | 2555 | #endif
|
@@ -2743,6 +2748,8 @@ static void bench_stats_sym_finish(const char* desc, int useDeviceID,
|
2743 | 2748 |
|
2744 | 2749 | #ifdef WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS
|
2745 | 2750 | RESTORE_VECTOR_REGISTERS();
|
| 2751 | +#elif defined(WOLFSSL_LINUXKM) |
| 2752 | + kernel_fpu_end(); |
2746 | 2753 | #endif
|
2747 | 2754 |
|
2748 | 2755 | TEST_SLEEP();
|
@@ -2775,8 +2782,6 @@ static void bench_stats_asym_finish_ex(const char* algo, int strength,
|
2775 | 2782 |
|
2776 | 2783 | total = current_time(0) - start;
|
2777 | 2784 |
|
2778 |
| - WC_RELAX_LONG_LOOP(); |
2779 |
| - |
2780 | 2785 | #ifdef LINUX_RUSAGE_UTIME
|
2781 | 2786 | check_for_excessive_stime(algo, strength, desc, desc_extra);
|
2782 | 2787 | #endif
|
@@ -3006,6 +3011,8 @@ static void bench_stats_asym_finish_ex(const char* algo, int strength,
|
3006 | 3011 |
|
3007 | 3012 | #ifdef WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS
|
3008 | 3013 | RESTORE_VECTOR_REGISTERS();
|
| 3014 | +#elif defined(WOLFSSL_LINUXKM) |
| 3015 | + kernel_fpu_end(); |
3009 | 3016 | #endif
|
3010 | 3017 |
|
3011 | 3018 | TEST_SLEEP();
|
|
0 commit comments