ringbahn/iou

Question about "prepare_sqes" correctness.

twissel opened this issue · 2 comments

Here

let head: u32 = *sq.khead;
plain(non atomic) load from sq.khead is used which is fine if sqpoll is not enabled, but may lead to troubles if it is enabled.
Should't this load be something like atomic_load(acquire) https://github.com/axboe/liburing/blob/3bdd9839005900440c7f74aafa476db48e6e9985/src/queue.c#L386 ?
If I'm wrong. I'm sorry.

mxxo commented

Isn't that covered here by the acquire fence beforehand? Is it possible the actual variable access should use an atomic load?

iou/src/submission_queue.rs

Lines 158 to 160 in 045f8d4

atomic::fence(Ordering::Acquire);
let head: u32 = *sq.khead;

@mxxo you can use fence, but then this should be written like:

let head: u32 = atomic_load_relaxed(sq.khead);
fence(Acquire); 

оr just use atomic_load_acquire(sq.head) and remove fence.