]> git.baikalelectronics.ru Git - kernel.git/commit
MIPS: sync-r4k: reduce skew while synchronization
authorHuacai Chen <chenhc@lemote.com>
Thu, 21 Jan 2016 13:09:51 +0000 (21:09 +0800)
committerRalf Baechle <ralf@linux-mips.org>
Sun, 24 Jan 2016 00:31:51 +0000 (01:31 +0100)
commitd1c70c3c324a7aa0453d208e4cebb31091fcbc6f
treec030dcb8fc5808e1fdd077e6da7fb8947b096fca
parentf1e3b7f349a15dfdd12c3445231e5ee93ad8a8e2
MIPS: sync-r4k: reduce skew while synchronization

While synchronization, count register will go backwards for the master.
If synchronise_count_master() runs before synchronise_count_slave(),
skew becomes even more. The skew is very harmful for CPU hotplug (CPU0
do synchronization with CPU1, then CPU0 do synchronization with CPU2
and CPU0's count goes backwards, so it will be out of sync with CPU1).

After the commit 275150710f54bd19aa9b5 (MIPS: Synchronize MIPS count one
CPU at a time), we needn't evaluate count_reference at the beginning of
synchronise_count_master() any more. Thus, we evaluate the initcount (It
seems like count_reference is redundant) in the 2nd loop. Since we write
the count register in the last loop, we don't need additional barriers
(the existing memory barriers are enough).

Moreover, I think we loop 3 times is enough to get a primed instruction
cache, this can also get less skew than looping 5 times.

Comments are also updated in this patch.

Signed-off-by: Huacai Chen <chenhc@lemote.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: Steven J. Hill <Steven.Hill@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: Fuxin Zhang <zhangfx@lemote.com>
Cc: Zhangjin Wu <wuzhangjin@gmail.com>
Patchwork: https://patchwork.linux-mips.org/patch/12163/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/kernel/sync-r4k.c