Deadlock between cores is possible if two cores can acquire spinlocks in different orders. AUTOSAR OS solves this via OsSpinlockSuccessor: it defines a mandatory acquisition order that the OS verifies at runtime (in development builds with SpinlockOrderCheck enabled).
SPINLOCK_NVM_REQUEST
/Os/Spinlocks/SPINLOCK_DEM_STATUS
SPINLOCK_DEM_STATUS
⚠️ Acquisition Order is a Global Invariant
Every code path on every core that acquires multiple spinlocks must acquire them in the order defined by OsSpinlockSuccessor. A single violation (a Core 1 task acquiring SPINLOCK_DEM before SPINLOCK_NVM while Core 0 does the opposite) causes a system deadlock that only manifests under race conditions — typically impossible to reproduce in testing. Use AUTOSAR OS SpinlockOrderCheck=TRUE in all development builds to catch violations at runtime before release.