-
Notifications
You must be signed in to change notification settings - Fork 88
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
add dependency to Send
for the implementation of spinlock
#97
Conversation
stlankes
commented
Sep 1, 2020
- first draft to solve issue Spinlock is Unsound #96
- using of the core collection library to handle memory and tasks - the vector of PCI adpaters aren't longer protected by a lock because it is initialized at boot time - afterwards, we have only read-access
- avoids collisions in BtreeSet
…read - required to protect it by spinlock
@tlambertz I revise the interface to the filesystem. Does it meet your requirements? |
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.
I have only taken a cursory glance and found virtio-net vulnerable to deadlocks. Though I think similar issues would have caused a panic before. My own rewrite of virtio-fs uses a different interrupt logic, that might be worth adopting. I'll merge it next week.
} | ||
}); | ||
if let Some(driver) = crate::arch::kernel::pci::get_network_driver() { | ||
driver.lock().set_polling_mode(value); |
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.
This might deadlock. virtio_irqhandler
also gets the network driver and calls
driver.lock().handle_interrupt()
The interrupt might happen while the driver is locked here.
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.
That is the reason for SpinlockIrqSave. If a task hold this lock, all interrupt are blocked. => No interrupt during the critical section
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.
You find more details at https://github.com/hermitcore/libhermit-rs/blob/master/src/synch/spinlock.rs#L212-L221
…s#97) * add requirement to use only types T for spin lock, where the behavior Send is specified * remove obsolete implementation of a irqsave refcell * replace DoubleLinkedList by LinkedList of the alloc library * using of the core collection library to handle memory and tasks * the vector of PCI adapters aren't longer protected by a lock because these adapter are initialized at boot time. Afterwards, we have only read-access. * Freelist: add check if a reunion with the previous slot is possible