Re: [PATCH] MIPS: Loongson, workaround ll/sc weak ordering

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi YunQiang,

On Fri, Dec 14, 2018 at 11:56:05PM +0800, YunQiang Su wrote:
> On the Loongson-2G/2H/3A/3B there is a hardware flaw that ll/sc and
> lld/scd is very weak ordering. We should add sync instructions before
> each ll/lld and after the last sc/scd to workaround. Otherwise, this
> flaw will cause deadlock occationally (e.g. when doing heavy load test
> with LTP).
> 
> We introduced an gcc/as option "-mfix-loongson3-llsc", this option
> inserts sync before ll, and so some addresses in __ex_table will need
> to be shift.
> 
> This is based on the patch from Huacai Chen.

I much prefer this less invasive version of the patch - thanks! I'd like
to know that the gcc & binutils parts are definitely going to be merged
before I take this though. Please let me know when that happens.

> diff --git a/arch/mips/Makefile b/arch/mips/Makefile
> index b6303e48d..360ee1c30 100644
> --- a/arch/mips/Makefile
> +++ b/arch/mips/Makefile
> @@ -194,6 +194,11 @@ cflags-$(CONFIG_CPU_CAVIUM_OCTEON) += -Wa,-march=octeon
>  endif
>  cflags-$(CONFIG_CAVIUM_CN63XXP1) += -Wa,-mfix-cn63xxp1
>  cflags-$(CONFIG_CPU_BMIPS)	+= -march=mips32 -Wa,-mips32 -Wa,--trap
> +ifeq ($(CONFIG_CPU_LOONGSON3),y)
> +cflags-y	+= $(call cc-option,-mfix-loongson3-llsc,)
> +else
> +cflags-y	+= $(call cc-option,-mno-fix-loongson3-llsc,)
> +endif

The fix-loongson3-llsc option will be default, right? At least for
everything other than -march=octeon3. As such the above should just be:

cflags-$(CONFIG_CPU_LOONGSON3) += $(call cc-option,-mfix-loongson3-llsc,)

Or possibly, if we decide that we only want to support loongson3 kernels
built with a compiler that supports this which it seems may make sense,
it could just be:

cflags-$(CONFIG_CPU_LOONGSON3) += -mfix-loongson3-llsc

Thanks,
    Paul


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux