Introduce a new taskqueue that runs completely free of Giant, and in
turns runs its tasks free of Giant too. It is intended that as drivers become locked down, they will move out of the old, Giant-bound taskqueue and into this new one. The old taskqueue has been renamed to taskqueue_swi_giant, and the new one keeps the name taskqueue_swi.
This commit is contained in:
parent
13f9c3024f
commit
7874f606d5
@ -660,7 +660,7 @@ aac_intr(void *arg)
|
||||
/* It's not ok to return here because of races with the previous step */
|
||||
if (reason & AAC_DB_RESPONSE_READY)
|
||||
/* handle completion processing */
|
||||
taskqueue_enqueue(taskqueue_swi, &sc->aac_task_complete);
|
||||
taskqueue_enqueue(taskqueue_swi_giant, &sc->aac_task_complete);
|
||||
|
||||
/* controller wants to talk to the log */
|
||||
if (reason & AAC_DB_PRINTF) {
|
||||
|
@ -1370,7 +1370,7 @@ amr_done(struct amr_softc *sc)
|
||||
/* handle completion and timeouts */
|
||||
#if __FreeBSD_version >= 500005
|
||||
if (sc->amr_state & AMR_STATE_INTEN)
|
||||
taskqueue_enqueue(taskqueue_swi, &sc->amr_task_complete);
|
||||
taskqueue_enqueue(taskqueue_swi_giant, &sc->amr_task_complete);
|
||||
else
|
||||
#endif
|
||||
amr_complete(sc, 0);
|
||||
|
@ -1610,7 +1610,7 @@ mly_done(struct mly_softc *sc)
|
||||
if (worked) {
|
||||
#if __FreeBSD_version >= 500005
|
||||
if (sc->mly_state & MLY_STATE_INTERRUPTS_ON)
|
||||
taskqueue_enqueue(taskqueue_swi, &sc->mly_task_complete);
|
||||
taskqueue_enqueue(taskqueue_swi_giant, &sc->mly_task_complete);
|
||||
else
|
||||
#endif
|
||||
mly_complete(sc, 0);
|
||||
|
@ -41,6 +41,7 @@ static MALLOC_DEFINE(M_TASKQUEUE, "taskqueue", "Task Queues");
|
||||
static STAILQ_HEAD(taskqueue_list, taskqueue) taskqueue_queues;
|
||||
|
||||
static void *taskqueue_ih;
|
||||
static void *taskqueue_giant_ih;
|
||||
static struct mtx taskqueue_queues_mutex;
|
||||
|
||||
struct taskqueue {
|
||||
@ -219,6 +220,22 @@ taskqueue_swi_run(void *dummy)
|
||||
taskqueue_run(taskqueue_swi);
|
||||
}
|
||||
|
||||
static void
|
||||
taskqueue_swi_giant_enqueue(void *context)
|
||||
{
|
||||
swi_sched(taskqueue_giant_ih, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
taskqueue_swi_giant_run(void *dummy)
|
||||
{
|
||||
taskqueue_run(taskqueue_swi_giant);
|
||||
}
|
||||
|
||||
TASKQUEUE_DEFINE(swi, taskqueue_swi_enqueue, 0,
|
||||
swi_add(NULL, "task queue", taskqueue_swi_run, NULL, SWI_TQ, 0,
|
||||
&taskqueue_ih));
|
||||
swi_add(NULL, "task queue", taskqueue_swi_run, NULL, SWI_TQ,
|
||||
INTR_MPSAFE, &taskqueue_ih));
|
||||
|
||||
TASKQUEUE_DEFINE(swi_giant, taskqueue_swi_giant_enqueue, 0,
|
||||
swi_add(NULL, "Giant task queue", taskqueue_swi_giant_run,
|
||||
NULL, SWI_TQ_GIANT, 0, &taskqueue_giant_ih));
|
||||
|
@ -12,5 +12,6 @@ SRCS+= device_if.h bus_if.h pci_if.h
|
||||
# To enable debug output from the driver, uncomment these two lines.
|
||||
#CFLAGS+= -DAAC_DEBUG=2
|
||||
#SRCS+= aac_debug.c
|
||||
CFLAGS+= -g
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
@ -251,7 +251,7 @@ ng_btsocket_hci_raw_node_rcvmsg(node_p node, item_p item, hook_p lasthook)
|
||||
error = ENOBUFS;
|
||||
} else {
|
||||
NG_BT_ITEMQ_ENQUEUE(&ng_btsocket_hci_raw_queue, item);
|
||||
error = taskqueue_enqueue(taskqueue_swi,
|
||||
error = taskqueue_enqueue(taskqueue_swi_giant,
|
||||
&ng_btsocket_hci_raw_task);
|
||||
}
|
||||
mtx_unlock(&ng_btsocket_hci_raw_queue_mtx);
|
||||
@ -300,7 +300,7 @@ ng_btsocket_hci_raw_node_rcvdata(hook_p hook, item_p item)
|
||||
error = ENOBUFS;
|
||||
} else {
|
||||
NG_BT_ITEMQ_ENQUEUE(&ng_btsocket_hci_raw_queue, item);
|
||||
error = taskqueue_enqueue(taskqueue_swi,
|
||||
error = taskqueue_enqueue(taskqueue_swi_giant,
|
||||
&ng_btsocket_hci_raw_task);
|
||||
}
|
||||
mtx_unlock(&ng_btsocket_hci_raw_queue_mtx);
|
||||
|
@ -309,7 +309,7 @@ ng_btsocket_l2cap_node_disconnect(hook_p hook)
|
||||
*/
|
||||
|
||||
if (NG_HOOK_PRIVATE(hook) != NULL)
|
||||
return (taskqueue_enqueue(taskqueue_swi,
|
||||
return (taskqueue_enqueue(taskqueue_swi_giant,
|
||||
&ng_btsocket_l2cap_rt_task));
|
||||
|
||||
NG_HOOK_UNREF(hook); /* Remove extra reference */
|
||||
@ -343,7 +343,7 @@ ng_btsocket_l2cap_node_rcvmsg(node_p node, item_p item, hook_p hook)
|
||||
}
|
||||
|
||||
NG_BT_ITEMQ_ENQUEUE(&ng_btsocket_l2cap_queue, item);
|
||||
error = taskqueue_enqueue(taskqueue_swi,
|
||||
error = taskqueue_enqueue(taskqueue_swi_giant,
|
||||
&ng_btsocket_l2cap_queue_task);
|
||||
}
|
||||
mtx_unlock(&ng_btsocket_l2cap_queue_mtx);
|
||||
@ -377,7 +377,7 @@ ng_btsocket_l2cap_node_rcvdata(hook_p hook, item_p item)
|
||||
NGI_SET_HOOK(item, hook);
|
||||
|
||||
NG_BT_ITEMQ_ENQUEUE(&ng_btsocket_l2cap_queue, item);
|
||||
error = taskqueue_enqueue(taskqueue_swi,
|
||||
error = taskqueue_enqueue(taskqueue_swi_giant,
|
||||
&ng_btsocket_l2cap_queue_task);
|
||||
}
|
||||
mtx_unlock(&ng_btsocket_l2cap_queue_mtx);
|
||||
|
@ -242,7 +242,7 @@ ng_btsocket_l2cap_raw_node_disconnect(hook_p hook)
|
||||
*/
|
||||
|
||||
if (NG_HOOK_PRIVATE(hook) != NULL)
|
||||
return (taskqueue_enqueue(taskqueue_swi,
|
||||
return (taskqueue_enqueue(taskqueue_swi_giant,
|
||||
&ng_btsocket_l2cap_raw_rt_task));
|
||||
|
||||
NG_HOOK_UNREF(hook); /* Remove extra reference */
|
||||
@ -276,7 +276,7 @@ ng_btsocket_l2cap_raw_node_rcvmsg(node_p node, item_p item, hook_p hook)
|
||||
}
|
||||
|
||||
NG_BT_ITEMQ_ENQUEUE(&ng_btsocket_l2cap_raw_queue, item);
|
||||
error = taskqueue_enqueue(taskqueue_swi,
|
||||
error = taskqueue_enqueue(taskqueue_swi_giant,
|
||||
&ng_btsocket_l2cap_raw_queue_task);
|
||||
}
|
||||
mtx_unlock(&ng_btsocket_l2cap_raw_queue_mtx);
|
||||
|
@ -94,8 +94,9 @@ struct ithd {
|
||||
#define SWI_CAMNET 2
|
||||
#define SWI_CAMBIO 3
|
||||
#define SWI_VM 4
|
||||
#define SWI_TQ 5
|
||||
#define SWI_CLOCK 6
|
||||
#define SWI_TQ_GIANT 5
|
||||
#define SWI_TQ 6
|
||||
#define SWI_CLOCK 7
|
||||
|
||||
extern struct ithd *tty_ithd;
|
||||
extern struct ithd *clk_ithd;
|
||||
|
@ -110,6 +110,7 @@ struct __hack
|
||||
* This queue is serviced by a software interrupt handler. To enqueue
|
||||
* a task, call taskqueue_enqueue(taskqueue_swi, &task).
|
||||
*/
|
||||
TASKQUEUE_DECLARE(swi_giant);
|
||||
TASKQUEUE_DECLARE(swi);
|
||||
|
||||
#endif /* !_SYS_TASKQUEUE_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user