Changeset 97d17fe in mainline
- Timestamp:
- 2010-12-11T21:47:37Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 554debd
- Parents:
- c01f8e6
- Location:
- kernel/generic
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/ipc/ipc.h
rc01f8e6 r97d17fe 43 43 #define IPC_CALL_LEN 6 44 44 45 /** Maximum active async calls per thread */ 46 #ifdef CONFIG_DEBUG 47 #define IPC_MAX_ASYNC_CALLS 4 48 #else 49 #define IPC_MAX_ASYNC_CALLS 4000 50 #endif 45 /** Maximum active async calls per phone */ 46 #define IPC_MAX_ASYNC_CALLS 4 51 47 52 48 /* Flags for calls */ -
kernel/generic/include/proc/task.h
rc01f8e6 r97d17fe 93 93 phone_t phones[IPC_MAX_PHONES]; 94 94 stats_ipc_t ipc_info; /**< IPC statistics */ 95 /**96 * Active asynchronous messages. It is used for limiting uspace to97 * certain extent.98 */99 atomic_t active_calls;100 95 /** List of synchronous answerboxes. */ 101 96 link_t sync_box_head; -
kernel/generic/src/ipc/ipc.c
rc01f8e6 r97d17fe 655 655 (call->flags & IPC_CALL_NOTIF)); 656 656 657 /*658 * Record the receipt of this call in the current task's counter659 * of active calls. IPC_M_PHONE_HUNGUP calls do not contribute660 * to this counter so do not record answers to them either.661 */662 if (!(call->flags & IPC_CALL_DISCARD_ANSWER))663 atomic_dec(&TASK->active_calls);664 665 657 ipc_call_free(call); 666 658 } -
kernel/generic/src/ipc/sysipc.c
rc01f8e6 r97d17fe 644 644 } 645 645 646 /** Check that the task did not exceed the allowed limit of asynchronous calls. 647 * 646 /** Check that the task did not exceed the allowed limit of asynchronous calls 647 * made over a phone. 648 * 649 * @param phone Phone to check the limit against. 648 650 * @return 0 if limit not reached or -1 if limit exceeded. 649 651 * 650 652 */ 651 static int check_call_limit(void) 652 { 653 if (atomic_preinc(&TASK->active_calls) > IPC_MAX_ASYNC_CALLS) { 654 atomic_dec(&TASK->active_calls); 653 static int check_call_limit(phone_t *phone) 654 { 655 if (atomic_get(&phone->active_calls) >= IPC_MAX_ASYNC_CALLS) 655 656 return -1; 656 }657 657 658 658 return 0; … … 680 680 unative_t arg1, unative_t arg2, unative_t arg3, unative_t arg4) 681 681 { 682 if (check_call_limit())683 return IPC_CALLRET_TEMPORARY;684 685 682 phone_t *phone; 686 683 if (phone_get(phoneid, &phone) != EOK) 687 684 return IPC_CALLRET_FATAL; 685 686 if (check_call_limit(phone)) 687 return IPC_CALLRET_TEMPORARY; 688 688 689 689 call_t *call = ipc_call_alloc(0); … … 720 720 unative_t sys_ipc_call_async_slow(unative_t phoneid, ipc_data_t *data) 721 721 { 722 if (check_call_limit())723 return IPC_CALLRET_TEMPORARY;724 725 722 phone_t *phone; 726 723 if (phone_get(phoneid, &phone) != EOK) 727 724 return IPC_CALLRET_FATAL; 725 726 if (check_call_limit(phone)) 727 return IPC_CALLRET_TEMPORARY; 728 728 729 729 call_t *call = ipc_call_alloc(0); … … 1046 1046 ipc_call_free(call); 1047 1047 goto restart; 1048 } else {1049 /*1050 * Decrement the counter of active calls only if the1051 * call is not an answer to IPC_M_PHONE_HUNGUP,1052 * which doesn't contribute to the counter.1053 */1054 atomic_dec(&TASK->active_calls);1055 1048 } 1056 1049 -
kernel/generic/src/proc/task.c
rc01f8e6 r97d17fe 151 151 atomic_set(&task->refcount, 0); 152 152 atomic_set(&task->lifecount, 0); 153 atomic_set(&task->active_calls, 0);154 153 155 154 irq_spinlock_initialize(&task->lock, "task_t_lock"); … … 478 477 #ifdef __32_BITS__ 479 478 if (*additional) 480 printf("%-8" PRIu64 " %9" PRIua " %7" PRIua, task->taskid,481 atomic_get(&task->refcount) , atomic_get(&task->active_calls));479 printf("%-8" PRIu64 " %9" PRIua, task->taskid, 480 atomic_get(&task->refcount)); 482 481 else 483 482 printf("%-8" PRIu64 " %-14s %-5" PRIu32 " %10p %10p" … … 490 489 if (*additional) 491 490 printf("%-8" PRIu64 " %9" PRIu64 "%c %9" PRIu64 "%c " 492 "%9" PRIua " %7" PRIua, 493 task->taskid, ucycles, usuffix, kcycles, ksuffix, 494 atomic_get(&task->refcount), atomic_get(&task->active_calls)); 491 "%9" PRIua, task->taskid, ucycles, usuffix, kcycles, 492 ksuffix, atomic_get(&task->refcount)); 495 493 else 496 494 printf("%-8" PRIu64 " %-14s %-5" PRIu32 " %18p %18p\n",
Note:
See TracChangeset
for help on using the changeset viewer.