Changeset 6769005 in mainline for kernel/generic/src/ipc/sysipc.c


Ignore:
Timestamp:
2018-10-31T06:03:38Z (5 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
53ee7a0
Parents:
94ab1fe
git-author:
Jakub Jermar <jakub@…> (2018-10-28 12:42:35)
git-committer:
Jakub Jermar <jakub@…> (2018-10-31 06:03:38)
Message:

Use user-defined labels instead of phone hashes

This commit changes the way how the async framework maps incomming calls
to connections. Instead of abusing the kernel addresses of attached
phones as identifiers, the IPC_M_CONNECT_TO_ME and IPC_M_CONNECT_ME_TO
messages allow the server to specify an arbitrary label which is
remembered in the connected phone and consequently imprinted on each
call which is routed through this phone.

The async framework uses the address of the connection structure as the
label. This removes the need for a connection hash table because each
incoming call already remembers the connection in its label.

To disambiguate this new label and the other user-defined label used for
answers, the call structure now has the request_label member for the
former and answer_label member for the latter.

This commit also moves the kernel definition of ipc_data_t to abi/ and
removes the uspace redefinition thereof. Finally, when forwarding the
IPC_M_CONNECT_TO_ME call, the phone capability and the kernel object
allocated in request_process are now correctly disposed of.

File:
1 edited

Legend:

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

    r94ab1fe r6769005  
    202202                        kobject_put(phone->kobject);
    203203                        phone->state = IPC_PHONE_SLAMMED;
     204                        phone->label = 0;
    204205                        irq_spinlock_unlock(&phone->callee->lock, true);
    205206                }
     
    386387
    387388        /* Set the user-defined label */
    388         call->data.label = label;
     389        call->data.answer_label = label;
    389390
    390391        errno_t res = request_preprocess(call, kobj->phone);
     
    430431
    431432        /* Set the user-defined label */
    432         call->data.label = label;
     433        call->data.answer_label = label;
    433434
    434435        errno_t res = request_preprocess(call, kobj->phone);
     
    504505        if (!method_is_immutable(IPC_GET_IMETHOD(call->data))) {
    505506                if (method_is_system(IPC_GET_IMETHOD(call->data))) {
    506                         if (IPC_GET_IMETHOD(call->data) == IPC_M_CONNECT_TO_ME)
    507                                 phone_dealloc((cap_phone_handle_t)
    508                                     IPC_GET_ARG5(call->data));
     507                        if (IPC_GET_IMETHOD(call->data) ==
     508                            IPC_M_CONNECT_TO_ME) {
     509                                kobject_put((kobject_t *) call->priv);
     510                                call->priv = 0;
     511                                cap_free(TASK,
     512                                    (cap_handle_t) IPC_GET_ARG5(call->data));
     513                        }
    509514
    510515                        IPC_SET_ARG1(call->data, imethod);
     
    771776        call->data.flags = call->flags;
    772777        if (call->flags & IPC_CALL_NOTIF) {
    773                 /* Set in_phone_hash to the interrupt counter */
    774                 call->data.phone = (void *) call->priv;
     778                /* Set the request_label to the interrupt counter */
     779                call->data.request_label = (sysarg_t) call->priv;
    775780
    776781                call->data.cap_handle = CAP_NIL;
Note: See TracChangeset for help on using the changeset viewer.