Question about dec_lock_cnt method in Context class

Adam Lackorzynski adam at os.inf.tu-dresden.de
Tue Sep 9 23:03:16 CEST 2014


On Mon Sep 08, 2014 at 11:54:32 -0400, Yuxin Ren wrote:
> Unfortunately this modification does not help.
> I have a question about the switch_lock code.
> 
> PRIVATE inline
> bool NO_INSTRUMENT
> Switch_lock::set_lock_owner(Context *o)
> {
>   bool have_no_locks = o->_lock_cnt < 1;
> 
>   if (have_no_locks)
>     {
>       assert_kdb (current_cpu() == o->home_cpu());
>       for (;;)
>         {
>           if (EXPECT_FALSE(access_once(&o->_running_under_lock)))
>             continue;
>           if (EXPECT_TRUE(mp_cas(&o->_running_under_lock, Mword(false),
> Mword(true))))
>             break;
>         }
>     }
>     ...
> }
> 
> In which case, the variable "_running_under_lock"  is set to true but the
> lock_cnt is 0?
> Now in my test, the kernel goes into this dead loop.

Do you know when it was set to true? Maybe that would help finding out
why it is stuck there?



Adam
-- 
Adam                 adam at os.inf.tu-dresden.de
  Lackorzynski         http://os.inf.tu-dresden.de/~adam/




More information about the l4-hackers mailing list