kernel/spinlock: Predicate spinlock validation on flash size
The spinlock validation isn't super lightweight -- it adds only a few tens of bytess per call, but there are a LOT of locking calls. On smaller platforms with 32kb of flash, we're bumping into code size limits on the bigger tests (tests/kernel/poll is a particular offender). Check the declared flash size before enabling it. Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
parent
a4614372f9
commit
9c2c115716
1 changed files with 10 additions and 0 deletions
|
@ -24,6 +24,15 @@ static inline void _arch_irq_unlock(int key)
|
|||
}
|
||||
#endif
|
||||
|
||||
/* There's a spinlock validation framework available when asserts are
|
||||
* enabled. It adds a relatively hefty overhead (about 3k or so) to
|
||||
* kernel code size, don't use on platforms known to be small. (Note
|
||||
* we're using the kconfig value here. This isn't defined for every
|
||||
* board, but the default of zero works well as an "infinity"
|
||||
* fallback. There is a DT_FLASH_SIZE parameter too, but that seems
|
||||
* even more poorly supported.
|
||||
*/
|
||||
#if (CONFIG_FLASH_SIZE == 0) || (CONFIG_FLASH_SIZE > 32)
|
||||
#if defined(CONFIG_ASSERT) && (CONFIG_MP_NUM_CPUS < 4)
|
||||
#include <misc/__assert.h>
|
||||
struct k_spinlock;
|
||||
|
@ -31,6 +40,7 @@ int z_spin_lock_valid(struct k_spinlock *l);
|
|||
int z_spin_unlock_valid(struct k_spinlock *l);
|
||||
#define SPIN_VALIDATE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct k_spinlock_key {
|
||||
int key;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue