Bug 15618

Summary: qemuarmv5: mrc considered an illegal instruction (as used by python 3.13)
Product: [Build System, Metadata & Runtime] BSPs Reporter: Alexander Kanavin <alex.kanavin>
Component: bsps-oe-coreAssignee: Ross Burton <ross.burton>
Status: RESOLVED ReportedUpstream QA Contact:
Severity: normal    
Priority: Medium+ CC: diego.russo, richard.purdie, ross.burton
Version: unspecified   
Target Milestone: 5.2 M1   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Alexander Kanavin 2024-10-11 13:21:18 UTC
Python 3.13 introduced usage of mrc instructions via inline assembly:

https://github.com/python/cpython/blob/main/Include/object.h#L195
https://github.com/python/cpython/blob/main/Include/internal/mimalloc/mimalloc/prim.h#L172
https://github.com/python/cpython/blob/main/Include/internal/mimalloc/mimalloc/prim.h#L199

This seems to work ok in qemuarm (I didn't specifically confirm that these code paths are executed though), but in qemuarmv5 it throws 'Illegal instruction'.

It isn't clear if qemu makes incorrect decisions, or the instruction as specified by python is indeed not universal on arm hardware.

For now, I was able to disable the use of it via disabling mimalloc feature on armv5 targets.
Comment 1 Ross Burton 2024-10-14 10:53:13 UTC
Filed upstream at https://github.com/python/cpython/issues/125444.
Comment 2 Ross Burton 2024-10-17 14:34:12 UTC
Upstream has now resolved this issue in the 3.13.x branch and we don't have 3.13.0 yet. Closing as filed upstream, we'll backport the fix for the upgrade.