linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: build failure after merge of the tip tree
@ 2021-05-13  2:05 Stephen Rothwell
  2021-05-13 10:51 ` Ingo Molnar
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Rothwell @ 2021-05-13  2:05 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Peter Zijlstra
  Cc: Linux Kernel Mailing List, Linux Next Mailing List

[-- Attachment #1: Type: text/plain, Size: 610 bytes --]

Hi all,

After merging the tip tree, today's linux-next build (x86_64 allmodconfig)
failed like this:

In file included from tools/arch/x86/include/asm/nops.h:5,
                 from arch/x86/decode.c:15:
tools/arch/x86/include/asm/asm.h:185:24: error: invalid register name for 'current_stack_pointer'
  185 | register unsigned long current_stack_pointer asm(_ASM_SP);
      |                        ^~~~~~~~~~~~~~~~~~~~~

Caused by commit

  eef23e72b78b ("x86/asm: Use _ASM_BYTES() in <asm/nops.h>")

I have used the tip tree from next-20210512 for today.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: linux-next: build failure after merge of the tip tree
  2021-05-13  2:05 linux-next: build failure after merge of the tip tree Stephen Rothwell
@ 2021-05-13 10:51 ` Ingo Molnar
  2021-05-13 11:11   ` H. Peter Anvin
  0 siblings, 1 reply; 5+ messages in thread
From: Ingo Molnar @ 2021-05-13 10:51 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Peter Zijlstra,
	Linux Kernel Mailing List, Linux Next Mailing List


* Stephen Rothwell <sfr@canb.auug.org.au> wrote:

> Hi all,
> 
> After merging the tip tree, today's linux-next build (x86_64 allmodconfig)
> failed like this:
> 
> In file included from tools/arch/x86/include/asm/nops.h:5,
>                  from arch/x86/decode.c:15:
> tools/arch/x86/include/asm/asm.h:185:24: error: invalid register name for 'current_stack_pointer'
>   185 | register unsigned long current_stack_pointer asm(_ASM_SP);
>       |                        ^~~~~~~~~~~~~~~~~~~~~
> 
> Caused by commit
> 
>   eef23e72b78b ("x86/asm: Use _ASM_BYTES() in <asm/nops.h>")
> 
> I have used the tip tree from next-20210512 for today.

Hm, this must be some cross-build artifact or toolchain version dependency 
- as plain native build of x86-64 allmodconfig builds just fine:

    CC       arch/x86/decode.o
    LD       arch/x86/objtool-in.o

I tried with gcc-8, but that didn't trigger it.

I suppose the workaround below would make it build - but that's not a real 
solution.

hpa, any ideas?

Thanks,

	Ingo

diff --git a/tools/arch/x86/include/asm/asm.h b/tools/arch/x86/include/asm/asm.h
index 507a37a46027..ada5482c024a 100644
--- a/tools/arch/x86/include/asm/asm.h
+++ b/tools/arch/x86/include/asm/asm.h
@@ -176,14 +176,6 @@
 
 /* For C file, we already have NOKPROBE_SYMBOL macro */
 
-/*
- * This output constraint should be used for any inline asm which has a "call"
- * instruction.  Otherwise the asm may be inserted before the frame pointer
- * gets set up by the containing function.  If you forget to do this, objtool
- * may print a "call without frame pointer save/setup" warning.
- */
-register unsigned long current_stack_pointer asm(_ASM_SP);
-#define ASM_CALL_CONSTRAINT "+r" (current_stack_pointer)
 #endif /* __ASSEMBLY__ */
 
 #endif /* _ASM_X86_ASM_H */

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: linux-next: build failure after merge of the tip tree
  2021-05-13 10:51 ` Ingo Molnar
@ 2021-05-13 11:11   ` H. Peter Anvin
  2021-05-13 11:44     ` [PATCH] x86/asm: Make <asm/asm.h> valid on cross-builds as well Ingo Molnar
  0 siblings, 1 reply; 5+ messages in thread
From: H. Peter Anvin @ 2021-05-13 11:11 UTC (permalink / raw)
  To: Ingo Molnar, Stephen Rothwell
  Cc: Thomas Gleixner, Ingo Molnar, Peter Zijlstra,
	Linux Kernel Mailing List, Linux Next Mailing List

Needed some head scratching, but then...

It makes sense for the cross-build: it's building for the host, and a non-x86 machine isn't doing to have a register named "%rsp".

So this needs to be protected from non-kernel use either via __KERNEL__ or by factoring the basic macros out into a separate file.

Incidentally, we seem to have three categories of include files now: kernel-only, uapi, and "tools api". Perhaps we need such a "tapi" directory instead of copying things around... the infrastructure for uapi with make headers_install etc ought to be generalizable.


On May 13, 2021 3:51:47 AM PDT, Ingo Molnar <mingo@kernel.org> wrote:
>
>* Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
>> Hi all,
>> 
>> After merging the tip tree, today's linux-next build (x86_64
>allmodconfig)
>> failed like this:
>> 
>> In file included from tools/arch/x86/include/asm/nops.h:5,
>>                  from arch/x86/decode.c:15:
>> tools/arch/x86/include/asm/asm.h:185:24: error: invalid register name
>for 'current_stack_pointer'
>>   185 | register unsigned long current_stack_pointer asm(_ASM_SP);
>>       |                        ^~~~~~~~~~~~~~~~~~~~~
>> 
>> Caused by commit
>> 
>>   eef23e72b78b ("x86/asm: Use _ASM_BYTES() in <asm/nops.h>")
>> 
>> I have used the tip tree from next-20210512 for today.
>
>Hm, this must be some cross-build artifact or toolchain version
>dependency 
>- as plain native build of x86-64 allmodconfig builds just fine:
>
>    CC       arch/x86/decode.o
>    LD       arch/x86/objtool-in.o
>
>I tried with gcc-8, but that didn't trigger it.
>
>I suppose the workaround below would make it build - but that's not a
>real 
>solution.
>
>hpa, any ideas?
>
>Thanks,
>
>	Ingo
>
>diff --git a/tools/arch/x86/include/asm/asm.h
>b/tools/arch/x86/include/asm/asm.h
>index 507a37a46027..ada5482c024a 100644
>--- a/tools/arch/x86/include/asm/asm.h
>+++ b/tools/arch/x86/include/asm/asm.h
>@@ -176,14 +176,6 @@
> 
> /* For C file, we already have NOKPROBE_SYMBOL macro */
> 
>-/*
>- * This output constraint should be used for any inline asm which has
>a "call"
>- * instruction.  Otherwise the asm may be inserted before the frame
>pointer
>- * gets set up by the containing function.  If you forget to do this,
>objtool
>- * may print a "call without frame pointer save/setup" warning.
>- */
>-register unsigned long current_stack_pointer asm(_ASM_SP);
>-#define ASM_CALL_CONSTRAINT "+r" (current_stack_pointer)
> #endif /* __ASSEMBLY__ */
> 
> #endif /* _ASM_X86_ASM_H */

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] x86/asm: Make <asm/asm.h> valid on cross-builds as well
  2021-05-13 11:11   ` H. Peter Anvin
@ 2021-05-13 11:44     ` Ingo Molnar
  2021-05-13 14:10       ` H. Peter Anvin
  0 siblings, 1 reply; 5+ messages in thread
From: Ingo Molnar @ 2021-05-13 11:44 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Stephen Rothwell, Thomas Gleixner, Ingo Molnar, Peter Zijlstra,
	Linux Kernel Mailing List, Linux Next Mailing List


* H. Peter Anvin <hpa@zytor.com> wrote:

> Needed some head scratching, but then...
> 
> It makes sense for the cross-build: it's building for the host, and a 
> non-x86 machine isn't doing to have a register named "%rsp".

Oh, indeed, sfr is building on powerpc64 I think?

> So this needs to be protected from non-kernel use either via __KERNEL__ 
> or by factoring the basic macros out into a separate file.

So something like the below?

The exception table stuff is definitely kernel-only. The others could, in 
principle, be used by tooling as well.

Thanks,

	Ingo

=======================>
From: Ingo Molnar <mingo@kernel.org>
Date: Thu, 13 May 2021 13:41:41 +0200
Subject: [PATCH] x86/asm: Make <asm/asm.h> valid on cross-builds as well

Stephen Rothwell reported that the objtool cross-build breaks on
non-x86 hosts:

  > tools/arch/x86/include/asm/asm.h:185:24: error: invalid register name for 'current_stack_pointer'
  >   185 | register unsigned long current_stack_pointer asm(_ASM_SP);
  >       |                        ^~~~~~~~~~~~~~~~~~~~~

The PowerPC host obviously doesn't know much about x86 register names.

Protect the kernel-specific bits of <asm/asm.h>, so that it can be
included by tooling and cross-built.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/include/asm/asm.h       | 4 ++++
 tools/arch/x86/include/asm/asm.h | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h
index 507a37a46027..3ad3da9a7d97 100644
--- a/arch/x86/include/asm/asm.h
+++ b/arch/x86/include/asm/asm.h
@@ -120,6 +120,8 @@
 # define CC_OUT(c) [_cc_ ## c] "=qm"
 #endif
 
+#ifdef __KERNEL__
+
 /* Exception table entry */
 #ifdef __ASSEMBLY__
 # define _ASM_EXTABLE_HANDLE(from, to, handler)			\
@@ -186,4 +188,6 @@ register unsigned long current_stack_pointer asm(_ASM_SP);
 #define ASM_CALL_CONSTRAINT "+r" (current_stack_pointer)
 #endif /* __ASSEMBLY__ */
 
+#endif /* __KERNEL__ */
+
 #endif /* _ASM_X86_ASM_H */
diff --git a/tools/arch/x86/include/asm/asm.h b/tools/arch/x86/include/asm/asm.h
index 507a37a46027..3ad3da9a7d97 100644
--- a/tools/arch/x86/include/asm/asm.h
+++ b/tools/arch/x86/include/asm/asm.h
@@ -120,6 +120,8 @@
 # define CC_OUT(c) [_cc_ ## c] "=qm"
 #endif
 
+#ifdef __KERNEL__
+
 /* Exception table entry */
 #ifdef __ASSEMBLY__
 # define _ASM_EXTABLE_HANDLE(from, to, handler)			\
@@ -186,4 +188,6 @@ register unsigned long current_stack_pointer asm(_ASM_SP);
 #define ASM_CALL_CONSTRAINT "+r" (current_stack_pointer)
 #endif /* __ASSEMBLY__ */
 
+#endif /* __KERNEL__ */
+
 #endif /* _ASM_X86_ASM_H */

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] x86/asm: Make <asm/asm.h> valid on cross-builds as well
  2021-05-13 11:44     ` [PATCH] x86/asm: Make <asm/asm.h> valid on cross-builds as well Ingo Molnar
@ 2021-05-13 14:10       ` H. Peter Anvin
  0 siblings, 0 replies; 5+ messages in thread
From: H. Peter Anvin @ 2021-05-13 14:10 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Stephen Rothwell, Thomas Gleixner, Ingo Molnar, Peter Zijlstra,
	Linux Kernel Mailing List, Linux Next Mailing List

Makes sense to me.

Reviewed-by: H. Peter Anvin <hpa@zytor.com>

On May 13, 2021 4:44:51 AM PDT, Ingo Molnar <mingo@kernel.org> wrote:
>
>* H. Peter Anvin <hpa@zytor.com> wrote:
>
>> Needed some head scratching, but then...
>> 
>> It makes sense for the cross-build: it's building for the host, and a
>
>> non-x86 machine isn't doing to have a register named "%rsp".
>
>Oh, indeed, sfr is building on powerpc64 I think?
>
>> So this needs to be protected from non-kernel use either via
>__KERNEL__ 
>> or by factoring the basic macros out into a separate file.
>
>So something like the below?
>
>The exception table stuff is definitely kernel-only. The others could,
>in 
>principle, be used by tooling as well.
>
>Thanks,
>
>	Ingo
>
>=======================>
>From: Ingo Molnar <mingo@kernel.org>
>Date: Thu, 13 May 2021 13:41:41 +0200
>Subject: [PATCH] x86/asm: Make <asm/asm.h> valid on cross-builds as
>well
>
>Stephen Rothwell reported that the objtool cross-build breaks on
>non-x86 hosts:
>
>> tools/arch/x86/include/asm/asm.h:185:24: error: invalid register name
>for 'current_stack_pointer'
>  >   185 | register unsigned long current_stack_pointer asm(_ASM_SP);
>  >       |                        ^~~~~~~~~~~~~~~~~~~~~
>
>The PowerPC host obviously doesn't know much about x86 register names.
>
>Protect the kernel-specific bits of <asm/asm.h>, so that it can be
>included by tooling and cross-built.
>
>Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
>Signed-off-by: Ingo Molnar <mingo@kernel.org>
>---
> arch/x86/include/asm/asm.h       | 4 ++++
> tools/arch/x86/include/asm/asm.h | 4 ++++
> 2 files changed, 8 insertions(+)
>
>diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h
>index 507a37a46027..3ad3da9a7d97 100644
>--- a/arch/x86/include/asm/asm.h
>+++ b/arch/x86/include/asm/asm.h
>@@ -120,6 +120,8 @@
> # define CC_OUT(c) [_cc_ ## c] "=qm"
> #endif
> 
>+#ifdef __KERNEL__
>+
> /* Exception table entry */
> #ifdef __ASSEMBLY__
> # define _ASM_EXTABLE_HANDLE(from, to, handler)			\
>@@ -186,4 +188,6 @@ register unsigned long current_stack_pointer
>asm(_ASM_SP);
> #define ASM_CALL_CONSTRAINT "+r" (current_stack_pointer)
> #endif /* __ASSEMBLY__ */
> 
>+#endif /* __KERNEL__ */
>+
> #endif /* _ASM_X86_ASM_H */
>diff --git a/tools/arch/x86/include/asm/asm.h
>b/tools/arch/x86/include/asm/asm.h
>index 507a37a46027..3ad3da9a7d97 100644
>--- a/tools/arch/x86/include/asm/asm.h
>+++ b/tools/arch/x86/include/asm/asm.h
>@@ -120,6 +120,8 @@
> # define CC_OUT(c) [_cc_ ## c] "=qm"
> #endif
> 
>+#ifdef __KERNEL__
>+
> /* Exception table entry */
> #ifdef __ASSEMBLY__
> # define _ASM_EXTABLE_HANDLE(from, to, handler)			\
>@@ -186,4 +188,6 @@ register unsigned long current_stack_pointer
>asm(_ASM_SP);
> #define ASM_CALL_CONSTRAINT "+r" (current_stack_pointer)
> #endif /* __ASSEMBLY__ */
> 
>+#endif /* __KERNEL__ */
>+
> #endif /* _ASM_X86_ASM_H */

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-05-13 14:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-13  2:05 linux-next: build failure after merge of the tip tree Stephen Rothwell
2021-05-13 10:51 ` Ingo Molnar
2021-05-13 11:11   ` H. Peter Anvin
2021-05-13 11:44     ` [PATCH] x86/asm: Make <asm/asm.h> valid on cross-builds as well Ingo Molnar
2021-05-13 14:10       ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).