1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 12:27:35 +00:00

Kernel: Replace bespoke & rickety NVMeIO synchronization mechanism

Instead of assuming data races won't occur and trying to somehow verify
it with manual un-atomic tracking, we can just use a recursive spinlock
instead of a normal one, to resolve the original deadlock.
This commit is contained in:
Idan Horowitz 2024-02-09 17:08:39 +02:00 committed by Andreas Kling
parent a957907f4b
commit 38dad2e27f
2 changed files with 5 additions and 18 deletions

View file

@ -42,12 +42,10 @@ class AsyncBlockDeviceRequest;
struct NVMeIO {
void clear()
{
used = false;
request = nullptr;
end_io_handler = nullptr;
}
RefPtr<AsyncBlockDeviceRequest> request;
bool used = false;
Function<void(u16 status)> end_io_handler;
};
@ -117,7 +115,7 @@ protected:
Spinlock<LockRank::Interrupts> m_cq_lock {};
HashMap<u16, NVMeIO> m_requests;
NonnullOwnPtr<Memory::Region> m_rw_dma_region;
Spinlock<LockRank::None> m_request_lock {};
RecursiveSpinlock<LockRank::None> m_request_lock {};
private:
u16 m_qid {};