public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
To: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
Cc: i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
Subject: Re: i2c-remove-redundant-i2c_client-list.patch
Date: Tue, 8 Jan 2008 11:12:46 -0800	[thread overview]
Message-ID: <200801081112.46972.david-b@pacbell.net> (raw)
In-Reply-To: <20080108172001.33de6afc-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>

On Tuesday 08 January 2008, Jean Delvare wrote:
> Hi David,
> 
> On Tue, 8 Jan 2008 15:18:17 +0100, Jean Delvare wrote:
> > On Sun, 6 Jan 2008 11:30:31 -0800, David Brownell wrote:
> > > Though I was a bit worried it might have bugs in it, since all I had
> > > time to do was code it, and sanity check it with a couple variants of
> > > one new-style config.  (I no longer have those monster "build all I2C
> > > drivers" configs around.)
> > 
> > I'll give it good testing, don't worry too much about that.
> 
> Hmm, I get a lockup when removing any legacy chip driver or any bus
> driver with legacy clients attached. 

Lockup?  More details ...


> It seems to remove the 1st client 
> (no longer visible in sysfs) but never goes on with the second one.
> 
> Call Trace:
>   [<ffffffff802bdbd1>] sysfs_addrm_finish+0x191/0x1e0

What's it doing at that line in the call?

>   [<ffffffff8041bca5>] schedule_timeout+0x95/0xd0

This looks like stack garbage...

>   [<ffffffff802bdc50>] remove_dir+0x30/0x40
>   [<ffffffff802bdcb6>] sysfs_remove_dir+0x56/0x70
>   [<ffffffff8041bab8>] wait_for_common+0xc8/0x130
>   [<ffffffff80227e40>] default_wake_function+0x0/0x10
>   [<ffffffff80386e55>] device_del+0x1b5/0x290
>   [<ffffffff803ae4ce>] i2c_detach_client+0x4e/0x90
>   [<ffffffff882f0071>] :lm90:lm90_detach_client+0x71/0xa0
>   [<ffffffff803ae8ff>] detach_all_clients+0x6f/0xb0
>   [<ffffffff803ae890>] detach_all_clients+0x0/0xb0
>   [<ffffffff8038674d>] device_for_each_child+0x2d/0x60
>   [<ffffffff803af315>] i2c_del_adapter+0xa5/0x140
>   [<ffffffff8800b285>] :i2c_parport:i2c_parport_detach+0x55/0x110
>   [<ffffffff88000796>] :parport:parport_unregister_driver+0x46/0x80
>   [<ffffffff8024f001>] sys_delete_module+0x141/0x1e0
>   [<ffffffff8020b92e>] system_call+0x7e/0x83
> 
> Are you certain that it is safe to remove a device's child while
> walking the list of children?

As you point out below, it's supposed to be safe ...


> device_for_each_child() relies on a 
> klist_iter, and the documentation of klist_next mentions increasing the
> reference count of the "active" list item. I would guess that you can't
> remove a list item while its reference count is not zero, and that
> would explain the lockup. The original code used list_for_each_safe(),
> which explicitly allows the removal of the items while walking the list.
> 
> OTOH the header comment of lib/klist.c says:
> 
>  *	The entire point is to provide an interface for iterating over a list
>  *	that is safe and allows for modification of the list during the
>  *	iteration (e.g. insertion and removal), including modification of the
>  *	current node on the list.
> 
> So it is supposed to work somehow...

Yeah, but then again ... the i2c stack does that oddball stuff with
complete(&client->released) for legacy drivers, too.  That's always
been contrary to what the driver model expects, and I never quite
bothered to sort out the issues.  Maybe this is one of them (sigh).

- Dave

  parent reply	other threads:[~2008-01-08 19:12 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20071216052308.A0FB11668D7@adsl-69-226-248-13.dsl.pltn13.pacbell.net>
     [not found] ` <20071216052308.A0FB11668D7-ZcXrCSuhvln6VZ3dlLfH/g4gEjPzgfUyLrfjE7I9kuVHxeISYlDBzl6hYfS7NtTn@public.gmane.org>
2007-12-27 20:58   ` [patch 2.6.24-rc5-git] add i2c_new_dummy() utility Byron Bradley
     [not found]     ` <57e2b00712271258l6ea661ai2bfd6b9e099c71be-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-12-27 21:53       ` David Brownell
     [not found]         ` <200712271353.05857.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2007-12-27 22:09           ` Byron Bradley
     [not found]             ` <57e2b00712271409n6c98f76o45116cd92b01f396-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-12-27 23:06               ` David Brownell
     [not found]                 ` <200712271506.43069.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2007-12-27 23:37                   ` Byron Bradley
2007-12-27 23:59                   ` David Brownell
     [not found] ` <200712281230.17840.david-b@pacbell.net>
     [not found]   ` <57e2b00712281645y70f6ec74s57945dc53f113ec8@mail.gmail.com>
     [not found]     ` <57e2b00712281645y70f6ec74s57945dc53f113ec8-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-12-30  3:05       ` David Brownell
     [not found]         ` <200712291905.15160.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-01-04 22:16           ` Jean Delvare
     [not found]             ` <20080104231633.135f2875-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-01-04 23:48               ` David Brownell
     [not found]                 ` <200801041548.54825.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-01-06  9:57                   ` Jean Delvare
2008-01-06 11:23           ` i2c-remove-redundant-i2c_client-list.patch Jean Delvare
     [not found]             ` <20080106122356.78556b8a-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-01-06 19:30               ` i2c-remove-redundant-i2c_client-list.patch David Brownell
     [not found]                 ` <200801061130.31774.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-01-08 14:18                   ` i2c-remove-redundant-i2c_client-list.patch Jean Delvare
     [not found]                     ` <20080108151817.35e05c6c-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-01-08 16:20                       ` i2c-remove-redundant-i2c_client-list.patch Jean Delvare
     [not found]                         ` <20080108172001.33de6afc-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-01-08 19:12                           ` David Brownell [this message]
     [not found]                             ` <200801081112.46972.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-01-08 20:50                               ` i2c-remove-redundant-i2c_client-list.patch Jean Delvare
     [not found]                                 ` <20080108215042.534e32fa-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-01-08 21:44                                   ` i2c-remove-redundant-i2c_client-list.patch David Brownell
     [not found]                                     ` <200801081344.45544.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-01-08 22:04                                       ` i2c-remove-redundant-i2c_client-list.patch Greg KH
     [not found]                                         ` <20080108220445.GB3873-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2008-01-08 22:27                                           ` i2c-remove-redundant-i2c_client-list.patch David Brownell
2008-01-09 13:29                                       ` i2c-remove-redundant-i2c_client-list.patch Jean Delvare
     [not found]                                         ` <20080109142906.23a55f5f-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-01-09 16:19                                           ` i2c-remove-redundant-i2c_client-list.patch Jean Delvare
     [not found]                                             ` <20080109171934.4f894bdc-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-01-09 21:21                                               ` i2c-remove-redundant-i2c_client-list.patch David Brownell
     [not found]                                                 ` <200801091321.29212.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-01-10 13:31                                                   ` i2c-remove-redundant-i2c_client-list.patch Jean Delvare
     [not found]                                                     ` <20080110143105.456ddaf0-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-01-14 22:20                                                       ` i2c-remove-redundant-i2c_client-list.patch David Brownell
     [not found]                                                         ` <200801141420.49274.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-01-17 22:02                                                           ` i2c-remove-redundant-i2c_client-list.patch Jean Delvare
2008-01-18 10:14                                                           ` i2c-remove-redundant-i2c_client-list.patch Jean Delvare
     [not found]                                                             ` <20080118111401.7ffdccc5-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-01-18 10:30                                                               ` i2c-remove-redundant-i2c_client-list.patch David Brownell
2008-01-14 22:42                                                       ` i2c-remove-redundant-i2c_client-list.patch David Brownell
2008-01-17 19:35                                                   ` i2c-remove-redundant-i2c_client-list.patch David Brownell
     [not found]                                                     ` <200801171135.45797.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-01-17 19:59                                                       ` i2c-remove-redundant-i2c_client-list.patch David Brownell
     [not found]                                                         ` <200801171159.00291.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-01-18  9:32                                                           ` i2c-remove-redundant-i2c_client-list.patch Jean Delvare
     [not found]                                                             ` <20080118103209.4b92ac76-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-01-18 10:16                                                               ` i2c-remove-redundant-i2c_client-list.patch David Brownell
     [not found]                                                                 ` <200801180216.22363.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-01-18 12:10                                                                   ` i2c-remove-redundant-i2c_client-list.patch Jean Delvare
2008-01-08 18:52                       ` i2c-remove-redundant-i2c_client-list.patch David Brownell
     [not found]                         ` <200801081052.31413.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-01-08 19:57                           ` i2c-remove-redundant-i2c_client-list.patch Jean Delvare
2008-01-09 16:09                       ` i2c-remove-redundant-i2c_client-list.patch Jean Delvare
2008-01-06 19:43               ` i2c-remove-redundant-i2c_client-list.patch David Brownell
     [not found]                 ` <200801061143.34020.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2008-01-08 14:21                   ` i2c-remove-redundant-i2c_client-list.patch Jean Delvare
2008-01-17 22:24           ` [patch 2.6.24-rc5-git] add i2c_new_dummy() utility David Brownell

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=200801081112.46972.david-b@pacbell.net \
    --to=david-b-ybekhbn/0ldr7s880joybq@public.gmane.org \
    --cc=i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org \
    --cc=khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org \
    /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