From 265a388c93ad087ebc75eceeb8b313c7bdd803f4 Mon Sep 17 00:00:00 2001 From: Imbus <> Date: Wed, 27 Aug 2025 22:07:30 +0200 Subject: [PATCH] Inline nops in spinlock spin routine --- kern/ispinlock.c | 2 +- kern/ispinlock.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/kern/ispinlock.c b/kern/ispinlock.c index 4a7b751..01965f8 100644 --- a/kern/ispinlock.c +++ b/kern/ispinlock.c @@ -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 diff --git a/kern/ispinlock.h b/kern/ispinlock.h index e0303d6..d71af17 100644 --- a/kern/ispinlock.h +++ b/kern/ispinlock.h @@ -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);