Return-Path: Received: from smtpbgbr2.qq.com ([54.207.22.56]:44936 "EHLO smtpbgbr2.qq.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751579AbcAEFy2 (ORCPT ); Tue, 5 Jan 2016 00:54:28 -0500 From: Huacai Chen To: Ralf Baechle Cc: Aurelien Jarno , "Steven J. Hill" , linux-mips@linux-mips.org, Fuxin Zhang , Zhangjin Wu , Huacai Chen , Subject: [PATCH 3/6] MIPS: Loongson-3: Fix SMP_ASK_C0COUNT IPI handler Date: Tue, 5 Jan 2016 13:59:06 +0800 Message-Id: <1451973549-16198-4-git-send-email-chenhc@lemote.com> In-Reply-To: <1451973549-16198-1-git-send-email-chenhc@lemote.com> References: <1451973549-16198-1-git-send-email-chenhc@lemote.com> Sender: stable-owner@vger.kernel.org List-ID: When Core-0 handle SMP_ASK_C0COUNT IPI, we should make other cores to see the result as soon as possible (especially when Store-Fill-Buffer is enabled). Otherwise, C0_Count syncronization makes no sense. BTW, there is a corner should be avoid: C0_Count of Core-0 is really 0. Cc: Signed-off-by: Huacai Chen --- arch/mips/loongson64/loongson-3/smp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/mips/loongson64/loongson-3/smp.c b/arch/mips/loongson64/loongson-3/smp.c index 1a4738a..55d0f5f 100644 --- a/arch/mips/loongson64/loongson-3/smp.c +++ b/arch/mips/loongson64/loongson-3/smp.c @@ -275,8 +275,10 @@ void loongson3_ipi_interrupt(struct pt_regs *regs) if (action & SMP_ASK_C0COUNT) { BUG_ON(cpu != 0); c0count = read_c0_count(); + c0count = c0count ? c0count : 1; for (i = 1; i < num_possible_cpus(); i++) per_cpu(core0_c0count, i) = c0count; + __wbflush(); /* Let others see the result ASAP */ } } -- 2.4.6