- Catch up to falloc() changes.
- PHOLD() before using a task structure on the stack. - Fix a LOR between the sleepq lock and thread lock in _intr_drain().
This commit is contained in:
parent
37508ef3eb
commit
5bd186a65a
@ -746,7 +746,6 @@ intr_handler_source(void *cookie)
|
||||
void
|
||||
_intr_drain(int irq)
|
||||
{
|
||||
struct mtx *mtx;
|
||||
struct intr_event *ie;
|
||||
struct intr_thread *ithd;
|
||||
struct thread *td;
|
||||
@ -758,13 +757,21 @@ _intr_drain(int irq)
|
||||
return;
|
||||
ithd = ie->ie_thread;
|
||||
td = ithd->it_thread;
|
||||
/*
|
||||
* We set the flag and wait for it to be cleared to avoid
|
||||
* long delays with potentially busy interrupt handlers
|
||||
* were we to only sample TD_AWAITING_INTR() every tick.
|
||||
*/
|
||||
thread_lock(td);
|
||||
mtx = td->td_lock;
|
||||
if (!TD_AWAITING_INTR(td)) {
|
||||
ithd->it_flags |= IT_WAIT;
|
||||
msleep_spin(ithd, mtx, "isync", 0);
|
||||
while (ithd->it_flags & IT_WAIT) {
|
||||
thread_unlock(td);
|
||||
pause("idrain", 1);
|
||||
thread_lock(td);
|
||||
}
|
||||
}
|
||||
mtx_unlock_spin(mtx);
|
||||
thread_unlock(td);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ get_unused_fd(void)
|
||||
int error;
|
||||
int fd;
|
||||
|
||||
error = falloc(curthread, &file, &fd);
|
||||
error = falloc(curthread, &file, &fd, 0);
|
||||
if (error)
|
||||
return -error;
|
||||
return fd;
|
||||
|
@ -160,9 +160,11 @@ flush_taskqueue(struct taskqueue *tq)
|
||||
{
|
||||
struct task flushtask;
|
||||
|
||||
PHOLD(curproc);
|
||||
TASK_INIT(&flushtask, 0, _flush_fn, NULL);
|
||||
taskqueue_enqueue(tq, &flushtask);
|
||||
taskqueue_drain(tq, &flushtask);
|
||||
PRELE(curproc);
|
||||
}
|
||||
|
||||
static inline int
|
||||
|
Loading…
Reference in New Issue
Block a user