Changeset b9a2725 in mainline


Ignore:
Timestamp:
2018-11-09T22:03:24Z (5 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c222816
Parents:
c0ea739
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-11-09 20:54:46)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-11-09 22:03:24)
Message:

Allocate call for ipc_phone_hangup() ahead of time

Location:
kernel/generic
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/ipc/ipc.h

    rc0ea739 rb9a2725  
    4747struct answerbox;
    4848struct task;
     49struct call;
    4950
    5051typedef enum {
     
    6768        struct task *caller;
    6869        struct answerbox *callee;
     70        /* A call prepared for hangup ahead of time, so that it cannot fail. */
     71        struct call *hangup_call;
    6972        ipc_phone_state_t state;
    7073        atomic_t active_calls;
     
    172175
    173176extern call_t *ipc_call_alloc(unsigned int);
    174 extern void ipc_call_free(call_t *);
    175 extern void ipc_call_hold(call_t *);
    176 extern void ipc_call_release(call_t *);
    177177
    178178extern errno_t ipc_call_sync(phone_t *, call_t *);
  • kernel/generic/src/ipc/ipc.c

    rc0ea739 rb9a2725  
    116116call_t *ipc_call_alloc(unsigned int flags)
    117117{
     118        // TODO: Allocate call and kobject in single allocation
     119
    118120        call_t *call = slab_alloc(call_cache, flags);
    119121        if (!call)
     
    483485                kobject_put(phone->kobject);
    484486
    485                 call_t *call = ipc_call_alloc(0);
     487                call_t *call = phone->hangup_call;
     488                phone->hangup_call = NULL;
     489                assert(call);
     490
    486491                IPC_SET_IMETHOD(call->data, IPC_M_PHONE_HUNGUP);
    487492                call->request_method = IPC_M_PHONE_HUNGUP;
     
    685690                         * to exist as soon as we release it.
    686691                         */
    687                         call_t *call = ipc_call_alloc(0);
     692                        call_t *call = phone->hangup_call;
     693                        phone->hangup_call = NULL;
     694                        assert(call);
     695
    688696                        IPC_SET_IMETHOD(call->data, IPC_M_PHONE_HUNGUP);
    689697                        call->request_method = IPC_M_PHONE_HUNGUP;
  • kernel/generic/src/ipc/ipcrsc.c

    rc0ea739 rb9a2725  
    4646{
    4747        phone_t *phone = (phone_t *) arg;
     48        if (phone->hangup_call)
     49                kobject_put(phone->hangup_call->kobject);
    4850        slab_free(phone_cache, phone);
    4951}
     
    7981                        return ENOMEM;
    8082                }
     83                call_t *hcall = ipc_call_alloc(FRAME_ATOMIC);
     84                if (!hcall) {
     85                        cap_free(TASK, handle);
     86                        slab_free(phone_cache, phone);
     87                        free(kobj);
     88                        return ENOMEM;
     89                }
    8190
    8291                ipc_phone_init(phone, task);
    8392                phone->state = IPC_PHONE_CONNECTING;
     93                phone->hangup_call = hcall;
    8494
    8595                kobject_initialize(kobj, KOBJECT_TYPE_PHONE, phone,
Note: See TracChangeset for help on using the changeset viewer.