diff mbox

arm: Hook up SYNC_CORE functionality for sys_membarrier()

Message ID 1529410974-18929-1-git-send-email-will.deacon@arm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Will Deacon June 19, 2018, 12:22 p.m. UTC
Exception return implies context synchronization, so we can hook up the
SYNC_CORE option to sys_membarrier() simply by selecting the Kconfig option,
just like we've done for arm64 already.

Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Orion Hodson <oth@google.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm/Kconfig | 1 +
 1 file changed, 1 insertion(+)

Comments

Mathieu Desnoyers June 19, 2018, 12:50 p.m. UTC | #1
----- On Jun 19, 2018, at 8:22 AM, Will Deacon will.deacon@arm.com wrote:

> Exception return implies context synchronization, so we can hook up the
> SYNC_CORE option to sys_membarrier() simply by selecting the Kconfig option,
> just like we've done for arm64 already.
> 
> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> Cc: Orion Hodson <oth@google.com>
> Signed-off-by: Will Deacon <will.deacon@arm.com>
> ---
> arch/arm/Kconfig | 1 +
> 1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 54eeb8d00bc6..b0ac18547370 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -9,6 +9,7 @@ config ARM
> 	select ARCH_HAS_ELF_RANDOMIZE
> 	select ARCH_HAS_FORTIFY_SOURCE
> 	select ARCH_HAS_KCOV
> +	select ARCH_HAS_MEMBARRIER_SYNC_CORE

In addition to this, we added this comment in arch/arm64/kernel/entry.S:

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

So I would expect a similar comment in arch/arm/kernel/entry-header.S, within
svc_exit and svc_exit_via_fiq:

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

Which instruction exactly is responsible for context synchronization on
arm32 ?

Thanks,

Mathieu



> 	select ARCH_HAS_PTE_SPECIAL if ARM_LPAE
> 	select ARCH_HAS_PHYS_TO_DMA
> 	select ARCH_HAS_SET_MEMORY
> --
> 2.1.4
Mathieu Desnoyers June 19, 2018, 1:03 p.m. UTC | #2
----- On Jun 19, 2018, at 8:58 AM, Will Deacon will.deacon@arm.com wrote:

> Hi Mathieu,
> 
> On Tue, Jun 19, 2018 at 08:50:02AM -0400, Mathieu Desnoyers wrote:
>> ----- On Jun 19, 2018, at 8:22 AM, Will Deacon will.deacon@arm.com wrote:
>> 
>> > Exception return implies context synchronization, so we can hook up the
>> > SYNC_CORE option to sys_membarrier() simply by selecting the Kconfig option,
>> > just like we've done for arm64 already.
>> > 
>> > Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
>> > Cc: Orion Hodson <oth@google.com>
>> > Signed-off-by: Will Deacon <will.deacon@arm.com>
>> > ---
>> > arch/arm/Kconfig | 1 +
>> > 1 file changed, 1 insertion(+)
>> > 
>> > diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
>> > index 54eeb8d00bc6..b0ac18547370 100644
>> > --- a/arch/arm/Kconfig
>> > +++ b/arch/arm/Kconfig
>> > @@ -9,6 +9,7 @@ config ARM
>> > 	select ARCH_HAS_ELF_RANDOMIZE
>> > 	select ARCH_HAS_FORTIFY_SOURCE
>> > 	select ARCH_HAS_KCOV
>> > +	select ARCH_HAS_MEMBARRIER_SYNC_CORE
>> 
>> In addition to this, we added this comment in arch/arm64/kernel/entry.S:
>> 
>> +       /*
>> +        * ARCH_HAS_MEMBARRIER_SYNC_CORE rely on eret context synchronization
>> +        * when returning from IPI handler, and when returning to user-space.
>> +        */
>> 
>> So I would expect a similar comment in arch/arm/kernel/entry-header.S, within
>> svc_exit and svc_exit_via_fiq:
>> 
>>         /*
>>          * ARCH_HAS_MEMBARRIER_SYNC_CORE rely on [insn] context synchronization
>>          * when returning from IPI handler, and when returning to user-space.
>>          */
> 
> Bah, you know I hate that comment ;) I should update arch-support.txt,
> though. Diff below.

It works for me with this update, thanks!

Mathieu
diff mbox

Patch

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 54eeb8d00bc6..b0ac18547370 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -9,6 +9,7 @@  config ARM
 	select ARCH_HAS_ELF_RANDOMIZE
 	select ARCH_HAS_FORTIFY_SOURCE
 	select ARCH_HAS_KCOV
+	select ARCH_HAS_MEMBARRIER_SYNC_CORE
 	select ARCH_HAS_PTE_SPECIAL if ARM_LPAE
 	select ARCH_HAS_PHYS_TO_DMA
 	select ARCH_HAS_SET_MEMORY