Spinlock Lite: Efficient locking to simplify migration of legacy systems to multicore in AUTOSAR
In this work, we explored the spinlock requirement and design in detail to understand its usage and proposed an alternate and light weight spinlock primitive. Existing work on Spinlock was sparse in the domain of embedded systems, hence, we took inspiration from several sources while improving upon the existing spinlock while maintaining the core functionality. Our approach showed a significant reduction of around 70% in overhead associated with locking with a significant portion of this reduction coming from moving the locking itself to user-space and thus avoiding costly context-switching for the most common use-case. The decrease in overhead is associated with a slight increase in probability of corruption due to interference from user software. However, it can be easily mitigated via increased testing and verification which is common in embedded industry. Our proposed work would enable utilization of multiple cores for existing AUTOSAR applications and significantly reduce the system cost by reducing the hardware involved with minimal changes to the software.
Automotive industry is starting to embrace the power of multicore with the recent advent of powerful multicore MCUs emerging with ARM, PowerPC, TriCore families of processors. Multicore software in AUTOSAR requires the use of Spinlock primitives for cross-core synchronization. When compared to local core synchronization primitives, Spinlocks defined by AUTOSAR OS are bulky. This hinders the re-use and scalability of existing software to multiple cores by adding supplemental overhead and requiring a significant refactoring of the existing code.
In this work, we explored the spinlock requirement and design in detail to understand its usage and proposed an alternate and light weight spinlock primitive. Existing work on Spinlock was sparse in the domain of embedded systems, hence, we took inspiration from several sources while improving upon the existing spinlock while maintaining the core functionality. Our approach showed a significant reduction of around 70% in overhead associated with locking with a significant portion of this reduction coming from moving the locking itself to user-space and thus avoiding costly context-switching for the most common use-case. The decrease in overhead is associated with a slight increase in probability of corruption due to interference from user software. However, it can be easily mitigated via increased testing and verification which is common in embedded industry. Our proposed work would enable utilization of multiple cores for existing AUTOSAR applications and significantly reduce the system cost by reducing the hardware involved with minimal changes to the software.