diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-07-05 21:02:52 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-07-05 21:02:52 +0300 |
| commit | 608f44306a6f0d5692f5c81bcbfe7a621ec254ba (patch) | |
| tree | 72a9f917694be91e4795bd04fddabac8139e1059 /include | |
| parent | bef6a76b602eee8f43c2e7dd65c5bd9cf5d909e4 (diff) | |
| download | kmi-608f44306a6f0d5692f5c81bcbfe7a621ec254ba.tar.gz kmi-608f44306a6f0d5692f5c81bcbfe7a621ec254ba.zip | |
implement bkl
+ Start out using big kernel lock, apparently seL4 thinks its good
enough. I might have a go at using a more fair lock, and possibly
moving to more fine-grained locks if I really feel the need to get
scalability up.
Diffstat (limited to 'include')
| -rw-r--r-- | include/arch/lock.h | 2 | ||||
| -rw-r--r-- | include/kmi/bkl.h | 18 | ||||
| -rw-r--r-- | include/kmi/lock.h | 2 |
3 files changed, 19 insertions, 3 deletions
diff --git a/include/arch/lock.h b/include/arch/lock.h index 2a94fbf..ea19585 100644 --- a/include/arch/lock.h +++ b/include/arch/lock.h @@ -11,7 +11,7 @@ #if defined(riscv64) #include "../../arch/riscv64/include/lock.h" -#if defined(riscv32) +#elif defined(riscv32) #include "../../arch/riscv32/include/lock.h" #endif diff --git a/include/kmi/bkl.h b/include/kmi/bkl.h new file mode 100644 index 0000000..26dfaa8 --- /dev/null +++ b/include/kmi/bkl.h @@ -0,0 +1,18 @@ +#ifndef KMI_BKL_H +#define KMI_BKL_H + +#include <kmi/lock.h> + +extern spinlock_t bkl; + +static inline void bkl_lock() +{ + spin_lock(&bkl); +} + +static inline void bkl_unlock() +{ + spin_unlock(&bkl); +} + +#endif /* KMI_BKL_H */ diff --git a/include/kmi/lock.h b/include/kmi/lock.h index 31cf1aa..f24413c 100644 --- a/include/kmi/lock.h +++ b/include/kmi/lock.h @@ -33,7 +33,6 @@ typedef atomic_int spinlock_t; */ static inline void spin_lock(spinlock_t *lck) { - disable_irq(); do { while (atomic_load_explicit(lck, memory_order_acquire)) optional_pause(); @@ -49,7 +48,6 @@ static inline void spin_lock(spinlock_t *lck) static inline void spin_unlock(spinlock_t *lck) { atomic_store_explicit(lck, 0, memory_order_release); - enable_irq(); } #endif /* KMI_LOCK_H */ |
