SChernykh / p2pool

Decentralized pool for Monero mining
GNU General Public License v3.0
1.03k stars 124 forks source link

ARM Cortex A-53 / 72 errata mitigations #189

Closed shermand100 closed 10 months ago

shermand100 commented 1 year ago

Applicable to all ARM A-53 single board computers but primarily targeted at Raspberry Pi 3&4 users as those will be the most numerous:

There are known faults at the chip level with ARM Cortex A-53, as per the Arm Developer errata notice developer.arm.com/documentation where:

835769: AArch64 multiply-accumulate instruction might produce incorrect result (page 20 of that document) and 843419: A load or store might access an incorrect address (page 22)

To mitigate for this gcc has additional build flags:

https://gcc.gnu.org/onlinedocs/gcc.pdf (Page 315)

-mfix-cortex-a53-835769 -mno-fix-cortex-a53-835769 _Enable or disable the workaround for the ARM Cortex-A53 erratum number

  1. This involves inserting a NOP instruction between memory instructions and 64-bit integer multiply-accumulate instructions._

-mfix-cortex-a53-843419 -mno-fix-cortex-a53-843419 _Enable or disable the workaround for the ARM Cortex-A53 erratum number

  1. This erratum workaround is made at link time and this will only pass the corresponding flag to the linker._

Which Monero implemented:

monero-project/monero/commit/cf10e05cc6a0ed495dbdd44ec3a76b964b14edba

And can be seen working/triggered as during build.

Is this applicable through any of the pools verification functions?

shermand100 commented 1 year ago

Draft Pull Request as not sure how applicable. I'm assuming P2Pool performs verification checks on miners submissions, possibly triggering this error?

SChernykh commented 1 year ago

I have Raspberry Pi 3b+ and P2Pool runs just fine there.

SChernykh commented 1 year ago

Actually... The mystery is solved now :D https://github.com/tevador/RandomX/commit/457c0e4a547b27d3484d84bbe978870c3f037092

SChernykh commented 10 months ago

I've added these command line flags to build scripts: https://github.com/SChernykh/p2pool/commit/8d9b9e505e08e5d188cf163bb177d4fc833b0391

shermand100 commented 8 months ago

Glad to see this has been useful, even as an awareness piece for RandomX hardware issues.