Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#230 closed defect (fixed)

Mutexes taken when spinlocks held

Reported by: Jakub Jermář Owned by:
Priority: major Milestone: 0.4.3
Component: helenos/kernel/generic Version: mainline
Keywords: Cc:
Blocker for: Depends on:
See also:

Description (last modified by Martin Decky)

In the current revision, changeset:mainline,402, the stats code attempts to lock the address space mutexes while holding task locks:

get_stats_tasks()
   spinlock_lock(&tasks_lock)
   task_serialize_walker()
      spinlock__lock(&task->lock)
      produce_stats_task()
         get_task_virtmem()
            mutex_lock(&as->lock)
            mutex_lock(&as->area->lock)

Note that this is actually a bug.

Change History (4)

comment:1 by Jiri Svoboda, 14 years ago

Because you cannot take a coarser lock type while holding a finer lock type, as I tried to explain at page 16 of my master thesis. I guess this is not immediately obvious because most systems do not seem to use several different locks with varying coarseness. At least I was somewhat surprised by this when I was new to HelenOS. Maybe we should have some article with introduction to synchronization in HelenOS.

comment:2 by Jakub Jermář, 14 years ago

Fixed in revision changeset:head,409.

Note that it may be infinitely better to let the address space management code compute these statistics as it proceeds instead of having them calculated here over and over again here.

comment:3 by Jakub Jermář, 14 years ago

Resolution: fixed
Status: newclosed

comment:4 by Martin Decky, 14 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.