Skip to contentSkip to conversation

x86-64: add CFI annotations to lib/rwsem_64.S

PATCH In review Jan Beulich 2 participants 7 messages Feb 28, 2011 – Mar 1, 2011 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86-64: add CFI annotations to lib/rwsem_64.S

These weren't part of the initial commit of this code.

Cc Alexander van Heukelum <[email protected]>
---
 arch/x86/lib/rwsem_64.S |   56 +++++++++++++++++++++++++++++-------------------
 1 file changed, 34 insertions(+), 22 deletions(-)
arch/x86/lib/rwsem_64.S +34 -22
@@ -23,43 +23,50 @@
 #include <asm/dwarf2.h>
 
 #define save_common_regs \
-	pushq %rdi; \
-	pushq %rsi; \
-	pushq %rcx; \
-	pushq %r8; \
-	pushq %r9; \
-	pushq %r10; \
-	pushq %r11
+	pushq_cfi %rdi; CFI_REL_OFFSET rdi, 0; \
+	pushq_cfi %rsi; CFI_REL_OFFSET rsi, 0; \
+	pushq_cfi %rcx; CFI_REL_OFFSET rcx, 0; \
+	pushq_cfi %r8;  CFI_REL_OFFSET r8,  0; \
+	pushq_cfi %r9;  CFI_REL_OFFSET r9,  0; \
+	pushq_cfi %r10; CFI_REL_OFFSET r10, 0; \
+	pushq_cfi %r11; CFI_REL_OFFSET r11, 0
 
 #define restore_common_regs \
-	popq %r11; \
-	popq %r10; \
-	popq %r9; \
-	popq %r8; \
-	popq %rcx; \
-	popq %rsi; \
-	popq %rdi
+	popq_cfi %r11; CFI_RESTORE r11; \
+	popq_cfi %r10; CFI_RESTORE r10; \
+	popq_cfi %r9;  CFI_RESTORE r9; \
+	popq_cfi %r8;  CFI_RESTORE r8; \
+	popq_cfi %rcx; CFI_RESTORE rcx; \
+	popq_cfi %rsi; CFI_RESTORE rsi; \
+	popq_cfi %rdi; CFI_RESTORE rdi
 
 /* Fix up special calling conventions */
 ENTRY(call_rwsem_down_read_failed)
+	CFI_STARTPROC
 	save_common_regs
-	pushq %rdx
+	pushq_cfi %rdx
+	CFI_REL_OFFSET rdx, 0
 	movq %rax,%rdi
 	call rwsem_down_read_failed
-	popq %rdx
+	popq_cfi %rdx
+	CFI_RESTORE rdx
 	restore_common_regs
 	ret
-	ENDPROC(call_rwsem_down_read_failed)
+	CFI_ENDPROC
+ENDPROC(call_rwsem_down_read_failed)
 
 ENTRY(call_rwsem_down_write_failed)
+	CFI_STARTPROC
 	save_common_regs
 	movq %rax,%rdi
 	call rwsem_down_write_failed
 	restore_common_regs
 	ret
-	ENDPROC(call_rwsem_down_write_failed)
+	CFI_ENDPROC
+ENDPROC(call_rwsem_down_write_failed)
 
 ENTRY(call_rwsem_wake)
+	CFI_STARTPROC
 	decl %edx	/* do nothing if still outstanding active readers */
 	jnz 1f
 	save_common_regs
@@ -67,15 +74,20 @@ ENTRY(call_rwsem_wake)
 	call rwsem_wake
 	restore_common_regs
 1:	ret
-	ENDPROC(call_rwsem_wake)
+	CFI_ENDPROC
+ENDPROC(call_rwsem_wake)
 
 /* Fix up special calling conventions */
 ENTRY(call_rwsem_downgrade_wake)
+	CFI_STARTPROC
 	save_common_regs
-	pushq %rdx
+	pushq_cfi %rdx
+	CFI_REL_OFFSET rdx, 0
 	movq %rax,%rdi
 	call rwsem_downgrade_wake
-	popq %rdx
+	popq_cfi %rdx
+	CFI_RESTORE rdx
 	restore_common_regs
 	ret
-	ENDPROC(call_rwsem_downgrade_wake)
+	CFI_ENDPROC
+ENDPROC(call_rwsem_downgrade_wake)
#1 lore raw

[tip:x86/asm] x86-64: Add CFI annotations to lib/rwsem_64.S

Commit-ID:  39f2205e1abd1b6fffdaf45e1f1c3049a5f8999c
Gitweb:     http://git.kernel.org/tip/39f2205e1abd1b6fffdaf45e1f1c3049a5f8999c
Author:     Jan Beulich <[email protected]>
AuthorDate: Mon, 28 Feb 2011 15:31:59 +0000
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 28 Feb 2011 18:06:21 +0100

x86-64: Add CFI annotations to lib/rwsem_64.S

These weren't part of the initial commit of this code.

Cc Alexander van Heukelum <[email protected]>

LKML-Reference: <[email protected]>

---
 arch/x86/lib/rwsem_64.S |   56 ++++++++++++++++++++++++++++------------------
 1 files changed, 34 insertions(+), 22 deletions(-)
arch/x86/lib/rwsem_64.S +34 -22
index 41fcf00..6774397 100644
@@ -23,43 +23,50 @@
 #include <asm/dwarf2.h>
 
 #define save_common_regs \
-	pushq %rdi; \
-	pushq %rsi; \
-	pushq %rcx; \
-	pushq %r8; \
-	pushq %r9; \
-	pushq %r10; \
-	pushq %r11
+	pushq_cfi %rdi; CFI_REL_OFFSET rdi, 0; \
+	pushq_cfi %rsi; CFI_REL_OFFSET rsi, 0; \
+	pushq_cfi %rcx; CFI_REL_OFFSET rcx, 0; \
+	pushq_cfi %r8;  CFI_REL_OFFSET r8,  0; \
+	pushq_cfi %r9;  CFI_REL_OFFSET r9,  0; \
+	pushq_cfi %r10; CFI_REL_OFFSET r10, 0; \
+	pushq_cfi %r11; CFI_REL_OFFSET r11, 0
 
 #define restore_common_regs \
-	popq %r11; \
-	popq %r10; \
-	popq %r9; \
-	popq %r8; \
-	popq %rcx; \
-	popq %rsi; \
-	popq %rdi
+	popq_cfi %r11; CFI_RESTORE r11; \
+	popq_cfi %r10; CFI_RESTORE r10; \
+	popq_cfi %r9;  CFI_RESTORE r9; \
+	popq_cfi %r8;  CFI_RESTORE r8; \
+	popq_cfi %rcx; CFI_RESTORE rcx; \
+	popq_cfi %rsi; CFI_RESTORE rsi; \
+	popq_cfi %rdi; CFI_RESTORE rdi
 
 /* Fix up special calling conventions */
 ENTRY(call_rwsem_down_read_failed)
+	CFI_STARTPROC
 	save_common_regs
-	pushq %rdx
+	pushq_cfi %rdx
+	CFI_REL_OFFSET rdx, 0
 	movq %rax,%rdi
 	call rwsem_down_read_failed
-	popq %rdx
+	popq_cfi %rdx
+	CFI_RESTORE rdx
 	restore_common_regs
 	ret
-	ENDPROC(call_rwsem_down_read_failed)
+	CFI_ENDPROC
+ENDPROC(call_rwsem_down_read_failed)
 
 ENTRY(call_rwsem_down_write_failed)
+	CFI_STARTPROC
 	save_common_regs
 	movq %rax,%rdi
 	call rwsem_down_write_failed
 	restore_common_regs
 	ret
-	ENDPROC(call_rwsem_down_write_failed)
+	CFI_ENDPROC
+ENDPROC(call_rwsem_down_write_failed)
 
 ENTRY(call_rwsem_wake)
+	CFI_STARTPROC
 	decl %edx	/* do nothing if still outstanding active readers */
 	jnz 1f
 	save_common_regs
@@ -67,15 +74,20 @@ ENTRY(call_rwsem_wake)
 	call rwsem_wake
 	restore_common_regs
 1:	ret
-	ENDPROC(call_rwsem_wake)
+	CFI_ENDPROC
+ENDPROC(call_rwsem_wake)
 
 /* Fix up special calling conventions */
 ENTRY(call_rwsem_downgrade_wake)
+	CFI_STARTPROC
 	save_common_regs
-	pushq %rdx
+	pushq_cfi %rdx
+	CFI_REL_OFFSET rdx, 0
 	movq %rax,%rdi
 	call rwsem_downgrade_wake
-	popq %rdx
+	popq_cfi %rdx
+	CFI_RESTORE rdx
 	restore_common_regs
 	ret
-	ENDPROC(call_rwsem_downgrade_wake)
+	CFI_ENDPROC
+ENDPROC(call_rwsem_downgrade_wake)
#2 lore raw

Re: [tip:x86/asm] x86-64: Add CFI annotations to lib/rwsem_64.S

Quoted 11 lines · tip-bot for Jan Beulich
Commit-ID:  39f2205e1abd1b6fffdaf45e1f1c3049a5f8999c
Gitweb:     http://git.kernel.org/tip/39f2205e1abd1b6fffdaf45e1f1c3049a5f8999c
Author:     Jan Beulich <[email protected]>
AuthorDate: Mon, 28 Feb 2011 15:31:59 +0000
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 28 Feb 2011 18:06:21 +0100

x86-64: Add CFI annotations to lib/rwsem_64.S

These weren't part of the initial commit of this code.

Quoted 7 lines
Cc Alexander van Heukelum <[email protected]>

LKML-Reference: <[email protected]>

---
 arch/x86/lib/rwsem_64.S |   56 ++++++++++++++++++++++++++++------------------
 1 files changed, 34 insertions(+), 22 deletions(-)

this change breaks the UML build:

tip/arch/um/sys-x86_64/../../x86/lib/rwsem_64.S:46: Error: no such instruction: `pushq_cfi %rdi'

Thanks,

Ingo

#3 lore raw

Re: [tip:x86/asm] x86-64: Add CFI annotations to lib/rwsem_64.S

Quoted 24 lines
Quoted 1 line
Quoted 1 line · Ingo Molnar
Quoted 2 lines · tip-bot for Jan Beulich

Commit-ID: 39f2205e1abd1b6fffdaf45e1f1c3049a5f8999c Gitweb:

http://git.kernel.org/tip/39f2205e1abd1b6fffdaf45e1f1c3049a5f8999c

Quoted 9 lines
Author:     Jan Beulich <[email protected]>
AuthorDate: Mon, 28 Feb 2011 15:31:59 +0000
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 28 Feb 2011 18:06:21 +0100

x86-64: Add CFI annotations to lib/rwsem_64.S

These weren't part of the initial commit of this code.

Quoted 7 lines
Cc Alexander van Heukelum <[email protected]>

LKML-Reference: <[email protected]>

---
 arch/x86/lib/rwsem_64.S |   56 ++++++++++++++++++++++++++++------------------
 1 files changed, 34 insertions(+), 22 deletions(-)
Quoted 4 lines

this change breaks the UML build:

tip/arch/um/sys-x86_64/../../x86/lib/rwsem_64.S:46: Error: no such
instruction: `pushq_cfi %rdi'

Any reason why arch/um/Kconfig.x86 has X86_32 but not X86_64? That's resulting in asm/dwarf2.h producing the 32-bit (pushl_cfi & Co) macros instead of the 64-bit ones. And I wonder what other inconsistencies this may cause...

If this is on purpose (i.e. simply adding X86_64 as a new config option there isn't the right solution), what would be the preferred way of fixing this in asm/dwarf2.h:
- #ifndef CONFIG_X86_32,
- #ifdef CONFIG_64BIT,
- yet something else?

Thanks, Jan

#4 lore raw

Re: [tip:x86/asm] x86-64: Add CFI annotations to lib/rwsem_64.S

Quoted 26 lines · Jan Beulich
Quoted 26 lines
Quoted 1 line
Quoted 1 line · Ingo Molnar
Quoted 2 lines · tip-bot for Jan Beulich

Commit-ID: 39f2205e1abd1b6fffdaf45e1f1c3049a5f8999c Gitweb:

http://git.kernel.org/tip/39f2205e1abd1b6fffdaf45e1f1c3049a5f8999c

Quoted 9 lines
Author:     Jan Beulich <[email protected]>
AuthorDate: Mon, 28 Feb 2011 15:31:59 +0000
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 28 Feb 2011 18:06:21 +0100

x86-64: Add CFI annotations to lib/rwsem_64.S

These weren't part of the initial commit of this code.

Quoted 7 lines
Cc Alexander van Heukelum <[email protected]>

LKML-Reference: <[email protected]>

---
 arch/x86/lib/rwsem_64.S |   56 ++++++++++++++++++++++++++++------------------
 1 files changed, 34 insertions(+), 22 deletions(-)

this change breaks the UML build:

Quoted 7 lines
Quoted 2 lines

tip/arch/um/sys-x86_64/../../x86/lib/rwsem_64.S:46: Error: no such
instruction: `pushq_cfi %rdi'

Any reason why arch/um/Kconfig.x86 has X86_32 but not X86_64? That's resulting in asm/dwarf2.h producing the 32-bit (pushl_cfi & Co) macros instead of the 64-bit ones. And I wonder what other inconsistencies this may cause...

No idea - UML seems stale. I've Cc:-ed Jeff Dike just in case.

Quoted 6 lines

If this is on purpose (i.e. simply adding X86_64 as a new config option there isn't the right solution), what would be the preferred way of fixing this in asm/dwarf2.h:
- #ifndef CONFIG_X86_32,
- #ifdef CONFIG_64BIT,
- yet something else?

You could try it out - UML isnt that hard to build: "make ARCH=um" and then run the resulting binary. It will produce bootup messages then fails when mounting root. That's enough of a build & functionality test.

Thanks,

Ingo

#5 lore raw

Re: [tip:x86/asm] x86-64: Add CFI annotations to lib/rwsem_64.S

Quoted 47 lines
Quoted 1 line
Quoted 1 line · Ingo Molnar
Quoted 26 lines · Jan Beulich
Quoted 26 lines
Quoted 1 line
Quoted 1 line · Ingo Molnar
Quoted 2 lines · tip-bot for Jan Beulich

Commit-ID: 39f2205e1abd1b6fffdaf45e1f1c3049a5f8999c Gitweb:

http://git.kernel.org/tip/39f2205e1abd1b6fffdaf45e1f1c3049a5f8999c

Quoted 9 lines
Author:     Jan Beulich <[email protected]>
AuthorDate: Mon, 28 Feb 2011 15:31:59 +0000
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 28 Feb 2011 18:06:21 +0100

x86-64: Add CFI annotations to lib/rwsem_64.S

These weren't part of the initial commit of this code.

Quoted 7 lines
Cc Alexander van Heukelum <[email protected]>

LKML-Reference: <[email protected]>

---
 arch/x86/lib/rwsem_64.S |   56 ++++++++++++++++++++++++++++------------------
 1 files changed, 34 insertions(+), 22 deletions(-)

this change breaks the UML build:

Quoted 7 lines
Quoted 2 lines

tip/arch/um/sys-x86_64/../../x86/lib/rwsem_64.S:46: Error: no such
instruction: `pushq_cfi %rdi'

Any reason why arch/um/Kconfig.x86 has X86_32 but not X86_64? That's resulting in asm/dwarf2.h producing the 32-bit (pushl_cfi & Co) macros instead of the 64-bit ones. And I wonder what other inconsistencies this may cause...

No idea - UML seems stale. I've Cc:-ed Jeff Dike just in case.

Quoted 6 lines

If this is on purpose (i.e. simply adding X86_64 as a new config option there isn't the right solution), what would be the preferred way of fixing this in asm/dwarf2.h:
- #ifndef CONFIG_X86_32,
- #ifdef CONFIG_64BIT,
- yet something else?

Quoted 5 lines

You could try it out - UML isnt that hard to build: "make ARCH=um" and then run the
resulting binary. It will produce bootup messages then fails when mounting root.
That's enough of a build & functionality test.

That wasn't my question. What I wanted to know was, if adding X86_64 to UML's Kconfig.x86 isn't acceptable for some reason, whether any of the possible alternative forms would be preferred (all of them should work).

Anyway, I'll wait for Jeff's response on whether adjusting the UML file is going to be acceptable.

Will you want a re-submission or an incremental fix?

Jan

#6 lore raw

Re: [tip:x86/asm] x86-64: Add CFI annotations to lib/rwsem_64.S

Quoted 53 lines · Jan Beulich
Quoted 47 lines
Quoted 1 line
Quoted 1 line · Ingo Molnar
Quoted 26 lines · Jan Beulich
Quoted 26 lines
Quoted 1 line
Quoted 1 line · Ingo Molnar
Quoted 2 lines · tip-bot for Jan Beulich

Commit-ID: 39f2205e1abd1b6fffdaf45e1f1c3049a5f8999c Gitweb:

http://git.kernel.org/tip/39f2205e1abd1b6fffdaf45e1f1c3049a5f8999c

Quoted 9 lines
Author:     Jan Beulich <[email protected]>
AuthorDate: Mon, 28 Feb 2011 15:31:59 +0000
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 28 Feb 2011 18:06:21 +0100

x86-64: Add CFI annotations to lib/rwsem_64.S

These weren't part of the initial commit of this code.

Quoted 7 lines
Cc Alexander van Heukelum <[email protected]>

LKML-Reference: <[email protected]>

---
 arch/x86/lib/rwsem_64.S |   56 ++++++++++++++++++++++++++++------------------
 1 files changed, 34 insertions(+), 22 deletions(-)

this change breaks the UML build:

Quoted 7 lines
Quoted 2 lines

tip/arch/um/sys-x86_64/../../x86/lib/rwsem_64.S:46: Error: no such
instruction: `pushq_cfi %rdi'

Any reason why arch/um/Kconfig.x86 has X86_32 but not X86_64? That's resulting in asm/dwarf2.h producing the 32-bit (pushl_cfi & Co) macros instead of the 64-bit ones. And I wonder what other inconsistencies this may cause...

No idea - UML seems stale. I've Cc:-ed Jeff Dike just in case.

Quoted 6 lines

If this is on purpose (i.e. simply adding X86_64 as a new config option there isn't the right solution), what would be the preferred way of fixing this in asm/dwarf2.h:
- #ifndef CONFIG_X86_32,
- #ifdef CONFIG_64BIT,
- yet something else?

Quoted 5 lines

You could try it out - UML isnt that hard to build: "make ARCH=um" and then run the
resulting binary. It will produce bootup messages then fails when mounting root.
That's enough of a build & functionality test.

Quoted 4 lines

That wasn't my question. What I wanted to know was, if adding X86_64 to UML's Kconfig.x86 isn't acceptable for some reason, whether any of the possible alternative forms would be preferred (all of them should work).

It's probably fine as long as you test a basic UML build+boot sequence. (I described how to do that)

Quoted 2 lines

Anyway, I'll wait for Jeff's response on whether adjusting the UML file is going to be acceptable.

Please submit the proposed fix so that we can unbreak x86/asm ASAP. If there's a better solution suggested by Jeff or others we can still do that as well.

Quoted 1 line

Will you want a re-submission or an incremental fix?

Incremental fix would be nice.

Thanks,

Ingo