iou icon indicating copy to clipboard operation
iou copied to clipboard

Question about "prepare_sqes" correctness.

Open twissel opened this issue 3 years ago • 2 comments

Here https://github.com/ringbahn/iou/blob/045f8d44c235e35b3731625356a11e6ee05966f9/src/submission_queue.rs#L160 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.

twissel avatar Dec 11 '20 12:12 twissel

Isn't that covered here by the acquire fence beforehand? Is it possible the actual variable access should use an atomic load? https://github.com/ringbahn/iou/blob/045f8d44c235e35b3731625356a11e6ee05966f9/src/submission_queue.rs#L158-L160

mxxo avatar Dec 11 '20 15:12 mxxo

@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.

twissel avatar Dec 11 '20 16:12 twissel