Messages in this thread | | | Date | Mon, 8 Mar 1999 03:35:34 +0100 (CET) | From | Andrea Arcangeli <> | Subject | Re: SCSI access creating lost time |
| |
On Sun, 7 Mar 1999, Doug Ledford wrote:
>The races include do_scsi_cmnd() vs. scsi_done() vs. scsi_times_out().
The harm is not the locking overkill, but instead the fact that during the locked-atomic region we have the cpu __cli()ed.
And the _only_ reason we need the cpu clied in order to do the locking safe, is that all places are currently looping infinitely on their lock (in this case a -spin-lock) and not always-taking a fail-safe path.
I think instead that all places that could run in a irq handler should do:
struct semaphore scsi_sem = MUTEX;
scsi_done() { if (down_trylock(&scsi_sem)) { queue_task(); return; } /* lock held */ up(&scsi_sem); }
and places that can be recalled only from normal kernel context (I think none in the scsi code though ;) should do:
down() /* Critical section */ up();
That way we would _never_ need the cpu clied.
Comments?
Andrea Arcangeli
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |