Fork us on GitHub Follow us on Facebook Follow us on Twitter

Opened 10 years ago

Closed 10 years ago

Last modified 9 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 Changed 10 years ago by Jiri Svoboda

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 Changed 10 years ago by Jakub Jermář

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 Changed 10 years ago by Jakub Jermář

Resolution: fixed
Status: newclosed

comment:4 Changed 9 years ago by Martin Decky

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