From: ebiederm@xmission.com (Eric W. Biederman)
To: "Américo Wang" <xiyou.wangcong@gmail.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Al Viro <viro@zeniv.linux.org.uk>,
Tavis Ormandy <taviso@google.com>, Jeff Dike <jdike@addtoit.com>,
Julien Tinnes <jln@google.com>, Matt Mackall <mpm@selenic.com>,
LKML <linux-kernel@vger.kernel.org>,
Oleg Nesterov <oleg@redhat.com>,
Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: [2.6.33-rc5] starting emacs makes lockdep warning
Date: Tue, 26 Jan 2010 01:14:15 -0800 [thread overview]
Message-ID: <m1vdepxm6w.fsf@fess.ebiederm.org> (raw)
In-Reply-To: <2375c9f91001260045s7d01c427g64bc10f5bf4db4d@mail.gmail.com> ("Américo Wang"'s message of "Tue\, 26 Jan 2010 16\:45\:57 +0800")
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=utf-8, Size: 1942 bytes --]
Américo Wang <xiyou.wangcong@gmail.com> writes:
> On Tue, Jan 26, 2010 at 3:45 PM, KOSAKI Motohiro
> <kosaki.motohiro@jp.fujitsu.com> 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.
That or tweak __f_setown to use irqsave/irqrestore variants for it's
locks, __f_setown is already atomic. I prefer that direction because the
code is just a little simpler.
Eric
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
next prev parent reply other threads:[~2010-01-26 9:14 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-26 3:20 [2.6.33-rc5] starting emacs makes lockdep warning KOSAKI Motohiro
2010-01-26 5:25 ` Américo Wang
2010-01-26 5:37 ` KOSAKI Motohiro
2010-01-26 5:49 ` KOSAKI Motohiro
2010-01-26 6:01 ` Américo Wang
2010-01-26 6:07 ` Al Viro
2010-01-26 6:24 ` Américo Wang
2010-01-26 6:54 ` Al Viro
2010-01-26 7:45 ` KOSAKI Motohiro
2010-01-26 8:45 ` Américo Wang
2010-01-26 9:14 ` Eric W. Biederman [this message]
2010-01-26 9:32 ` Américo Wang
2010-01-26 12:33 ` Eric W. Biederman
2010-01-26 15:58 ` [Patch] fix the lockdep warning in tty_fasync() Américo Wang
2010-01-27 1:09 ` KOSAKI Motohiro
2010-01-27 1:47 ` Greg KH
2010-01-26 6:17 ` [2.6.33-rc5] starting emacs makes lockdep warning Eric W. Biederman
2010-01-26 18:16 ` check_usage_backwards() && forwards? (Was: [2.6.33-rc5] starting emacs makes lockdep warning) Oleg Nesterov
2010-01-26 18:47 ` Peter Zijlstra
2010-01-27 2:58 ` Américo Wang
2010-01-27 13:15 ` [tip:core/urgent] lockdep: Fix check_usage_backwards() error message tip-bot for Oleg Nesterov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m1vdepxm6w.fsf@fess.ebiederm.org \
--to=ebiederm@xmission.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=jdike@addtoit.com \
--cc=jln@google.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mpm@selenic.com \
--cc=oleg@redhat.com \
--cc=taviso@google.com \
--cc=viro@zeniv.linux.org.uk \
--cc=xiyou.wangcong@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox