From: Christoph Hellwig Date: Wed, 21 Aug 2019 14:58:34 +0000 (+0900) Subject: riscv: optimize send_ipi_single X-Git-Tag: v5.4-rc1~190^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e11ea2a02b93933425ddfa4b4e2012ba0882ac82;p=thirdparty%2Fkernel%2Flinux.git riscv: optimize send_ipi_single Don't go through send_ipi_mask, but just set the op bit and then pass a simple generated hartid mask directly to sbi_send_ipi. Signed-off-by: Christoph Hellwig Reviewed-by: Atish Patra [paul.walmsley@sifive.com: minor patch description fixes] Signed-off-by: Paul Walmsley --- diff --git a/arch/riscv/kernel/smp.c b/arch/riscv/kernel/smp.c index 2e21669aa0684..a3715d621f60c 100644 --- a/arch/riscv/kernel/smp.c +++ b/arch/riscv/kernel/smp.c @@ -94,7 +94,13 @@ static void send_ipi_mask(const struct cpumask *mask, enum ipi_message_type op) static void send_ipi_single(int cpu, enum ipi_message_type op) { - send_ipi_mask(cpumask_of(cpu), op); + int hartid = cpuid_to_hartid_map(cpu); + + smp_mb__before_atomic(); + set_bit(op, &ipi_data[cpu].bits); + smp_mb__after_atomic(); + + sbi_send_ipi(cpumask_bits(cpumask_of(hartid))); } static inline void clear_ipi(void)