CAM locking

Scott Long scottl at samsco.org
Fri Jun 1 03:21:19 UTC 2007


Hidetoshi Shimokawa wrote:
> Hi Scott,
> 
> Thank you for your work on CAM.
> I have some questions about lock assertion.
> 
> 1. Now, xpt_done() should be called with a sim lock for QUEUED ccbs.
>    Why don't you add an assertion in xpt_done()?

Accessing the sim_lock from the CCB requires enough dereferences that if
the lock isn't already held, you'll probably run into problems just
doing the derefs in the assertion.  Adding a sim_lock field to the CCB
has crossed my mind, but I don't want to pollute the CCB with more
kernel-only fields if I can.  I need to think some more on it.

> 
> 2. CAMDEBUG seems useless with WITNESS because xpt_path_path_id() requires
>    a sim lock. Can we safely drop the assertion?

Yes, this is an area that I didn't clean up very well.  A lot of code in
periphs and SIMs wants to be able to use CAMDEBUG functions in random
places without the lock held, and I don't know of a good way to safely
fix this without rewriting a lot of code.  I don't know if it's better
to just drop the assertion or to audit all of the code provide locked
and unlocked versions of the CAMDEBUG functions.

Scott


More information about the freebsd-scsi mailing list