Changes in / [bc7d44c:b9c7425] in mainline
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/ipc/sysipc.h
rbc7d44c rb9c7425 52 52 unative_t sys_ipc_wait_for_call(ipc_data_t *calldata, uint32_t usec, 53 53 int nonblocking); 54 unative_t sys_ipc_poke(void);55 54 unative_t sys_ipc_forward_fast(unative_t callid, unative_t phoneid, 56 55 unative_t method, unative_t arg1, unative_t arg2, int mode); -
kernel/generic/include/synch/waitq.h
rbc7d44c rb9c7425 68 68 struct thread; 69 69 70 extern void waitq_initialize(waitq_t *); 71 extern int waitq_sleep_timeout(waitq_t *, uint32_t, int); 72 extern ipl_t waitq_sleep_prepare(waitq_t *); 73 extern int waitq_sleep_timeout_unsafe(waitq_t *, uint32_t, int); 74 extern void waitq_sleep_finish(waitq_t *, int, ipl_t); 75 extern void waitq_wakeup(waitq_t *, wakeup_mode_t); 76 extern void _waitq_wakeup_unsafe(waitq_t *, wakeup_mode_t); 77 extern void waitq_interrupt_sleep(struct thread *); 78 extern void waitq_unsleep(waitq_t *); 70 extern void waitq_initialize(waitq_t *wq); 71 extern int waitq_sleep_timeout(waitq_t *wq, uint32_t usec, int flags); 72 extern ipl_t waitq_sleep_prepare(waitq_t *wq); 73 extern int waitq_sleep_timeout_unsafe(waitq_t *wq, uint32_t usec, int flags); 74 extern void waitq_sleep_finish(waitq_t *wq, int rc, ipl_t ipl); 75 extern void waitq_wakeup(waitq_t *wq, wakeup_mode_t mode); 76 extern void _waitq_wakeup_unsafe(waitq_t *wq, wakeup_mode_t mode); 77 extern void waitq_interrupt_sleep(struct thread *t); 79 78 80 79 #endif -
kernel/generic/include/syscall/syscall.h
rbc7d44c rb9c7425 66 66 SYS_IPC_FORWARD_SLOW, 67 67 SYS_IPC_WAIT, 68 SYS_IPC_POKE,69 68 SYS_IPC_HANGUP, 70 69 SYS_IPC_REGISTER_IRQ, -
kernel/generic/src/ipc/sysipc.c
rbc7d44c rb9c7425 44 44 #include <ipc/ipcrsc.h> 45 45 #include <ipc/kbox.h> 46 #include <synch/waitq.h>47 46 #include <udebug/udebug_ipc.h> 48 47 #include <arch/interrupt.h> … … 1052 1051 } 1053 1052 1054 /** Interrupt one thread from sys_ipc_wait_for_call(). */1055 unative_t sys_ipc_poke(void)1056 {1057 waitq_unsleep(&TASK->answerbox.wq);1058 return EOK;1059 }1060 1061 1053 /** Connect an IRQ handler to a task. 1062 1054 * -
kernel/generic/src/synch/waitq.c
rbc7d44c rb9c7425 171 171 out: 172 172 spinlock_unlock(&threads_lock); 173 interrupts_restore(ipl);174 }175 176 /** Interrupt the first thread sleeping in the wait queue.177 *178 * Note that the caller somehow needs to know that the thread to be interrupted179 * is sleeping interruptibly.180 *181 * @param wq Pointer to wait queue.182 */183 void waitq_unsleep(waitq_t *wq)184 {185 ipl_t ipl;186 187 ipl = interrupts_disable();188 spinlock_lock(&wq->lock);189 190 if (!list_empty(&wq->head)) {191 thread_t *t;192 193 t = list_get_instance(wq->head.next, thread_t, wq_link);194 spinlock_lock(&t->lock);195 ASSERT(t->sleep_interruptible);196 if (t->timeout_pending && timeout_unregister(&t->sleep_timeout))197 t->timeout_pending = false;198 list_remove(&t->wq_link);199 t->saved_context = t->sleep_interruption_context;200 t->sleep_queue = NULL;201 spinlock_unlock(&t->lock);202 thread_ready(t);203 }204 205 spinlock_unlock(&wq->lock);206 173 interrupts_restore(ipl); 207 174 } -
kernel/generic/src/syscall/syscall.c
rbc7d44c rb9c7425 137 137 (syshandler_t) sys_ipc_forward_slow, 138 138 (syshandler_t) sys_ipc_wait_for_call, 139 (syshandler_t) sys_ipc_poke,140 139 (syshandler_t) sys_ipc_hangup, 141 140 (syshandler_t) sys_ipc_register_irq, -
uspace/app/trace/syscalls.c
rbc7d44c rb9c7425 62 62 [SYS_IPC_FORWARD_SLOW] = { "ipc_forward_slow", 3, V_ERRNO }, 63 63 [SYS_IPC_WAIT] = { "ipc_wait_for_call", 3, V_HASH }, 64 [SYS_IPC_POKE] = { "ipc_poke", 0, V_ERRNO },65 64 [SYS_IPC_HANGUP] = { "ipc_hangup", 1, V_ERRNO }, 66 65 [SYS_IPC_REGISTER_IRQ] = { "ipc_register_irq", 4, V_ERRNO }, -
uspace/lib/libc/generic/async.c
rbc7d44c rb9c7425 106 106 107 107 atomic_t async_futex = FUTEX_INITIALIZER; 108 109 /** Number of threads waiting for IPC in the kernel. */110 atomic_t threads_in_ipc_wait = { 0 };111 108 112 109 /** Structures of this type represent a waiting fibril. */ … … 686 683 687 684 futex_up(&async_futex); 688 689 atomic_inc(&threads_in_ipc_wait);690 685 691 686 ipc_call_t call; … … 693 688 SYNCH_FLAGS_NONE); 694 689 695 atomic_dec(&threads_in_ipc_wait);696 697 690 if (!callid) { 698 691 handle_expired_timeouts(); -
uspace/lib/libc/generic/fibril_sync.c
rbc7d44c rb9c7425 40 40 #include <assert.h> 41 41 42 static void optimize_execution_power(void)43 {44 /*45 * When waking up a worker fibril previously blocked in fibril46 * synchronization, chances are that there is an idle manager fibril47 * waiting for IPC, that could start executing the awakened worker48 * fibril right away. We try to detect this and bring the manager49 * fibril back to fruitful work.50 */51 if (atomic_get(&threads_in_ipc_wait) > 0)52 ipc_poke();53 }54 55 42 void fibril_mutex_initialize(fibril_mutex_t *fm) 56 43 { … … 97 84 list_remove(&f->link); 98 85 fibril_add_ready((fid_t) f); 99 optimize_execution_power();100 86 } 101 87 } … … 166 152 fibril_add_ready((fid_t) f); 167 153 frw->writers++; 168 optimize_execution_power();169 154 break; 170 155 } else { … … 172 157 fibril_add_ready((fid_t) f); 173 158 frw->readers++; 174 optimize_execution_power();175 159 } 176 160 } … … 216 200 list_remove(&f->link); 217 201 fibril_add_ready((fid_t) f); 218 optimize_execution_power();219 202 if (once) 220 203 break; -
uspace/lib/libc/generic/ipc.c
rbc7d44c rb9c7425 565 565 } 566 566 567 /** Interrupt one thread of this task from waiting for IPC. */568 void ipc_poke(void)569 {570 __SYSCALL0(SYS_IPC_POKE);571 }572 573 567 /** Ask destination to do a callback connection. 574 568 * -
uspace/lib/libc/include/async.h
rbc7d44c rb9c7425 47 47 extern atomic_t async_futex; 48 48 49 extern atomic_t threads_in_ipc_wait;50 51 49 extern int __async_init(void); 52 50 extern ipc_callid_t async_get_call_timeout(ipc_call_t *call, suseconds_t usecs); -
uspace/lib/libc/include/ipc/ipc.h
rbc7d44c rb9c7425 192 192 extern ipc_callid_t ipc_wait_cycle(ipc_call_t *, uint32_t, int); 193 193 extern ipc_callid_t ipc_wait_for_call_timeout(ipc_call_t *, uint32_t); 194 extern void ipc_poke(void);195 194 196 195 static inline ipc_callid_t ipc_wait_for_call(ipc_call_t *data)
Note:
See TracChangeset
for help on using the changeset viewer.