[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACBanvr+1VEM6UqfNVx+KiuehZejwqpGp6djPN5kTgYD-umP2g@mail.gmail.com>
Date: Wed, 20 Feb 2013 16:17:39 -0800
From: Mandeep Singh Baines <msb@...omium.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org, Oleg Nesterov <oleg@...hat.com>,
Tejun Heo <tj@...nel.org>, "Rafael J. Wysocki" <rjw@...k.pl>
Subject: Re: [PATCH v4] lockdep: check that no locks held at freeze time
On Wed, Feb 20, 2013 at 3:24 PM, Andrew Morton
<akpm@...ux-foundation.org> wrote:
> On Wed, 20 Feb 2013 15:17:16 -0800
> Mandeep Singh Baines <msb@...omium.org> wrote:
>
>> We shouldn't try_to_freeze if locks are held.
>>
>> ...
>>
>> @@ -43,6 +44,9 @@ extern void thaw_kernel_threads(void);
>>
>> + if (!(current->flags & PF_NOFREEZE))
>> + debug_check_no_locks_held(current,
>> +
>> "lock held while trying to freeze");
>> ...
>>
>> + debug_check_no_locks_held(tsk, "lock held at task exit time");
>
> There doesn't seem much point in adding the `msg' to
> debug_check_no_locks_held() - the dump_stack() in
> print_held_locks_bug() will tell us the same thing. Maybe just change
dump_stack() can be confusing when there is inlining. On occasion I've
looked at the wrong mutex_lock, for example, when there was another
mutex_lock that was inlined. Of course, you can start objdump and
verify the offsets. But that requires that you have the object file.
You could have a try_to_freeze added to do_exit. I was thinking of
adding another locks_held in the return from syscall path.
How about if we did some inlining and printed out the function, file
and line number where the check was placed:
#define debug_check_no_locks_held() do { \
if (unlikely(current->lockdep_depth > 0)) { \
printk("BUG: locks helds at %s:%d/%s()!\n", __FILE__,
__LINE__, __func__); \
print_held_locks_bug(); \
} \
} while (0)
That we avoid any potential confusion.
> the print_held_locks_bug() messages so they stop assuming they were
> called from do_exit()?
>
> Also, I wonder if the `tsk' arg is needed. In both callers
> tsk==current. Is it likely that we'll ever call
> debug_check_no_locks_held() for any task other than `current'?
>
I agree. I'll add that change to the patch once we decide what to about msg.
Regards,
Mandeep
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists