-
Notifications
You must be signed in to change notification settings - Fork 34
nvme: deadlock enabling doorbell buffer while doing I/O #1080
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -113,7 +113,13 @@ struct QueueState<QS> { | |
| /// a `SubQueueState` for a Submission Queue. | ||
| inner: Mutex<QueueInner<QS>>, | ||
|
|
||
| pub acc_mem: MemAccessor, | ||
| /// This queue's memory accessor node. | ||
| /// | ||
| /// Be careful about lock ordering when using this accessor; access_borrow() | ||
| /// holds this node's lock. If a user of this queue state requires both | ||
| /// `access_borrow()` and `QueueInner`, the protocol is to lock queue | ||
| /// state first and this accessor second. | ||
| acc_mem: MemAccessor, | ||
| } | ||
| impl<QS> QueueState<QS> { | ||
| fn new(size: u32, acc_mem: MemAccessor, inner: QS) -> Self { | ||
|
|
@@ -649,12 +655,15 @@ impl SubQueue { | |
| pub fn pop( | ||
| self: &Arc<SubQueue>, | ||
| ) -> Option<(GuestData<SubmissionQueueEntry>, Permit, u16)> { | ||
| // Lock the SubQueueState early to conform to lock ordering requirement; | ||
| // see docs on QueueState::acc_mem. | ||
| let mut state = self.state.lock(); | ||
|
Comment on lines
+658
to
660
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. perhaps we should say this in the other functions that do the same thing? or not. i don't care.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in all the other cases the caller of |
||
|
|
||
| let Some(mem) = self.state.acc_mem.access_borrow() else { return None }; | ||
| let mem = mem.view(); | ||
|
|
||
| // Attempt to reserve an entry on the Completion Queue | ||
| let permit = self.cq.reserve_entry(&self, &mem)?; | ||
| let mut state = self.state.lock(); | ||
|
|
||
| // Check for last-minute updates to the tail via any configured doorbell | ||
| // page, prior to attempting the pop itself. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you!