mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kay Sievers <kay.sievers@vrfy.org>
To: Dave Young <hidave.darkstar@gmail.com>
Cc: Jarek Poplawski <jarkao2@gmail.com>,
	Alan Stern <stern@rowland.harvard.edu>, Greg KH <gregkh@suse.de>,
	stefanr@s5r6.in-berlin.de, David Brownell <david-b@pacbell.net>,
	Kernel development list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 7/7] driver-core : convert semaphore to mutex in struct class
Date: Fri, 18 Jan 2008 04:18:43 +0100	[thread overview]
Message-ID: <1200626323.5640.21.camel@lov.site> (raw)
In-Reply-To: <a8e1da0801171828n26b37be0oa8b1c3cbec5f83cb@mail.gmail.com>

On Fri, 2008-01-18 at 10:28 +0800, Dave Young wrote:
> On Jan 18, 2008 9:55 AM, Kay Sievers <kay.sievers@vrfy.org> wrote:
> >
> > On Jan 18, 2008 2:42 AM, Dave Young <hidave.darkstar@gmail.com> wrote:
> > >
> > > On Jan 18, 2008 7:26 AM, Jarek Poplawski <jarkao2@gmail.com> wrote:
> > > >
> > > > On Thu, Jan 17, 2008 at 09:31:55PM +0100, Jarek Poplawski wrote:
> > > > > On Thu, Jan 17, 2008 at 02:57:36PM -0500, Alan Stern wrote:
> > > > > > On Thu, 17 Jan 2008, Jarek Poplawski wrote:
> > > > > >
> > > > > > > On Thu, Jan 17, 2008 at 10:16:30AM -0500, Alan Stern wrote:
> > > > > > > > On Thu, 17 Jan 2008, Dave Young wrote:
> > > > > > > >
> > > > > > > > > > Your meaning isn't clear.  Do you mean that your patch doesn't generate
> > > > > > > > > > any lockdep warnings at all?  Or do you mean that it generates a single
> > > > > > > > > > lockdep warning at boot time and then no more warnings afterward?
> > > > > > > > >
> > > > > > > > > I means the latter one.
> > > > > > > >
> > > > > > > > That's very bad.
> > > > > > > >
> > > > > > > > For each type of violation, lockdep only gives one error message.  So
> > > > > > > > the fact that you get one message at boot time and then no more doesn't
> > > > > > > > mean the code is almost right -- it probably means the code has lots of
> > > > > > > > errors and you're seeing only the first one.
> > > > > > >
> > > > > > > I hope it's better than this: lockdep really stops checking after first
> > > > > > > warning, but I've understood from David's description that after fixing
> > > > > > > this one place lockdep seems to be pleased.
> > > > > >
> > > > > > That isn't what Dave said above; he said that lockdep produces a single
> > > > > > warning at bootup.  If he did mention anything about one place being
> > > > > > fixed up or lockdep being pleased, it was a while back and I've lost
> > > > > > track of it.
> > > > > >
> > > > > > If I recall correctly the nature of the warning was that a method
> > > > > > routine for one class (called with the class's mutex held) was creating
> > > > > > a second class and locking that class's mutex.  In principle this is
> > > > > > perfectly legal and should be allowed for arbitrary depths of nesting,
> > > > > > even though it is the sort of thing lockdep is currently unable to
> > > > > > handle.
> > > > >
> > > > > You are definitely right! After first reading Dave's description I got
> > > > > it the same way, but after re-reading I probably was misled with this
> > > > > "thus"! Only now I've had a look at this warning and there is really
> > > > > mutex_lock_nested(). Sorry Alan!
> > > >
> > > > But, on the other hand, mutex_lock() is really mutex_lock_nested(), and
> > > > after second checking this lockdep warning from Jan. 3, it seems
> > > > impossible it was get after this patch...
> > > >
> > > > Dave, could you please answer with full sentence if there is any lockdep
> > > > warning possible after applying these 1-7/7 patches, and if so, attach
> > > > current warning? Otherwise, I'll have apologized for this everybody from
> > > > the list soon!
> > >
> > > After digging the class usage code again, I found that the only
> > > possible double lock place is the class_interface_register/unregister
> > > in which the class_device api could be called.
> > >
> > > The scsi and pcmcia use the class_interface api, I just found the
> > > warning above caused by scsi part then.
> > >
> > > So I think I will need to use mutex_lock_nesting for the
> > > class_device_* functions.
> >
> > All "struct class_device" stuff will go away very soon, and only
> > "struct device" will stay.
> > The conversion for remaining users is already in -mm. Only SCSI and IB
> > are missing,
> > but experimental patches for these exist already.

> Then what's your opinon about the lockdep warning fix? I wonder
> whether the "soon" means we should do mutex convert after the
> class_device going away?

Yeah, might be better to wait until class_device is gone, otherwise you
may need to fix stuff that is just going to be removed. Your change to
have iterators for the class devices look like a nice preparation for
future changes though.

Our rough plan is:
 2.6.25:
  - get the ~100 patches in Greg's tree (in -mm) merged :)
 2.6.26:
  - remove the 20 char limit in "struct device"
  - get rid of "struct class_device"
 2.6.27
  - merge most of "struct class" and "struct bus_type" and have
    only one type of list and iterator for all devices of all subsystems
 2.6.27+
  - allow multiple "drivers" to bind a single device (now that the
    difference between class and bus devices is gone)

Thanks,
Kay


  reply	other threads:[~2008-01-18  3:17 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-12 10:05 Dave Young
2008-01-15  9:15 ` Dave Young
2008-01-15 13:56   ` Jarek Poplawski
2008-01-16  1:03     ` Dave Young
2008-01-16  8:34       ` Jarek Poplawski
2008-01-17  1:17         ` Dave Young
2008-01-17  8:38           ` Jarek Poplawski
2008-01-17  8:56             ` Dave Young
2008-01-16 15:27       ` Alan Stern
2008-01-17  0:01         ` Jarek Poplawski
2008-01-17  1:18         ` Dave Young
2008-01-17 15:16           ` Alan Stern
2008-01-17 19:47             ` Jarek Poplawski
2008-01-17 19:57               ` Alan Stern
2008-01-17 20:31                 ` Jarek Poplawski
2008-01-17 22:02                   ` Jarek Poplawski
2008-01-17 23:26                   ` Jarek Poplawski
2008-01-18  1:42                     ` Dave Young
2008-01-18  1:55                       ` Kay Sievers
2008-01-18  2:28                         ` Dave Young
2008-01-18  3:18                           ` Kay Sievers [this message]
2008-01-18  6:25                             ` Greg KH
     [not found]                             ` <a8e1da0801172131h57097622h6d111133b6a0773d@mail.gmail.com>
2008-01-18  7:38                               ` Jarek Poplawski
2008-01-18  7:48                                 ` Dave Young
2008-01-18  8:23                                   ` Jarek Poplawski
2008-01-18  9:07                                     ` Dave Young
2008-01-19  9:39                                       ` Jarek Poplawski
2008-01-21  1:19                                         ` Dave Young
2008-01-21  1:30                                         ` Dave Young
2008-01-21  1:43                                           ` Dave Young
2008-01-21  8:36                                             ` Jarek Poplawski
2008-01-21  8:44                                               ` Dave Young
2008-01-21  9:03                                                 ` Jarek Poplawski
2008-01-21 21:16                                                 ` Jarek Poplawski
2008-01-22  0:55                                                   ` Dave Young
2008-01-22  5:15                                                     ` Greg KH
2008-01-22  6:13                                                       ` Dave Young
2008-01-22  7:45                                                     ` Jarek Poplawski
2008-01-18 10:45                                 ` Kay Sievers
2008-01-18 11:40                                   ` Jarek Poplawski
2008-01-18  8:00                       ` Jarek Poplawski
2008-01-18  8:39                         ` Jarek Poplawski
2008-01-17 21:11                 ` Greg KH
2008-01-17 21:55                   ` Jarek Poplawski
2008-01-18  1:45             ` Dave Young

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=1200626323.5640.21.camel@lov.site \
    --to=kay.sievers@vrfy.org \
    --cc=david-b@pacbell.net \
    --cc=gregkh@suse.de \
    --cc=hidave.darkstar@gmail.com \
    --cc=jarkao2@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stefanr@s5r6.in-berlin.de \
    --cc=stern@rowland.harvard.edu \
    /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

all inboxes | Powered by JetHome®