* mainline build failure for loongarch allmodconfig with gcc-12
@ 2022-08-23 8:34 Sudip Mukherjee (Codethink)
2022-08-23 18:09 ` Linus Torvalds
0 siblings, 1 reply; 3+ messages in thread
From: Sudip Mukherjee (Codethink) @ 2022-08-23 8:34 UTC (permalink / raw)
To: Nathan Chancellor, Nick Desaulniers, Tom Rix, Huacai Chen, WANG Xuerui
Cc: linux-kernel, llvm, torvalds, loongarch
Hi All,
I have been trying to build loongarch as part of my nightly builds, and
I can build loongson3_defconfig without any error. But allmodconfig fails
with the error:
In function '__cmpxchg',
inlined from 'ssh_seq_next' at drivers/platform/surface/aggregator/controller.c:61:9,
inlined from 'ssam_request_write_data' at drivers/platform/surface/aggregator/controller.c:1483:8,
inlined from 'ssam_request_sync_with_buffer' at drivers/platform/surface/aggregator/controller.c:1761:8:
././include/linux/compiler_types.h:354:45: error: call to '__compiletime_assert_9' declared with attribute error: BUILD_BUG failed
354 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^
././include/linux/compiler_types.h:335:25: note: in definition of macro '__compiletime_assert'
335 | prefix ## suffix(); \
| ^~~~~~
././include/linux/compiler_types.h:354:9: note: in expansion of macro '_compiletime_assert'
354 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:59:21: note: in expansion of macro 'BUILD_BUG_ON_MSG'
59 | #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
| ^~~~~~~~~~~~~~~~
./arch/loongarch/include/asm/cmpxchg.h:83:17: note: in expansion of macro 'BUILD_BUG'
83 | BUILD_BUG();
| ^~~~~~~~~
I will be happy to test any patch or provide any extra log if needed.
--
Regards
Sudip
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: mainline build failure for loongarch allmodconfig with gcc-12
2022-08-23 8:34 mainline build failure for loongarch allmodconfig with gcc-12 Sudip Mukherjee (Codethink)
@ 2022-08-23 18:09 ` Linus Torvalds
2022-08-24 1:38 ` Huacai Chen
0 siblings, 1 reply; 3+ messages in thread
From: Linus Torvalds @ 2022-08-23 18:09 UTC (permalink / raw)
To: Sudip Mukherjee (Codethink)
Cc: Nathan Chancellor, Nick Desaulniers, Tom Rix, Huacai Chen,
WANG Xuerui, linux-kernel, llvm, loongarch
On Tue, Aug 23, 2022 at 1:34 AM Sudip Mukherjee (Codethink)
<sudipm.mukherjee@gmail.com> wrote:
>
> I have been trying to build loongarch as part of my nightly builds, and
> I can build loongson3_defconfig without any error. But allmodconfig fails
> with the error:
>
> In function '__cmpxchg',
> inlined from 'ssh_seq_next' at drivers/platform/surface/aggregator/controller.c:61:9,
Looks like ssh_seq_next() wants to do an atomic cmpxchg() on a single
byte value, and the Loongarch implementation only does 4- and 8-byte
versions.
It looks like loongarch - from its MIPS heritage - inherited the "we
can't do atomics on byte variables", so that it needs the same strange
"do bytes as word accesses with mask-and-shifts".
For MIPS, the code is in __xchg_small() in arch/mips/kernel/cmpxchg.c.
Alpha has something similar, except it's all done in inline asm in
arch/alpha/include/asm/xchg.h (look for "____cmpxchg(_u8," in there.
Of course, we could just add a Kconfig variable like
"ARCH_LACKS_BYTE_ATOMICS" and make that driver depend on it not being
true, and just have Loongarch set it.
But I think loongarch should just implement the byte masking stuff.
Particularly since I suspect it can just copy the MIPS code as-is.
Linus
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: mainline build failure for loongarch allmodconfig with gcc-12
2022-08-23 18:09 ` Linus Torvalds
@ 2022-08-24 1:38 ` Huacai Chen
0 siblings, 0 replies; 3+ messages in thread
From: Huacai Chen @ 2022-08-24 1:38 UTC (permalink / raw)
To: Linus Torvalds
Cc: Sudip Mukherjee (Codethink),
Nathan Chancellor, Nick Desaulniers, Tom Rix, WANG Xuerui, LKML,
llvm, loongarch
Hi, Linus,
On Wed, Aug 24, 2022 at 2:09 AM Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> On Tue, Aug 23, 2022 at 1:34 AM Sudip Mukherjee (Codethink)
> <sudipm.mukherjee@gmail.com> wrote:
> >
> > I have been trying to build loongarch as part of my nightly builds, and
> > I can build loongson3_defconfig without any error. But allmodconfig fails
> > with the error:
> >
> > In function '__cmpxchg',
> > inlined from 'ssh_seq_next' at drivers/platform/surface/aggregator/controller.c:61:9,
>
> Looks like ssh_seq_next() wants to do an atomic cmpxchg() on a single
> byte value, and the Loongarch implementation only does 4- and 8-byte
> versions.
>
> It looks like loongarch - from its MIPS heritage - inherited the "we
> can't do atomics on byte variables", so that it needs the same strange
> "do bytes as word accesses with mask-and-shifts".
>
> For MIPS, the code is in __xchg_small() in arch/mips/kernel/cmpxchg.c.
>
> Alpha has something similar, except it's all done in inline asm in
> arch/alpha/include/asm/xchg.h (look for "____cmpxchg(_u8," in there.
>
> Of course, we could just add a Kconfig variable like
> "ARCH_LACKS_BYTE_ATOMICS" and make that driver depend on it not being
> true, and just have Loongarch set it.
>
> But I think loongarch should just implement the byte masking stuff.
> Particularly since I suspect it can just copy the MIPS code as-is.
Yes, I agree. There is already a proposed patch to do this [1]. It was
discussed for a long time about the "forward progress", but I think
that problem is solved because LoongArch has "exclusive access (with
timeout) of ll" and "random delay of sc" in hardware. So I hope this
patch can be accepted now.
https://lore.kernel.org/loongarch/CAJF2gTQBjetiA1eDaXhBsiEmRYCdOAAWWAGcwVjhZTBYH5BpGQ@mail.gmail.com/T/#m9df7f86d9509cec23a66a0304152377e1070b62e
Huacai
>
> Linus
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-08-24 1:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-23 8:34 mainline build failure for loongarch allmodconfig with gcc-12 Sudip Mukherjee (Codethink)
2022-08-23 18:09 ` Linus Torvalds
2022-08-24 1:38 ` Huacai Chen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.