lkml.org 
[lkml]   [1999]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 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/

\
 
 \ /
  Last update: 2005-03-22 13:50    [W:0.070 / U:0.308 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site