diff options
Diffstat (limited to 'patches/boot_time_opt/0117-raid6-add-Kconfig-option-to-skip-raid6-benchmarking.patch')
| -rw-r--r-- | patches/boot_time_opt/0117-raid6-add-Kconfig-option-to-skip-raid6-benchmarking.patch | 156 |
1 files changed, 156 insertions, 0 deletions
diff --git a/patches/boot_time_opt/0117-raid6-add-Kconfig-option-to-skip-raid6-benchmarking.patch b/patches/boot_time_opt/0117-raid6-add-Kconfig-option-to-skip-raid6-benchmarking.patch new file mode 100644 index 0000000..978e09f --- /dev/null +++ b/patches/boot_time_opt/0117-raid6-add-Kconfig-option-to-skip-raid6-benchmarking.patch | |||
| @@ -0,0 +1,156 @@ | |||
| 1 | From fd1f55138c242bd9aeec374ff611064bdc89b359 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Jim Kukunas <james.t.kukunas@linux.intel.com> | ||
| 3 | Date: Fri, 27 May 2016 09:26:51 -0400 | ||
| 4 | Subject: [PATCH 117/124] raid6: add Kconfig option to skip raid6 benchmarking | ||
| 5 | |||
| 6 | Adds CONFIG_RAID6_FORCE_ALGO, which causes the kernel to not benchmark | ||
| 7 | each raid recovery and syndrome generation algorithm, and instead use | ||
| 8 | the version selected via Kconfig (CONFIG_RAID6_FORCE_{INT,SSSE3,AVX2}). | ||
| 9 | In the case, the selected algorithm is not supported by the processor at | ||
| 10 | runtime, a fallback is used. | ||
| 11 | |||
| 12 | Signed-off-by: Jim Kukunas <james.t.kukunas@linux.intel.com> | ||
| 13 | --- | ||
| 14 | lib/Kconfig | 3 +-- | ||
| 15 | lib/raid6/Kconfig | 38 ++++++++++++++++++++++++++++++++++++ | ||
| 16 | lib/raid6/algos.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
| 17 | 3 files changed, 97 insertions(+), 2 deletions(-) | ||
| 18 | create mode 100644 lib/raid6/Kconfig | ||
| 19 | |||
| 20 | diff --git a/lib/Kconfig b/lib/Kconfig | ||
| 21 | index 260a80e313b9..b3efd21db2fd 100644 | ||
| 22 | --- a/lib/Kconfig | ||
| 23 | +++ b/lib/Kconfig | ||
| 24 | @@ -7,8 +7,7 @@ config BINARY_PRINTF | ||
| 25 | |||
| 26 | menu "Library routines" | ||
| 27 | |||
| 28 | -config RAID6_PQ | ||
| 29 | - tristate | ||
| 30 | +source "lib/raid6/Kconfig" | ||
| 31 | |||
| 32 | config BITREVERSE | ||
| 33 | tristate | ||
| 34 | diff --git a/lib/raid6/Kconfig b/lib/raid6/Kconfig | ||
| 35 | new file mode 100644 | ||
| 36 | index 000000000000..d881d6be89bb | ||
| 37 | --- /dev/null | ||
| 38 | +++ b/lib/raid6/Kconfig | ||
| 39 | @@ -0,0 +1,38 @@ | ||
| 40 | +menu "RAID 6" | ||
| 41 | + | ||
| 42 | +config RAID6_PQ | ||
| 43 | + tristate | ||
| 44 | + | ||
| 45 | +config RAID6_FORCE_ALGO | ||
| 46 | + bool "Always use specified recovery algorithm" | ||
| 47 | + default n | ||
| 48 | + depends on RAID6_PQ | ||
| 49 | + help | ||
| 50 | + If this option is not set, on every boot the kernel will | ||
| 51 | + benchmark each optimized version of the RAID6 recovery and | ||
| 52 | + syndrome generation algorithms and will select the one that | ||
| 53 | + performs best. Microbenchmarking each version negatively | ||
| 54 | + affects boot time. | ||
| 55 | + | ||
| 56 | + Enabling this option skips the benchmark at boot, and | ||
| 57 | + instead always uses the algorithm selected. The only exception | ||
| 58 | + is if the selected algorithm relies on a cpu feature not | ||
| 59 | + supported at runtime. In this case, one of the lower performance | ||
| 60 | + fallbacks are used. | ||
| 61 | + | ||
| 62 | +choice | ||
| 63 | + prompt "RAID6 Recovery Algorithm" | ||
| 64 | + default RAID6_FORCE_INT | ||
| 65 | + depends on RAID6_FORCE_ALGO | ||
| 66 | + ---help--- | ||
| 67 | + Select the RAID6 recovery algorithm to unconditionally use | ||
| 68 | + | ||
| 69 | + config RAID6_FORCE_INT | ||
| 70 | + bool "Reference Implementation" | ||
| 71 | + config RAID6_FORCE_SSSE3 | ||
| 72 | + bool "SSSE3" | ||
| 73 | + config RAID6_FORCE_AVX2 | ||
| 74 | + bool "AVX2" | ||
| 75 | +endchoice | ||
| 76 | + | ||
| 77 | +endmenu | ||
| 78 | diff --git a/lib/raid6/algos.c b/lib/raid6/algos.c | ||
| 79 | index 7857049fd7d3..29332d2a04a5 100644 | ||
| 80 | --- a/lib/raid6/algos.c | ||
| 81 | +++ b/lib/raid6/algos.c | ||
| 82 | @@ -125,6 +125,63 @@ const struct raid6_recov_calls *const raid6_recov_algos[] = { | ||
| 83 | #define time_before(x, y) ((x) < (y)) | ||
| 84 | #endif | ||
| 85 | |||
| 86 | +#ifdef CONFIG_RAID6_FORCE_ALGO | ||
| 87 | +/* TODO don't compile in algos that will never be used */ | ||
| 88 | +int __init raid6_select_algo(void) | ||
| 89 | +{ | ||
| 90 | + const struct raid6_recov_calls *recov_fallback = &raid6_recov_intx1; | ||
| 91 | + const struct raid6_recov_calls *recov_algo; | ||
| 92 | + const struct raid6_calls *gen_fallback; | ||
| 93 | + const struct raid6_calls *gen_algo; | ||
| 94 | + | ||
| 95 | +#if defined(__i386__) | ||
| 96 | + gen_fallback = &raid6_intx32; | ||
| 97 | +#elif defined(__x86_64__) | ||
| 98 | + gen_fallback = &raid6_sse2x2; | ||
| 99 | +#else | ||
| 100 | +# error "TODO" | ||
| 101 | +#endif | ||
| 102 | + | ||
| 103 | +#if defined(CONFIG_RAID6_FORCE_INT) | ||
| 104 | + recov_algo = &raid6_recov_intx1; | ||
| 105 | + gen_algo = &raid6_intx32; | ||
| 106 | + | ||
| 107 | +#elif defined(CONFIG_RAID6_FORCE_SSSE3) | ||
| 108 | + recov_algo = &raid6_recov_ssse3; | ||
| 109 | +#if defined(__i386__) | ||
| 110 | + gen_algo = &raid6_sse2x2; | ||
| 111 | +#else | ||
| 112 | + gen_algo = &raid6_sse2x4; | ||
| 113 | +#endif | ||
| 114 | + | ||
| 115 | +#elif defined(CONFIG_RAID6_FORCE_AVX2) | ||
| 116 | + recov_algo = &raid6_recov_avx2; | ||
| 117 | + | ||
| 118 | +#if defined(__i386__) | ||
| 119 | + gen_algo = &raid6_avx2x2; | ||
| 120 | +#else | ||
| 121 | + gen_algo = &raid6_avx2x4; | ||
| 122 | +#endif | ||
| 123 | + | ||
| 124 | +#else | ||
| 125 | +#error "RAID6 Forced Recov Algo: Unsupported selection" | ||
| 126 | +#endif | ||
| 127 | + | ||
| 128 | + if (recov_algo->valid != NULL && recov_algo->valid() == 0) | ||
| 129 | + recov_algo = recov_fallback; | ||
| 130 | + | ||
| 131 | + pr_info("raid6: Forced to use recovery algorithm %s\n", recov_algo->name); | ||
| 132 | + | ||
| 133 | + raid6_2data_recov = recov_algo->data2; | ||
| 134 | + raid6_datap_recov = recov_algo->datap; | ||
| 135 | + | ||
| 136 | + pr_info("raid6: Forced gen() algo %s\n", gen_algo->name); | ||
| 137 | + | ||
| 138 | + raid6_call = *gen_algo; | ||
| 139 | + | ||
| 140 | + return gen_algo && recov_algo ? 0 : -EINVAL; | ||
| 141 | +} | ||
| 142 | +#else | ||
| 143 | static inline const struct raid6_recov_calls *raid6_choose_recov(void) | ||
| 144 | { | ||
| 145 | const struct raid6_recov_calls *const *algo; | ||
| 146 | @@ -256,6 +313,7 @@ int __init raid6_select_algo(void) | ||
| 147 | |||
| 148 | return gen_best && rec_best ? 0 : -EINVAL; | ||
| 149 | } | ||
| 150 | +#endif | ||
| 151 | |||
| 152 | static void raid6_exit(void) | ||
| 153 | { | ||
| 154 | -- | ||
| 155 | 2.11.1 | ||
| 156 | |||
