Paul Burton <paul.burton@xxxxxxxx> 于2018年12月15日周六 上午2:19写道: > > On Sat, Dec 15, 2018 at 02:03:14AM +0800, YunQiang Su wrote: > > > > > 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 > > > > > We provides a config-time option for gcc. So whether > > fix-loongson3-llsc option will be default, > > is not sure. It depends on distributions. > > OK but even if it's default on, will that only apply when we provide > -march=loongson3a? Surely it makes no sense to default on for other > CPUs. > > > > > 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 > > > > I also would like to support older toolchains, which may not support > > this option, > > so call cc-option is usable for it. > > OK, but if we build a kernel with the older toolchain it'll be unstable > right? Don't you think it'd be better to avoid letting people build > buggy kernels? In fact some quilte newer Loongson's CPUs don't have this problem, and then the workaround is not needed. Since so, I guess we should introduce a new CONFIG option like CONFIG_CPU_LOONGSON3_WORKAROUND_LLSC without this option enabled, we can allow to use the older toolchain, and if this option is enabled, we force -mfix-loongson3-llsc usage. Is it acceptable? > > I suppose this is the advantage of Huacai's original patch. > Sure, Huacai's patch has its advantage. > Thanks, > Paul