Implement lock IRQ nesting via stack variables/contexts
All checks were successful
Build documentation / build-and-deploy (push) Successful in 21s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 21s
This commit is contained in:
@@ -28,12 +28,14 @@ void proc_cleanup_resources (struct proc* proc) {
|
||||
}
|
||||
|
||||
void proc_drop_resource (struct proc* proc, struct proc_resource* resource) {
|
||||
spin_lock_ctx_t ctxpr;
|
||||
|
||||
DEBUG ("resource=%p, type=%d, rid=%d\n", resource, resource->type, resource->rid);
|
||||
|
||||
if (atomic_fetch_sub (&resource->refs, 1) == 1) {
|
||||
spin_lock (&proc->lock);
|
||||
spin_lock (&proc->lock, &ctxpr);
|
||||
rbtree_delete (&proc->resource_tree, &resource->proc_resource_tree_link);
|
||||
spin_unlock (&proc->lock);
|
||||
spin_unlock (&proc->lock, &ctxpr);
|
||||
|
||||
resource->ops.cleanup (proc, resource);
|
||||
free (resource);
|
||||
@@ -74,6 +76,7 @@ static void proc_cleanup_resource_mutex (struct proc* proc, struct proc_resource
|
||||
|
||||
struct proc_resource* proc_create_resource (struct proc* proc, int rid, int type, int vis,
|
||||
void* data) {
|
||||
spin_lock_ctx_t ctxpr;
|
||||
/* Check if resource RID already exists */
|
||||
struct proc_resource* resource_check;
|
||||
rbtree_find (struct proc_resource, &proc->resource_tree, rid, resource_check,
|
||||
@@ -112,10 +115,10 @@ struct proc_resource* proc_create_resource (struct proc* proc, int rid, int type
|
||||
} break;
|
||||
}
|
||||
|
||||
spin_lock (&proc->lock);
|
||||
spin_lock (&proc->lock, &ctxpr);
|
||||
rbtree_insert (struct proc_resource, &proc->resource_tree, &resource->proc_resource_tree_link,
|
||||
proc_resource_tree_link, rid);
|
||||
spin_unlock (&proc->lock);
|
||||
spin_unlock (&proc->lock, &ctxpr);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user