Changeset 0dc4258 in mainline


Ignore:
Timestamp:
2007-09-29T12:21:39Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bb725a9
Parents:
b878df3
Message:

Enable forwarding of IPC_M_AS_AREA_SEND, IPC_M_AS_AREA_RECV, IPC_M_DATA_SEND
calls. In order to prevent the forwarder from cloberring the call data (i.e.
source and destination address, and size) by treating these three methods as
immutable on forward. This feature is experimental, but has huge benefits in
that it can significantly reduce the amount of data sharing (the middle man need
not modify its address space mappings) or the amount of data copying (the middle
man need not receive the data from the sender and then resend them to the next
recipient). As a result, it can reduce N such calls for a communication channel
with N tasks along the way to 1 such call.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/ipc/sysipc.c

    rb878df3 r0dc4258  
    7070 *                      Otherwise return 0.
    7171 */
    72 static inline int is_system_method(unative_t method)
     72static inline int method_is_system(unative_t method)
    7373{
    7474        if (method <= IPC_M_LAST_SYSTEM)
     
    8787 *                      Otherwise return 0.
    8888 */
    89 static inline int is_forwardable(unative_t method)
     89static inline int method_is_forwardable(unative_t method)
    9090{
    9191        switch (method) {
    9292        case IPC_M_PHONE_HUNGUP:
    93         case IPC_M_AS_AREA_SEND:
    94         case IPC_M_AS_AREA_RECV:
    95         case IPC_M_DATA_SEND:
    9693                /* This message is meant only for the original recipient. */
    9794                return 0;
    9895        default:
    9996                return 1;
     97        }
     98}
     99
     100/** Decide if the message with this method is immutable on forward.
     101 *
     102 * - some system messages may be forwarded, for some of them
     103 *   it is useless
     104 *
     105 * @param method        Method to be decided.
     106 *
     107 * @return              Return 1 if the method is immutable on forward.
     108 *                      Otherwise return 0.
     109 */
     110static inline int method_is_immutable(unative_t method)
     111{
     112        switch (method) {
     113        case IPC_M_AS_AREA_SEND:
     114        case IPC_M_AS_AREA_RECV:
     115        case IPC_M_DATA_SEND:
     116                return 1;
     117                break;
     118        default:
     119                return 0;
    100120        }
    101121}
     
    504524 * in the forwarded message with the new method and the new arg1, respectively.
    505525 * Otherwise the METHOD and ARG1 are rewritten with the new method and arg1,
    506  * respectively.
     526 * respectively. Also note there is a set of immutable methods, for which the
     527 * new method and argument is not set and these values are ignored.
    507528 *
    508529 * Warning: If implementing non-fast version, make sure that
     
    527548        });             
    528549
    529         if (!is_forwardable(IPC_GET_METHOD(call->data))) {
     550        if (!method_is_forwardable(IPC_GET_METHOD(call->data))) {
    530551                IPC_SET_RETVAL(call->data, EFORWARD);
    531552                ipc_answer(&TASK->answerbox, call);
     
    533554        }
    534555
    535         /* Userspace is not allowed to change method of system methods
    536          * on forward, allow changing ARG1 and ARG2 by means of method and arg1
     556        /*
     557         * Userspace is not allowed to change method of system methods on
     558         * forward, allow changing ARG1 and ARG2 by means of method and arg1.
     559         * If the method is immutable, don't change anything.
    537560         */
    538         if (is_system_method(IPC_GET_METHOD(call->data))) {
    539                 if (IPC_GET_METHOD(call->data) == IPC_M_CONNECT_TO_ME)
    540                         phone_dealloc(IPC_GET_ARG3(call->data));
    541 
    542                 IPC_SET_ARG1(call->data, method);
    543                 IPC_SET_ARG2(call->data, arg1);
    544         } else {
    545                 IPC_SET_METHOD(call->data, method);
    546                 IPC_SET_ARG1(call->data, arg1);
     561        if (!method_is_immutable(IPC_GET_METHOD(call->data))) {
     562                if (method_is_system(IPC_GET_METHOD(call->data))) {
     563                        if (IPC_GET_METHOD(call->data) == IPC_M_CONNECT_TO_ME)
     564                                phone_dealloc(IPC_GET_ARG3(call->data));
     565
     566                        IPC_SET_ARG1(call->data, method);
     567                        IPC_SET_ARG2(call->data, arg1);
     568                } else {
     569                        IPC_SET_METHOD(call->data, method);
     570                        IPC_SET_ARG1(call->data, arg1);
     571                }
    547572        }
    548573
Note: See TracChangeset for help on using the changeset viewer.