Data Memory Barrier ARMv6 question

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Data Memory Barrier ARMv6 question

Caio Lima
Hi all.

I'm working in this patch
(https://bugs.webkit.org/show_bug.cgi?id=172767) and Mark Lam raised
some questions about the data memory barrier (DMB for short) in ARMv6
using "mcr 15 ...". The point is that we are having divergences in ARM
official reference manual about the semantics of this instruction. We
have it discussed in the bug above and I would like to know if there
is somebody with stronger ARM background that could help us there and
then approve the patch to be committed.

I thanks in advance and best regards,
Caio Lima.
_______________________________________________
webkit-dev mailing list
[hidden email]
https://lists.webkit.org/mailman/listinfo/webkit-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Data Memory Barrier ARMv6 question

JF Bastien-2
On Linux you can do the following:
((void(*)())0xffff0fa0)();

That address contains a helper which does the “right” barrier, including if you’re not on an SMP system it’ll do nothing.

That file also lists other Linux helpers.

I think for ARMv6 it makes sense to use these helpers. AFAIK the mcr barrier instruction ins’t supported by all ARMv6 CPUs.

For ARMv7 and later, DMB ish is the right thing.


On Jul 3, 2017, at 17:19, Caio Lima <[hidden email]> wrote:

Hi all.

I'm working in this patch
(https://bugs.webkit.org/show_bug.cgi?id=172767) and Mark Lam raised
some questions about the data memory barrier (DMB for short) in ARMv6
using "mcr 15 ...". The point is that we are having divergences in ARM
official reference manual about the semantics of this instruction. We
have it discussed in the bug above and I would like to know if there
is somebody with stronger ARM background that could help us there and
then approve the patch to be committed.

I thanks in advance and best regards,
Caio Lima.
_______________________________________________
webkit-dev mailing list
[hidden email]
https://lists.webkit.org/mailman/listinfo/webkit-dev


_______________________________________________
webkit-dev mailing list
[hidden email]
https://lists.webkit.org/mailman/listinfo/webkit-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Data Memory Barrier ARMv6 question

Filip Pizlo
We should not use those helpers, especially in the JIT. It does not make sense for the JIT to emit calls to system functions when the user is expecting it to emit an instruction. If we cannot perfectly select the right barrier on a particular CPU, we should disable concurrency on that CPU. 

-Filip

On Jul 5, 2017, at 8:41 AM, JF Bastien <[hidden email]> wrote:

On Linux you can do the following:
((void(*)())0xffff0fa0)();

That address contains a helper which does the “right” barrier, including if you’re not on an SMP system it’ll do nothing.

That file also lists other Linux helpers.

I think for ARMv6 it makes sense to use these helpers. AFAIK the mcr barrier instruction ins’t supported by all ARMv6 CPUs.

For ARMv7 and later, DMB ish is the right thing.


On Jul 3, 2017, at 17:19, Caio Lima <[hidden email]> wrote:

Hi all.

I'm working in this patch
(https://bugs.webkit.org/show_bug.cgi?id=172767) and Mark Lam raised
some questions about the data memory barrier (DMB for short) in ARMv6
using "mcr 15 ...". The point is that we are having divergences in ARM
official reference manual about the semantics of this instruction. We
have it discussed in the bug above and I would like to know if there
is somebody with stronger ARM background that could help us there and
then approve the patch to be committed.

I thanks in advance and best regards,
Caio Lima.
_______________________________________________
webkit-dev mailing list
[hidden email]
https://lists.webkit.org/mailman/listinfo/webkit-dev

_______________________________________________
webkit-dev mailing list
[hidden email]
https://lists.webkit.org/mailman/listinfo/webkit-dev

_______________________________________________
webkit-dev mailing list
[hidden email]
https://lists.webkit.org/mailman/listinfo/webkit-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Data Memory Barrier ARMv6 question

JF Bastien-2
Alternatively, the JIT can read the content of these addresses and write them back as-is 😭

On Jul 5, 2017, at 09:01, Filip Pizlo <[hidden email]> wrote:

We should not use those helpers, especially in the JIT. It does not make sense for the JIT to emit calls to system functions when the user is expecting it to emit an instruction. If we cannot perfectly select the right barrier on a particular CPU, we should disable concurrency on that CPU. 

-Filip

On Jul 5, 2017, at 8:41 AM, JF Bastien <[hidden email]> wrote:

On Linux you can do the following:
((void(*)())0xffff0fa0)();

That address contains a helper which does the “right” barrier, including if you’re not on an SMP system it’ll do nothing.

That file also lists other Linux helpers.

I think for ARMv6 it makes sense to use these helpers. AFAIK the mcr barrier instruction ins’t supported by all ARMv6 CPUs.

For ARMv7 and later, DMB ish is the right thing.


On Jul 3, 2017, at 17:19, Caio Lima <[hidden email]> wrote:

Hi all.

I'm working in this patch
(https://bugs.webkit.org/show_bug.cgi?id=172767) and Mark Lam raised
some questions about the data memory barrier (DMB for short) in ARMv6
using "mcr 15 ...". The point is that we are having divergences in ARM
official reference manual about the semantics of this instruction. We
have it discussed in the bug above and I would like to know if there
is somebody with stronger ARM background that could help us there and
then approve the patch to be committed.

I thanks in advance and best regards,
Caio Lima.
_______________________________________________
webkit-dev mailing list
[hidden email]
https://lists.webkit.org/mailman/listinfo/webkit-dev

_______________________________________________
webkit-dev mailing list
[hidden email]
https://lists.webkit.org/mailman/listinfo/webkit-dev


_______________________________________________
webkit-dev mailing list
[hidden email]
https://lists.webkit.org/mailman/listinfo/webkit-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Data Memory Barrier ARMv6 question

Caio Lima
In reply to this post by JF Bastien-2
2017-07-05 12:41 GMT-03:00 JF Bastien <[hidden email]>:

> On Linux you can do the following:
>
> ((void(*)())0xffff0fa0)();
>
>
> That address contains a helper which does the “right” barrier, including if
> you’re not on an SMP system it’ll do nothing.
>
> Details:
> https://www.kernel.org/doc/Documentation/arm/kernel_user_helpers.txt
> That file also lists other Linux helpers.
>
> I think for ARMv6 it makes sense to use these helpers. AFAIK the mcr barrier
> instruction ins’t supported by all ARMv6 CPUs.

Hi JF. Do you mind point me where the mcr isn't supported by all ARMv6
CPU? I've found in ARMv6-M manual
(http://infocenter.arm.com/help/topic/com.arm.doc.ddi0419d/DDI0419D_armv6m_arm.pdf)
that it doesn't support coprocessor operations, but this architecture
is used by microcontroller chips.

Regards,
Caio.

> For ARMv7 and later, DMB ish is the right thing.
>
>
> On Jul 3, 2017, at 17:19, Caio Lima <[hidden email]> wrote:
>
> Hi all.
>
> I'm working in this patch
> (https://bugs.webkit.org/show_bug.cgi?id=172767) and Mark Lam raised
> some questions about the data memory barrier (DMB for short) in ARMv6
> using "mcr 15 ...". The point is that we are having divergences in ARM
> official reference manual about the semantics of this instruction. We
> have it discussed in the bug above and I would like to know if there
> is somebody with stronger ARM background that could help us there and
> then approve the patch to be committed.
>
> I thanks in advance and best regards,
> Caio Lima.
> _______________________________________________
> webkit-dev mailing list
> [hidden email]
> https://lists.webkit.org/mailman/listinfo/webkit-dev
>
>
_______________________________________________
webkit-dev mailing list
[hidden email]
https://lists.webkit.org/mailman/listinfo/webkit-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Data Memory Barrier ARMv6 question

JF Bastien-2


> On Jul 5, 2017, at 19:19, Caio Lima <[hidden email]> wrote:
>
> 2017-07-05 12:41 GMT-03:00 JF Bastien <[hidden email]>:
>> On Linux you can do the following:
>>
>> ((void(*)())0xffff0fa0)();
>>
>>
>> That address contains a helper which does the “right” barrier, including if
>> you’re not on an SMP system it’ll do nothing.
>>
>> Details:
>> https://www.kernel.org/doc/Documentation/arm/kernel_user_helpers.txt
>> That file also lists other Linux helpers.
>>
>> I think for ARMv6 it makes sense to use these helpers. AFAIK the mcr barrier
>> instruction ins’t supported by all ARMv6 CPUs.
>
> Hi JF. Do you mind point me where the mcr isn't supported by all ARMv6
> CPU? I've found in ARMv6-M manual
> (http://infocenter.arm.com/help/topic/com.arm.doc.ddi0419d/DDI0419D_armv6m_arm.pdf)
> that it doesn't support coprocessor operations, but this architecture
> is used by microcontroller chips.

I unfortunately don’t have a reference for this, but yes IIUC it’s either UP systems or non-A profile CPUs.

> Regards,
> Caio.
>
>> For ARMv7 and later, DMB ish is the right thing.
>>
>>
>> On Jul 3, 2017, at 17:19, Caio Lima <[hidden email]> wrote:
>>
>> Hi all.
>>
>> I'm working in this patch
>> (https://bugs.webkit.org/show_bug.cgi?id=172767) and Mark Lam raised
>> some questions about the data memory barrier (DMB for short) in ARMv6
>> using "mcr 15 ...". The point is that we are having divergences in ARM
>> official reference manual about the semantics of this instruction. We
>> have it discussed in the bug above and I would like to know if there
>> is somebody with stronger ARM background that could help us there and
>> then approve the patch to be committed.
>>
>> I thanks in advance and best regards,
>> Caio Lima.
>> _______________________________________________
>> webkit-dev mailing list
>> [hidden email]
>> https://lists.webkit.org/mailman/listinfo/webkit-dev
>>
>>

_______________________________________________
webkit-dev mailing list
[hidden email]
https://lists.webkit.org/mailman/listinfo/webkit-dev
Loading...