"MEHTA,HIREN (A-SanJose,ex1)" wrote: > > Well, I guess the problem is that : scsi layer does not know whether the > hba driver will do its own locking and release io_request_lock or not. > Before calling any entry point, scsi layer is anyway acquires > io_request_lock. > Also, if you are depending on the io_request_lock, then in the interrupt > handler you are supposed to acquired the io_request_lock and > release it before returning. So, when the hba driver calls the done routine, > the io_request_lock is already locked and doing it again in the done() will > freeze the system. Exactly. However, if you use the new error handling code, then you *can* get away with not grabbing the io_request_lock for the done function (I believe, Eric will correct me if I'm wrong) because it uses a different spin lock to control the queue it puts the commands into for the bottom half handler. As such, it doesn't really do anything that needs the io_request_lock. The old error handling code is a whole different ball of wax. Call that done function without holding the io_request_lock and you are bound to blow the SCSI layer to hell. > -hiren > > -----Original Message----- > From: Martin Peschke3 [mailto:[EMAIL PROTECTED]] > Sent: Thursday, July 19, 2001 12:23 PM > To: Doug Ledford > Cc: MEHTA,HIREN (A-SanJose,ex1); '[EMAIL PROTECTED]' > Subject: Re: question on io_request_lock > > > Yes, the done() function needs to be wrapped (this isn't so much because > it > > actually needs it as it is that you are calling mid layer code and you > need to > > adhere to what it tells you locking semantics are, which in this case is > > "always hold the io_request_lock because that's how I keep myself sane"). > > Are you sure about that? > I think, there are low-level drivers which don't follow this rule. > Why does not the scsi_done function(s) itself get the io_request_lock > first before doing any work if it really needs this? > > Mit freundlichen Grüßen / with kind regards > > Martin Peschke > > IBM Deutschland Entwicklung GmbH > GNU/Linux for S/390 and zSeries Development > Phone: +49-(0)7031-16-2349 > > Doug Ledford <[EMAIL PROTECTED]> on 07/19/2001 06:48:45 PM > > Please respond to Doug Ledford <[EMAIL PROTECTED]> > > To: "MEHTA,HIREN (A-SanJose,ex1)" <[EMAIL PROTECTED]> > cc: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]> > Subject: Re: question on io_request_lock > > "MEHTA,HIREN (A-SanJose,ex1)" wrote: > > > > Hi List, > > > > If I decide that I do not want to depend on io_request_lock > > to maintain the consistency of the data structures in my driver, > > then do I ever need to acquire this lock and release it in the driver ? > > e.g. Do I need to acquire io_request_lock before I call the done() > routine > > and release it after done() returns ? > > Yes, the done() function needs to be wrapped (this isn't so much because it > actually needs it as it is that you are calling mid layer code and you need > to > adhere to what it tells you locking semantics are, which in this case is > "always hold the io_request_lock because that's how I keep myself sane"). > You > are free to use your own internal spin locks in your code if you wish. For > certain of your code entry points, you may wish to release the > io_request_lock > and then re-grab it before returning. For example, at the beginning of > your > queue routine you should release the io_request_lock and then regrab it > before > returning if you want to use your own internal locking and not use the > io_request_lock. The queue, abort, and reset routines are called with the > io_request_lock held when using the old error handling methods. I don't > know > which entry points are called with the lock held under the new error > handling > code, but I would suspect the answer is "all of them". > > -- > > Doug Ledford <[EMAIL PROTECTED]> http://people.redhat.com/dledford > Please check my web site for aic7xxx updates/answers before > e-mailing me about problems > - > To unsubscribe from this list: send the line "unsubscribe linux-scsi" in > the body of a message to [EMAIL PROTECTED] -- Doug Ledford <[EMAIL PROTECTED]> http://people.redhat.com/dledford Please check my web site for aic7xxx updates/answers before e-mailing me about problems - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED]