public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: James Bottomley <James.Bottomley@steeleye.com>
Cc: Alan Stern <stern@rowland.harvard.edu>,
	Mike Anderson <andmike@us.ibm.com>, Andrew Morton <akpm@osdl.org>,
	greg@kroah.com, Jens Axboe <axboe@suse.de>,
	linux-usb-devel@lists.sourceforge.net,
	SCSI Mailing List <linux-scsi@vger.kernel.org>
Subject: Re: [linux-usb-devel] Re: bug 2400
Date: Mon, 05 Apr 2004 16:23:46 -0700	[thread overview]
Message-ID: <4071EA82.3020901@pacbell.net> (raw)
In-Reply-To: <1081201463.2050.92.camel@mulgrave>

James Bottomley wrote:
> On Sun, 2004-04-04 at 22:54, David Brownell wrote:
> 
>>Which directly follows from what I said ... USB propagates
>>that knowledge in carefully defined ways.   Other layers can
>>do the same, although clearly state associated with open file
>>descriptors needs to use a slightly different strategy.  And
>>that strategy is what Alan's original comment was about.
> 
> 
> Well, again, this is at the core of the argument.
> 
> I say that as long as we have all our objects correctly refcounted, how
> disconnections propagate up the stack is irrelevant.

"Irrelevant" is pointlessly strong, even for what I'm guessing
you really mean to be saying.

Minimally, there needs to be synchronization to prevent open() on
one CPU from using data structures disconnect() just invalidated
on another CPU.  That's a basic "how to write multi-threaded code"
kind of issue, which I won't bother to explain (yet again).


> If you have to have a "carefully defined" order for the propagation of
> an asynchronous event to save you from oopsing, it's a sure sign of bugs
> in the code.

It was "carefully defined" to ensure that there are clearly
defined points where it's safe to delete the hardware state.
Those are needed in situations other than disconnect().

Not having such synchronization points meant that HCDs were
reduced to _guessing_ whether it's safe to free that state.
Which was a sure sign of API bugs (inside usbcore), and made
for way too many oops-on-unplug reports in 2.4 kernels (and
kept various other things from working right, too).


> My reasoning is that I/O down the stack will ultimately hit the part of
> the kernel (or even just timeout in transmission to the device if it's
> disappeared without trace) that contains the knowledge and be returned
> with an error.  Ordering the disconnection propagation cannot change
> this fact, merely alter *which* component returns the error.

Ensuring such a behaviour certainly requires "careful design".
As does ensuring that the event propagation _completes_ every
time, rather than sometimes just refusing to finish.  Surely
you've seen both kinds of design botch.


> As long as we're robust to the error there is no problem.

The only system "error" in this discussion was that oops.

It may be a minor point ... but "disconnecting device while in use"
isn't an error at all.  It's a fault, maybe sometimes undesirable,
but one with behavior specified as fully as reading or writing a
block of data.


> At this point, the object lifetime does nothing more that count how long
> we have to keep the object around to return the error.

And that's basically what I said about the careful design of the
disconnect sequence, ensuring that there _is_ such a point:  one
where the only issues left are when references get dropped, so
that the only issue left is memory management.

- Dave



> James
> 
> 
> 



  reply	other threads:[~2004-04-05 23:24 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-01 21:15 bug 2400 Andrew Morton
2004-04-01 21:52 ` Matt Gulick
2004-04-01 22:08   ` Andrew Morton
2004-04-01 22:48     ` Matt Gulick
2004-04-01 22:40   ` James Bottomley
2004-04-01 22:53     ` Matt Gulick
2004-04-01 23:07 ` Matthew Dharm
2004-04-01 23:32 ` James Bottomley
2004-04-02  0:29   ` Steven Dake
2004-04-02  8:43   ` Mike Anderson
2004-04-02 15:57     ` James Bottomley
2004-04-02 16:45       ` Mike Anderson
2004-04-02 17:05         ` James Bottomley
2004-04-02 17:44           ` Mike Anderson
2004-04-02 18:13             ` James Bottomley
2004-04-02 23:40               ` Mike Anderson
2004-04-03  0:25                 ` James Bottomley
2004-04-04  1:40                   ` Alan Stern
2004-04-04 15:23                     ` James Bottomley
2004-04-04 16:46                       ` Alan Stern
2004-04-04 17:04                         ` James Bottomley
2004-04-05  3:17                           ` Alan Stern
2004-04-05 14:59                             ` Mike Anderson
2004-04-05 21:27                             ` James Bottomley
2004-04-06 14:00                               ` Alan Stern
2004-04-05 22:10                             ` Patrick Mansfield
2004-04-06 14:10                               ` Alan Stern
2004-04-08 14:09                               ` Alan Stern
2004-04-08 16:24                                 ` Matt Gulick
2004-04-08 18:33                                   ` Alan Stern
2004-04-08 19:44                                     ` Matt Gulick
2004-04-05 13:30                           ` [linux-usb-devel] " Oliver Neukum
2004-04-04 18:16                       ` David Brownell
2004-04-04 18:42                         ` James Bottomley
2004-04-05  3:54                           ` David Brownell
2004-04-05 21:44                             ` James Bottomley
2004-04-05 23:23                               ` David Brownell [this message]
2004-04-06  1:19                                 ` [linux-usb-devel] " James Bottomley
2004-04-06  6:52                                   ` Oliver Neukum
2004-04-06 14:03                                     ` James Bottomley
2004-04-07  9:19                                       ` Oliver.Neukum
2004-04-06 15:10                                   ` David Brownell
2004-04-06 15:47                                     ` James Bottomley
2004-04-06 16:16                                       ` David Brownell
2004-04-06 16:55                                       ` Alan Stern
2004-04-06 17:13                                         ` James Bottomley
2004-04-02 23:36   ` James Bottomley
2004-04-03  0:11     ` Mike Anderson
2004-04-03  0:16       ` James Bottomley
2004-04-05  4:33     ` Patrick Mansfield
2004-04-05 14:09       ` James Bottomley
2004-04-05 21:07       ` James Bottomley
2004-04-06  9:22         ` Jens Axboe
2004-04-06 13:56           ` James Bottomley
2004-04-06 14:04             ` Jens Axboe
2004-04-06 14:09               ` James Bottomley
2004-04-08 23:06         ` Greg KH
2004-04-09 11:28           ` James Bottomley
2004-04-05 14:03     ` Jens Axboe
2004-04-05 21:08       ` James Bottomley
2004-04-06  9:22         ` Jens Axboe

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=4071EA82.3020901@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=James.Bottomley@steeleye.com \
    --cc=akpm@osdl.org \
    --cc=andmike@us.ibm.com \
    --cc=axboe@suse.de \
    --cc=greg@kroah.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    --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