@@ -14,6 +14,7 @@
#include <linux/raid/xor.h>
#include <linux/jiffies.h>
#include <linux/preempt.h>
+#include <linux/cpu.h>
#include <asm/xor.h>
#ifndef XOR_SELECT_TEMPLATE
@@ -85,6 +86,7 @@ do_xor_speed(struct xor_block_template *tmpl, void *b1, void *b2)
mb();
count++;
mb();
+ cpu_yield_to_irqs();
}
if (count > max)
max = count;
@@ -180,6 +180,7 @@ int cpu_report_state(int cpu);
int cpu_check_up_prepare(int cpu);
void cpu_set_state_online(int cpu);
void play_idle(unsigned long duration_ms);
+void cpu_yield_to_irqs(void);
#ifdef CONFIG_HOTPLUG_CPU
bool cpu_wait_death(unsigned int cpu, int seconds);
@@ -2339,6 +2339,11 @@ void __init boot_cpu_hotplug_init(void)
this_cpu_write(cpuhp_state.state, CPUHP_ONLINE);
}
+void __weak cpu_yield_to_irqs(void)
+{
+}
+EXPORT_SYMBOL(cpu_yield_to_irqs);
+
enum cpu_mitigations cpu_mitigations __ro_after_init = CPU_MITIGATIONS_AUTO;
static int __init mitigations_parse_cmdline(char *arg)
@@ -18,6 +18,7 @@
#else
#include <linux/module.h>
#include <linux/gfp.h>
+#include <linux/cpu.h>
#if !RAID6_USE_EMPTY_ZERO_PAGE
/* In .bss so it's zeroed */
const char raid6_empty_zero_page[PAGE_SIZE] __attribute__((aligned(256)));
@@ -29,7 +30,7 @@ struct raid6_calls raid6_call;
EXPORT_SYMBOL_GPL(raid6_call);
const struct raid6_calls * const raid6_algos[] = {
-#if defined(__i386__) && !defined(__arch_um__)
+#ifdef CONFIG_X86_32
#ifdef CONFIG_AS_AVX512
&raid6_avx512x2,
&raid6_avx512x1,
@@ -45,7 +46,7 @@ const struct raid6_calls * const raid6_algos[] = {
&raid6_mmxx2,
&raid6_mmxx1,
#endif
-#if defined(__x86_64__) && !defined(__arch_um__)
+#ifdef CONFIG_X86_64
#ifdef CONFIG_AS_AVX512
&raid6_avx512x4,
&raid6_avx512x2,
@@ -79,7 +80,7 @@ const struct raid6_calls * const raid6_algos[] = {
&raid6_neonx2,
&raid6_neonx1,
#endif
-#if defined(__ia64__)
+#ifdef CONFIG_IA64
&raid6_intx32,
&raid6_intx16,
#endif
@@ -173,6 +174,7 @@ static inline const struct raid6_calls *raid6_choose_gen(
j1 + (1<<RAID6_TIME_JIFFIES_LG2))) {
(*algo)->gen_syndrome(disks, PAGE_SIZE, *dptrs);
perf++;
+ cpu_yield_to_irqs();
}
preempt_enable();
@@ -197,6 +199,7 @@ static inline const struct raid6_calls *raid6_choose_gen(
(*algo)->xor_syndrome(disks, start, stop,
PAGE_SIZE, *dptrs);
perf++;
+ cpu_yield_to_irqs();
}
preempt_enable();