Skip to content

Instantly share code, notes, and snippets.

@stffrdhrn
Created June 21, 2022 14:29
diff --git a/arch/openrisc/include/asm/cacheflush.h b/arch/openrisc/include/asm/cacheflush.h
index 19916b605b07..eeac40d4a854 100644
--- a/arch/openrisc/include/asm/cacheflush.h
+++ b/arch/openrisc/include/asm/cacheflush.h
@@ -44,11 +44,9 @@ extern void smp_icache_page_inv(struct page *page);
*/
static inline void sync_icache_dcache(struct page *page)
{
- preempt_disable();
if (!IS_ENABLED(CONFIG_DCACHE_WRITETHROUGH))
dcache_page_flush(page);
icache_page_inv(page);
- preempt_enable();
}
/*
diff --git a/arch/openrisc/kernel/smp.c b/arch/openrisc/kernel/smp.c
index 27041db2c8b0..f525f5d42a83 100644
--- a/arch/openrisc/kernel/smp.c
+++ b/arch/openrisc/kernel/smp.c
@@ -331,6 +331,22 @@ static void ipi_icache_page_inv(void *arg)
void smp_icache_page_inv(struct page *page)
{
- on_each_cpu(ipi_icache_page_inv, page, 1);
+ unsigned int cpuid;
+ cpumask_t cmask;
+
+ cpuid = get_cpu();
+
+ /* Create mask of cpus to work on, remove this CPU first. */
+ cpumask_copy(&cmask, cpu_online_mask);
+ cpumask_clear_cpu(cpuid, &cmask);
+ local_icache_page_inv(page);
+
+ if (cpumask_empty(&cmask))
+ return;
+
+ /* Invalidate cache on other CPUs */
+ on_each_cpu_mask(&cmask, ipi_icache_page_inv, page, 1);
+
+ put_cpu();
}
EXPORT_SYMBOL(smp_icache_page_inv);
diff --git a/tools/testing/selftests/wireguard/qemu/Makefile b/tools/testing/selftests/wireguard/qemu/Makefile
index 4a96a73a9804..3266bcd004d7 100644
--- a/tools/testing/selftests/wireguard/qemu/Makefile
+++ b/tools/testing/selftests/wireguard/qemu/Makefile
@@ -299,6 +299,7 @@ qemu: $(KERNEL_BZIMAGE)
$(if $(QEMU_VPORT_RESULT),-device $(QEMU_VPORT_RESULT) -device virtserialport$(comma)chardev=result,-serial chardev:result) \
-no-reboot \
-monitor none \
+ -gdb tcp::10001 \
-kernel $<
grep -Fq success $(BUILD_PATH)/result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment