Skip to contentSkip to conversation

linux-next: manual merge of the tip tree with Linus' tree

DISCUSSION Stephen Rothwell 4 participants 12 messages Feb 6, 2018 – Feb 9, 2018 Linux-next tree

lore
Share & tools
lore
#0 lore raw

Hi all,

Today's linux-next merge of the tip tree got a conflict in:

arch/arm64/kernel/entry.S

between commit:

4bf3286d29f3 ("arm64: entry: Hook up entry trampoline to exception vectors")

from Linus' tree and commit:

f1e3a12b6543 ("membarrier/arm64: Provide core serializing command")

from the tip tree.

I fixed it up (probably not completely - see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts.

Signature · 34 lines
Cheers,
Stephen Rothwell

diff --cc arch/arm64/kernel/entry.S
index b34e717d7597,5edde1c2e93e..000000000000
--- a/arch/arm64/kernel/entry.S
+++ b/arch/arm64/kernel/entry.S
@@@ -324,21 -302,11 +324,25 @@@ alternative_else_nop_endi
  	ldp	x28, x29, [sp, #16 * 14]
  	ldr	lr, [sp, #S_LR]
  	add	sp, sp, #S_FRAME_SIZE		// restore sp
 +
 +	.if	\el == 0
 +alternative_insn eret, nop, ARM64_UNMAP_KERNEL_AT_EL0
 +#ifdef CONFIG_UNMAP_KERNEL_AT_EL0
 +	bne	4f
 +	msr	far_el1, x30
 +	tramp_alias	x30, tramp_exit_native
 +	br	x30
 +4:
 +	tramp_alias	x30, tramp_exit_compat
 +	br	x30
 +#endif
 +	.else
+ 	/*
+ 	 * ARCH_HAS_MEMBARRIER_SYNC_CORE rely on eret context synchronization
+ 	 * when returning from IPI handler, and when returning to user-space.
+ 	 */
 -	eret					// return to kernel
 +	eret
 +	.endif
  	.endm
  
  	.macro	irq_stack_entry
#1 lore raw
Quoted 14 lines · ----- On Feb 5, 2018, at 7:40 PM, Stephen Rothwell [email protected] wrote:

Hi all,

Today's linux-next merge of the tip tree got a conflict in:

arch/arm64/kernel/entry.S

between commit:

4bf3286d29f3 ("arm64: entry: Hook up entry trampoline to exception vectors")

from Linus' tree and commit:

f1e3a12b6543 ("membarrier/arm64: Provide core serializing command")

Quoted 8 lines

from the tip tree.

I fixed it up (probably not completely - see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts.

The change introduced by 4bf3286d29 "arm64: entry: Hook up entry trampoline to exception vectors" adds a trampoline as mechanism for return:

- eret // return to kernel
+
+#ifndef CONFIG_UNMAP_KERNEL_AT_EL0
+ eret
+#else

+       .if     \el == 0
+       bne     4f
+       msr     far_el1, x30
+       tramp_alias     x30, tramp_exit_native
+       br      x30
+4:
+       tramp_alias     x30, tramp_exit_compat
+       br      x30
+       .else
+       eret
+       .endif

+#endif

Which means that with CONFIG_UNMAP_KERNEL_AT_EL0, for return to EL0, the eret is in the trampoline:

.macro tramp_exit, regsize = 64
adr x30, tramp_vectors
msr vbar_el1, x30
tramp_unmap_kernel x30
.if \regsize == 64
mrs x30, far_el1
.endif
eret
.endm

ENTRY(tramp_exit_native)
tramp_exit
END(tramp_exit_native)

ENTRY(tramp_exit_compat)
tramp_exit 32
END(tramp_exit_compat)

One approach I would consider for this is to duplicate this comment and add it just above the "eret" instruction within the macro:

	/*
	 * ARCH_HAS_MEMBARRIER_SYNC_CORE rely on eret context synchronization
	 * when returning from IPI handler, and when returning to user-space.
	 */

Or perhaps Will has something else in mind ?

Thanks,

Mathieu

Quoted 36 lines

--
Cheers,
Stephen Rothwell

arch/arm64/kernel/entry.S +19 -1
diff --cc arch/arm64/kernel/entry.S
index b34e717d7597,5edde1c2e93e..000000000000
@@@ -324,21 -302,11 +324,25 @@@ alternative_else_nop_endi
 	ldp	x28, x29, [sp, #16 * 14]
 	ldr	lr, [sp, #S_LR]
 	add	sp, sp, #S_FRAME_SIZE		// restore sp
+
+	.if	\el == 0
+alternative_insn eret, nop, ARM64_UNMAP_KERNEL_AT_EL0
+#ifdef CONFIG_UNMAP_KERNEL_AT_EL0
+	bne	4f
+	msr	far_el1, x30
+	tramp_alias	x30, tramp_exit_native
+	br	x30
+4:
+	tramp_alias	x30, tramp_exit_compat
+	br	x30
+#endif
+	.else
+ 	/*
+ 	 * ARCH_HAS_MEMBARRIER_SYNC_CORE rely on eret context synchronization
+ 	 * when returning from IPI handler, and when returning to user-space.
+ 	 */
-	eret					// return to kernel
+	eret
+	.endif
 	.endm
 
  	.macro	irq_stack_entry
Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
#2 lore raw
Quoted 72 lines · Mathieu Desnoyers
Quoted 14 lines · ----- On Feb 5, 2018, at 7:40 PM, Stephen Rothwell [email protected] wrote:

Hi all,

Today's linux-next merge of the tip tree got a conflict in:

arch/arm64/kernel/entry.S

between commit:

4bf3286d29f3 ("arm64: entry: Hook up entry trampoline to exception vectors")

from Linus' tree and commit:

f1e3a12b6543 ("membarrier/arm64: Provide core serializing command")

Quoted 8 lines

from the tip tree.

I fixed it up (probably not completely - see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts.

The change introduced by 4bf3286d29 "arm64: entry: Hook up entry trampoline to exception vectors" adds a trampoline as mechanism for return:

(quoted diff) +16 -1
-       eret                                    // return to kernel
+
+#ifndef CONFIG_UNMAP_KERNEL_AT_EL0
+       eret
+#else
+       .if     \el == 0
+       bne     4f
+       msr     far_el1, x30
+       tramp_alias     x30, tramp_exit_native
+       br      x30
+4:
+       tramp_alias     x30, tramp_exit_compat
+       br      x30
+       .else
+       eret
+       .endif
+#endif

Which means that with CONFIG_UNMAP_KERNEL_AT_EL0, for return to EL0, the eret is in the trampoline:

.macro tramp_exit, regsize = 64
adr x30, tramp_vectors
msr vbar_el1, x30
tramp_unmap_kernel x30
.if \regsize == 64
mrs x30, far_el1
.endif
eret
.endm

ENTRY(tramp_exit_native)
tramp_exit
END(tramp_exit_native)

ENTRY(tramp_exit_compat)
tramp_exit 32
END(tramp_exit_compat)

One approach I would consider for this is to duplicate this comment and add it just above the "eret" instruction within the macro:

Quoted 6 lines
	/*
	 * ARCH_HAS_MEMBARRIER_SYNC_CORE rely on eret context synchronization
	 * when returning from IPI handler, and when returning to user-space.
	 */

Or perhaps Will has something else in mind ?

To be honest with you, I'd just drop the comment entirely. entry.S is terrifying these days and nobody should have to go in there to understand why we select ARCH_HAS_MEMBARRIER_SYNC_CORE. If you really feel a justification is needed, I'd be happy with a line in the Kconfig file.

Will

#3 lore raw
Quoted 78 lines · ----- On Feb 6, 2018, at 8:55 AM, Will Deacon [email protected] wrote:
Quoted 77 lines · Mathieu Desnoyers
Quoted 14 lines · ----- On Feb 5, 2018, at 7:40 PM, Stephen Rothwell [email protected] wrote:

Hi all,

Today's linux-next merge of the tip tree got a conflict in:

arch/arm64/kernel/entry.S

between commit:

4bf3286d29f3 ("arm64: entry: Hook up entry trampoline to exception vectors")

from Linus' tree and commit:

f1e3a12b6543 ("membarrier/arm64: Provide core serializing command")

Quoted 8 lines

from the tip tree.

I fixed it up (probably not completely - see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts.

The change introduced by 4bf3286d29 "arm64: entry: Hook up entry trampoline to exception vectors" adds a trampoline as mechanism for return:

(quoted diff) +16 -1
-       eret                                    // return to kernel
+
+#ifndef CONFIG_UNMAP_KERNEL_AT_EL0
+       eret
+#else
+       .if     \el == 0
+       bne     4f
+       msr     far_el1, x30
+       tramp_alias     x30, tramp_exit_native
+       br      x30
+4:
+       tramp_alias     x30, tramp_exit_compat
+       br      x30
+       .else
+       eret
+       .endif
+#endif

Which means that with CONFIG_UNMAP_KERNEL_AT_EL0, for return to EL0, the eret is in the trampoline:

.macro tramp_exit, regsize = 64
adr x30, tramp_vectors
msr vbar_el1, x30
tramp_unmap_kernel x30
.if \regsize == 64
mrs x30, far_el1
.endif
eret
.endm

ENTRY(tramp_exit_native)
tramp_exit
END(tramp_exit_native)

ENTRY(tramp_exit_compat)
tramp_exit 32
END(tramp_exit_compat)

One approach I would consider for this is to duplicate this comment and add it just above the "eret" instruction within the macro:

	/*
	 * ARCH_HAS_MEMBARRIER_SYNC_CORE rely on eret context synchronization
	 * when returning from IPI handler, and when returning to user-space.
	 */
Quoted 6 lines
Quoted 1 line

Or perhaps Will has something else in mind ?

To be honest with you, I'd just drop the comment entirely. entry.S is terrifying these days and nobody should have to go in there to understand why we select ARCH_HAS_MEMBARRIER_SYNC_CORE. If you really feel a justification is needed, I'd be happy with a line in the Kconfig file.

My concern is that someone wanting to optimize away a few cycles by changing eret to something else in the future will not be looking at Kconfig: that person will be staring at entry.S.

One alternative presented by PeterZ on irc is to do like ppc: define a macro for eret, and stick all appropriate comments near the macro. This way, it won't hurt when reading the code, but at least it keeps the comments near the instruction being discussed.

Thanks,

Mathieu

Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
#4 lore raw
Quoted 13 lines · Mathieu Desnoyers
Quoted 12 lines · ----- On Feb 6, 2018, at 8:55 AM, Will Deacon [email protected] wrote:
Quoted 10 lines · Mathieu Desnoyers

One approach I would consider for this is to duplicate this comment and add it just above the "eret" instruction within the macro:

	/*
	 * ARCH_HAS_MEMBARRIER_SYNC_CORE rely on eret context synchronization
	 * when returning from IPI handler, and when returning to user-space.
	 */

Or perhaps Will has something else in mind ?

Quoted 8 lines
Quoted 4 lines

To be honest with you, I'd just drop the comment entirely. entry.S is terrifying these days and nobody should have to go in there to understand why we select ARCH_HAS_MEMBARRIER_SYNC_CORE. If you really feel a justification is needed, I'd be happy with a line in the Kconfig file.

My concern is that someone wanting to optimize away a few cycles by changing eret to something else in the future will not be looking at Kconfig: that person will be staring at entry.S.

That person will probably also be me, or somebody who sits within punching distance. I really wouldn't worry about it. There a bunch of other things that will break if we don't use ERET here and, if it's a real concern, we're making the *huge* assumption that developers actually read and pay attention to comments.

Quoted 4 lines

One alternative presented by PeterZ on irc is to do like ppc: define a macro for eret, and stick all appropriate comments near the macro. This way, it won't hurt when reading the code, but at least it keeps the comments near the instruction being discussed.

For the sake of avoiding the conflict, can we just drop it for now, please? Having an "eret" macro isn't obvious, because people won't realise that it's a macro. Having "exception_return" is cryptic as hell to people familiar with the ISA.

Will

#5 lore raw
Quoted 34 lines · ----- On Feb 6, 2018, at 9:11 AM, Will Deacon [email protected] wrote:
Quoted 13 lines · Mathieu Desnoyers
Quoted 12 lines · ----- On Feb 6, 2018, at 8:55 AM, Will Deacon [email protected] wrote:
Quoted 10 lines · Mathieu Desnoyers

One approach I would consider for this is to duplicate this comment and add it just above the "eret" instruction within the macro:

	/*
	 * ARCH_HAS_MEMBARRIER_SYNC_CORE rely on eret context synchronization
	 * when returning from IPI handler, and when returning to user-space.
	 */

Or perhaps Will has something else in mind ?

Quoted 8 lines
Quoted 4 lines

To be honest with you, I'd just drop the comment entirely. entry.S is terrifying these days and nobody should have to go in there to understand why we select ARCH_HAS_MEMBARRIER_SYNC_CORE. If you really feel a justification is needed, I'd be happy with a line in the Kconfig file.

My concern is that someone wanting to optimize away a few cycles by changing eret to something else in the future will not be looking at Kconfig: that person will be staring at entry.S.

That person will probably also be me, or somebody who sits within punching distance. I really wouldn't worry about it. There a bunch of other things that will break if we don't use ERET here and, if it's a real concern, we're making the *huge* assumption that developers actually read and pay attention to comments.

Quoted 4 lines

One alternative presented by PeterZ on irc is to do like ppc: define a macro for eret, and stick all appropriate comments near the macro. This way, it won't hurt when reading the code, but at least it keeps the comments near the instruction being discussed.

Quoted 4 lines

For the sake of avoiding the conflict, can we just drop it for now, please? Having an "eret" macro isn't obvious, because people won't realise that it's a macro. Having "exception_return" is cryptic as hell to people familiar with the ISA.

I'd be OK not adding comments in the assembly provided that we document this within the new documentation file as I just posted as RFC:

http://lkml.kernel.org/r/[email protected]

Thoughts ?

Thanks,

Mathieu

Quoted 2 lines

Will

Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
#6 lore raw
Quoted 41 lines · Mathieu Desnoyers
Quoted 34 lines · ----- On Feb 6, 2018, at 9:11 AM, Will Deacon [email protected] wrote:
Quoted 13 lines · Mathieu Desnoyers
Quoted 12 lines · ----- On Feb 6, 2018, at 8:55 AM, Will Deacon [email protected] wrote:
Quoted 10 lines · Mathieu Desnoyers

One approach I would consider for this is to duplicate this comment and add it just above the "eret" instruction within the macro:

	/*
	 * ARCH_HAS_MEMBARRIER_SYNC_CORE rely on eret context synchronization
	 * when returning from IPI handler, and when returning to user-space.
	 */

Or perhaps Will has something else in mind ?

Quoted 8 lines
Quoted 4 lines

To be honest with you, I'd just drop the comment entirely. entry.S is terrifying these days and nobody should have to go in there to understand why we select ARCH_HAS_MEMBARRIER_SYNC_CORE. If you really feel a justification is needed, I'd be happy with a line in the Kconfig file.

My concern is that someone wanting to optimize away a few cycles by changing eret to something else in the future will not be looking at Kconfig: that person will be staring at entry.S.

That person will probably also be me, or somebody who sits within punching distance. I really wouldn't worry about it. There a bunch of other things that will break if we don't use ERET here and, if it's a real concern, we're making the *huge* assumption that developers actually read and pay attention to comments.

Quoted 4 lines

One alternative presented by PeterZ on irc is to do like ppc: define a macro for eret, and stick all appropriate comments near the macro. This way, it won't hurt when reading the code, but at least it keeps the comments near the instruction being discussed.

Quoted 4 lines

For the sake of avoiding the conflict, can we just drop it for now, please? Having an "eret" macro isn't obvious, because people won't realise that it's a macro. Having "exception_return" is cryptic as hell to people familiar with the ISA.

Quoted 6 lines

I'd be OK not adding comments in the assembly provided that we document this within the new documentation file as I just posted as RFC:

http://lkml.kernel.org/r/[email protected]

Thoughts ?

I certainly think that Documentation/ and probably init/Kconfig are the right places to describe this, but I defer to Ingo on whether or not arch-support.txt is ok with free-form text comments.

Will

#7 lore raw
In reply to Will Deacon
Quoted 1 line · Will Deacon

For the sake of avoiding the conflict, can we just drop it for now, please?

Yeah, so I resolved the conflict by merging the (already upstream) bits and Linus pulled that resolution. From now on the level of comments you want there is up to you! :-)

Thanks,

Ingo

#8 lore raw
Quoted 8 lines · Ingo Molnar
Quoted 1 line · Will Deacon

For the sake of avoiding the conflict, can we just drop it for now, please?

Yeah, so I resolved the conflict by merging the (already upstream) bits and Linus pulled that resolution. From now on the level of comments you want there is up to you! :-)

Haha, ok! Mathieu -- are you still planning to add something under Documentation/? Regardless of my preference on comments, I think it would be useful.

Will

#9 lore raw
Quoted 12 lines · ----- On Feb 8, 2018, at 1:56 PM, Will Deacon [email protected] wrote:
Quoted 10 lines · Ingo Molnar
Quoted 1 line · Will Deacon

For the sake of avoiding the conflict, can we just drop it for now, please?

Yeah, so I resolved the conflict by merging the (already upstream) bits and Linus
pulled that resolution. From now on the level of comments you want there is up to
you! :-)

Quoted 3 lines

Haha, ok! Mathieu -- are you still planning to add something under Documentation/? Regardless of my preference on comments, I think it would be useful.

I submitted it as RFC a few days ago, and I'm still awaiting feedback:

http://lkml.kernel.org/r/[email protected]

If you guys are OK with the approach, I can submit it again, this time without the RFC tag.

Thanks,

Mathieu

Quoted 2 lines

Will

Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
#10 lore raw
Quoted 18 lines · Mathieu Desnoyers
Quoted 12 lines · ----- On Feb 8, 2018, at 1:56 PM, Will Deacon [email protected] wrote:
Quoted 10 lines · Ingo Molnar
Quoted 1 line · Will Deacon

For the sake of avoiding the conflict, can we just drop it for now, please?

Yeah, so I resolved the conflict by merging the (already upstream) bits and Linus
pulled that resolution. From now on the level of comments you want there is up to
you! :-)

Quoted 3 lines

Haha, ok! Mathieu -- are you still planning to add something under Documentation/? Regardless of my preference on comments, I think it would be useful.

Quoted 6 lines

I submitted it as RFC a few days ago, and I'm still awaiting feedback:

http://lkml.kernel.org/r/[email protected]

If you guys are OK with the approach, I can submit it again, this time without the RFC tag.

Yes, please!

Will

#11 lore raw
Quoted 21 lines · ----- On Feb 9, 2018, at 1:25 PM, Will Deacon [email protected] wrote:
Quoted 20 lines · Mathieu Desnoyers
Quoted 12 lines · ----- On Feb 8, 2018, at 1:56 PM, Will Deacon [email protected] wrote:
Quoted 10 lines · Ingo Molnar
Quoted 1 line · Will Deacon

For the sake of avoiding the conflict, can we just drop it for now, please?

Yeah, so I resolved the conflict by merging the (already upstream) bits and Linus
pulled that resolution. From now on the level of comments you want there is up to
you! :-)

Quoted 3 lines

Haha, ok! Mathieu -- are you still planning to add something under Documentation/? Regardless of my preference on comments, I think it would be useful.

I submitted it as RFC a few days ago, and I'm still awaiting feedback:

Quoted 7 lines
Quoted 5 lines

http://lkml.kernel.org/r/[email protected]

If you guys are OK with the approach, I can submit it again, this time without the RFC
tag.

Yes, please!

Done: https://lkml.kernel.org/r/[email protected]

Let's see what Thomas/Ingo/PeterZ have to say about this approach to documentation. Ingo, if you are OK with it, this feature documentation patch could go through the scheduler tree.

Thanks,

Mathieu

Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com