Inline nops in spinlock spin routine

This commit is contained in:
Imbus 2025-08-27 22:07:30 +02:00
parent ee2ddd7e8c
commit 265a388c93
2 changed files with 1 additions and 2 deletions

View file

@ -19,7 +19,7 @@ void spin_unlock(spinlock_t *l) {
// Optional: tiny pause/backoff (works even if Zihintpause isn't present).
// See: https://github.com/riscv/riscv-isa-manual/blob/main/src/zihintpause.adoc
void cpu_relax(void) {
static inline void cpu_relax(void) {
#if defined(__riscv_zihintpause)
__asm__ volatile("pause");
#else

View file

@ -8,5 +8,4 @@ typedef struct {
void spinlock_init(spinlock_t *l);
bool spin_trylock(spinlock_t *l);
void spin_unlock(spinlock_t *l);
void cpu_relax(void);
void spin_lock(spinlock_t *l);