Re: [2.6.33-rc5] starting emacs makes lockdep warning

From: AmÃrico Wang
Date: Tue Jan 26 2010 - 03:46:20 EST


On Tue, Jan 26, 2010 at 3:45 PM, KOSAKI Motohiro
<kosaki.motohiro@xxxxxxxxxxxxxx> wrote:
> Hi
>
>> On Tue, Jan 26, 2010 at 02:01:12PM +0800, Am??rico Wang wrote:
>>
>> > I agree, it seems that patch is useless, since we already
>> > do lock_kernel() before calling __f_setown()...
>>
>> What's to prevent pid from being freed under us? ÂBKL won't...
>
> I don't understand this issue at all. so, this is stupid dumb question.
> Why can't we write following code?
>
>
> Â Â Â Â Â Â Â Âenum pid_type type;
> Â Â Â Â Â Â Â Âstruct pid *pid;
> Â Â Â Â Â Â Â Âif (!waitqueue_active(&tty->read_wait))
> Â Â Â Â Â Â Â Â Â Â Â Âtty->minimum_to_wake = 1;
> Â Â Â Â Â Â Â Âspin_lock_irqsave(&tty->ctrl_lock, flags);
> Â Â Â Â Â Â Â Âif (tty->pgrp) {
> Â Â Â Â Â Â Â Â Â Â Â Âpid = tty->pgrp;
> Â Â Â Â Â Â Â Â Â Â Â Âtype = PIDTYPE_PGID;
> Â Â Â Â Â Â Â Â} else {
> Â Â Â Â Â Â Â Â Â Â Â Âpid = task_pid(current);
> Â Â Â Â Â Â Â Â Â Â Â Âtype = PIDTYPE_PID;
> Â Â Â Â Â Â Â Â}
> Â Â Â Â Â Â Â Âget_pid(pid) Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â// insert here
> Â Â Â Â Â Â Â Âspin_unlock_irqrestore(&tty->ctrl_lock, flags);
> Â Â Â Â Â Â Â Âretval = __f_setown(filp, pid, type, 0);
> Â Â Â Â Â Â Â Âput_pid(pid) Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â// insert here
>

Yeah, this seems reasonable for me, but not sure if this is the best fix.
èº{.nÇ+‰·Ÿ®‰­†+%ŠËlzwm…ébëæìr¸›zX§»®w¥Š{ayºÊÚë,j­¢f£¢·hš‹àz¹®w¥¢¸ ¢·¦j:+v‰¨ŠwèjØm¶Ÿÿ¾«‘êçzZ+ƒùšŽŠÝj"ú!¶iO•æ¬z·švØ^¶m§ÿðà nÆàþY&—