Skip to contentSkip to conversation

Cortex A9 MP: ARM errata 754323 implementation?

DISCUSSION Dirk Behme 4 participants 6 messages Sep 3, 2015 – Sep 4, 2015

lore
Share & tools
lore

Dirk Behme

author
#0 lore raw

Hi,

looking through the ARM Cortex A9 errata list [1] I wonder why we don't have a workaround for

(754323) Repeated Store in the same cache line might delay the visibility of the Store

in the kernel? Or have I missed it?

We do have the workaround for the related erratum #754327 implemented [2], but that is supposed only for cores prior to r2p0.

While #754323 seems to affect all newer cores, too?

Any idea?

Best regards

Dirk

[1] ARM Cortex-A9 processors
r4 releases
Software Developers Errata Notice
ARM UAN 0009D (ID032315)

[2]
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm/Kconfig#n1196

#1 lore raw
Quoted 7 lines · Dirk Behme

looking through the ARM Cortex A9 errata list [1] I wonder why we don't have a workaround for

(754323) Repeated Store in the same cache line might delay the visibility of the Store

in the kernel? Or have I missed it?

The policy for errata is not to implement them unless there's a requirement to do so - and then the errata should be implemented in board firmware in preference to the kernel where possible.

Are you seeing a problem directly attributable to this errata?

Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
author
#2 lore raw
Quoted 7 lines · Russell King - ARM Linux
Quoted 6 lines · Dirk Behme

looking through the ARM Cortex A9 errata list [1] I wonder why we don't have a workaround for

(754323) Repeated Store in the same cache line might delay the visibility of the Store

Quoted 7 lines
Quoted 1 line

in the kernel? Or have I missed it?

The policy for errata is not to implement them unless there's a requirement to do so - and then the errata should be implemented in board firmware in preference to the kernel where possible.

Are you seeing a problem directly attributable to this errata?

I got a report from some internal testing that an issue they see goes away if they enable 754327. I rejected this because i.MX6 is > r2p0 and therefore can't be affected by this errata. Looking through the list of erratas I then found the related 754323 which seems to apply to i.MX6, but is not implemented.

The issue we are talking about is

Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
PC is at kfree+0x10c/0x238
LR is at release_firmware+0x5c/0x70

which is said to be triggered by this code

void kfree(const void *x)
...
page = virt_to_head_page(x);
if (unlikely(!PageSlab(page))) {
BUG_ON(!PageCompound(page));
...

on a custom 3.14.x kernel. I haven't looked into this myself, but at least two people think that the kmalloc/kfree is correct with the request_firmware()/release_firmware() usage in the driver.

Best regards

Dirk

#3 lore raw
Quoted 14 lines · Dirk Behme
Quoted 13 lines · Russell King - ARM Linux
Quoted 7 lines · Dirk Behme

looking through the ARM Cortex A9 errata list [1] I wonder why we don't have a workaround for

(754323) Repeated Store in the same cache line might delay the visibility of the Store

in the kernel? Or have I missed it?

The policy for errata is not to implement them unless there's a requirement to do so - and then the errata should be implemented in board firmware in preference to the kernel where possible.

Quoted 7 lines
Quoted 1 line

Are you seeing a problem directly attributable to this errata?

I got a report from some internal testing that an issue they see goes away if they enable 754327. I rejected this because i.MX6 is > r2p0 and therefore can't be affected by this errata. Looking through the list of erratas I then found the related 754323 which seems to apply to i.MX6, but is not implemented.

These errata are usually harmless, in most cases it prevents the system from making progress (like flag update not visible while being polled by another CPU), hence the workaround makes cpu_relax() a barrier since most polling loops should use it.

Quoted 15 lines

The issue we are talking about is

Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
PC is at kfree+0x10c/0x238
LR is at release_firmware+0x5c/0x70

which is said to be triggered by this code

void kfree(const void *x)
...
page = virt_to_head_page(x);
if (unlikely(!PageSlab(page))) {
BUG_ON(!PageCompound(page));
...

Quoted 3 lines

on a custom 3.14.x kernel. I haven't looked into this myself, but at least two people think that the kmalloc/kfree is correct with the request_firmware()/release_firmware() usage in the driver.

I don't see how the erratum above would trigger a BUG. It's possible that there are some memory ordering issues (and A9 has some read after read bugs) that are hidden when enabling the barrier in cpu_relax().

Signature · 1 line
Catalin
#4 lore raw
Quoted 43 lines · Catalin Marinas
Quoted 14 lines · Dirk Behme
Quoted 13 lines · Russell King - ARM Linux
Quoted 7 lines · Dirk Behme

looking through the ARM Cortex A9 errata list [1] I wonder why we don't have a workaround for

(754323) Repeated Store in the same cache line might delay the visibility of the Store

in the kernel? Or have I missed it?

The policy for errata is not to implement them unless there's a requirement to do so - and then the errata should be implemented in board firmware in preference to the kernel where possible.

Quoted 7 lines
Quoted 1 line

Are you seeing a problem directly attributable to this errata?

I got a report from some internal testing that an issue they see goes away if they enable 754327. I rejected this because i.MX6 is > r2p0 and therefore can't be affected by this errata. Looking through the list of erratas I then found the related 754323 which seems to apply to i.MX6, but is not implemented.

These errata are usually harmless, in most cases it prevents the system from making progress (like flag update not visible while being polled by another CPU), hence the workaround makes cpu_relax() a barrier since most polling loops should use it.

Quoted 15 lines

The issue we are talking about is

Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
PC is at kfree+0x10c/0x238
LR is at release_firmware+0x5c/0x70

which is said to be triggered by this code

void kfree(const void *x)
...
page = virt_to_head_page(x);
if (unlikely(!PageSlab(page))) {
BUG_ON(!PageCompound(page));
...

Quoted 7 lines
Quoted 3 lines

on a custom 3.14.x kernel. I haven't looked into this myself, but at least two people think that the kmalloc/kfree is correct with the request_firmware()/release_firmware() usage in the driver.

I don't see how the erratum above would trigger a BUG. It's possible that there are some memory ordering issues (and A9 has some read after read bugs) that are hidden when enabling the barrier in cpu_relax().

Do you have anything specific in mind we could try? Besides enabling 754327?

Best regards

Dirk

#5 lore raw
Quoted 48 lines · Dirk Behme
Quoted 47 lines · Catalin Marinas
Quoted 14 lines · Dirk Behme
Quoted 13 lines · Russell King - ARM Linux
Quoted 7 lines · Dirk Behme

looking through the ARM Cortex A9 errata list [1] I wonder why we don't have a workaround for

(754323) Repeated Store in the same cache line might delay the visibility of the Store

in the kernel? Or have I missed it?

The policy for errata is not to implement them unless there's a requirement to do so - and then the errata should be implemented in board firmware in preference to the kernel where possible.

Quoted 7 lines
Quoted 1 line

Are you seeing a problem directly attributable to this errata?

I got a report from some internal testing that an issue they see goes away if they enable 754327. I rejected this because i.MX6 is > r2p0 and therefore can't be affected by this errata. Looking through the list of erratas I then found the related 754323 which seems to apply to i.MX6, but is not implemented.

These errata are usually harmless, in most cases it prevents the system from making progress (like flag update not visible while being polled by another CPU), hence the workaround makes cpu_relax() a barrier since most polling loops should use it.

Quoted 18 lines

The issue we are talking about is

Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
PC is at kfree+0x10c/0x238
LR is at release_firmware+0x5c/0x70

which is said to be triggered by this code

void kfree(const void *x)
...
page = virt_to_head_page(x);
if (unlikely(!PageSlab(page))) {
BUG_ON(!PageCompound(page));
...

on a custom 3.14.x kernel. I haven't looked into this myself, but at least two people think that the kmalloc/kfree is correct with the request_firmware()/release_firmware() usage in the driver.

Quoted 5 lines
Quoted 3 lines

I don't see how the erratum above would trigger a BUG. It's possible that there are some memory ordering issues (and A9 has some read after read bugs) that are hidden when enabling the barrier in cpu_relax().

Do you have anything specific in mind we could try? Besides enabling 754327?

You may hit erratum 761319. There is a more detailed explanation here:

http://infocenter.arm.com/help/topic/com.arm.doc.uan0004a/UAN0004A_a9_read_read.pdf

But there isn't much we can do in the kernel, other than recompiling it with a gcc that can work around the erratum. Searching for this erratum number and gcc seems to show some patches adding -mfix-cortex-a9-volatile-hazards but I can't tell when/whether they've been merged in gcc.

For this specific case, you could place a DMB (smp_mb) before BUG_ON to see if this hunk is causing the problem.

Signature · 1 line
Catalin