Changeset 908bb96 in mainline


Ignore:
Timestamp:
2012-11-22T21:42:36Z (12 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e32720ff
Parents:
1dbc43f
Message:

Postpone printing the message about killing a task due to a failed late
reservation request until it is clear the task is going to be kiiled.

Location:
kernel/generic
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/mm/as.h

    r1dbc43f r908bb96  
    6868#define AS_AREA_ATTR_PARTIAL  1  /**< Not fully initialized area. */
    6969
     70/** The page fault was resolved by as_page_fault(). */
     71#define AS_PF_OK     0
     72
     73/** The page fault was caused by memcpy_from_uspace() or memcpy_to_uspace(). */
     74#define AS_PF_DEFER  1
     75
    7076/** The page fault was not resolved by as_page_fault(). */
    71 #define AS_PF_FAULT  0
    72 
    73 /** The page fault was resolved by as_page_fault(). */
    74 #define AS_PF_OK  1
    75 
    76 /** The page fault was caused by memcpy_from_uspace() or memcpy_to_uspace(). */
    77 #define AS_PF_DEFER  2
     77#define AS_PF_FAULT  2
     78
     79/** The page fault was not resolved by as_page_fault(). Non-verbose version. */
     80#define AS_PF_SILENT 3
    7881
    7982/** Address space structure.
  • kernel/generic/include/proc/task.h

    r1dbc43f r908bb96  
    134134        uint64_t ucycles;
    135135        uint64_t kcycles;
    136 
    137         /** If true, do not attempt to print a verbose kill message. */
    138         bool silent_kill;
    139136} task_t;
    140137
  • kernel/generic/src/interrupt/interrupt.c

    r1dbc43f r908bb96  
    166166}
    167167
    168 static NO_TRACE void fault_from_uspace_core(istate_t *istate, const char *fmt, va_list args)
    169 {
    170         if (!TASK->silent_kill) {
    171                 printf("Task %s (%" PRIu64 ") killed due to an exception at "
    172                     "program counter %p.\n", TASK->name, TASK->taskid,
    173                     (void *) istate_get_pc(istate));
    174        
    175                 istate_decode(istate);
    176                 stack_trace_istate(istate);
    177        
    178                 printf("Kill message: ");
    179                 vprintf(fmt, args);
    180                 printf("\n");
    181         }
     168static NO_TRACE
     169void fault_from_uspace_core(istate_t *istate, const char *fmt, va_list args)
     170{
     171        printf("Task %s (%" PRIu64 ") killed due to an exception at "
     172            "program counter %p.\n", TASK->name, TASK->taskid,
     173            (void *) istate_get_pc(istate));
     174       
     175        istate_decode(istate);
     176        stack_trace_istate(istate);
     177       
     178        printf("Kill message: ");
     179        vprintf(fmt, args);
     180        printf("\n");
    182181       
    183182        task_kill_self(true);
  • kernel/generic/src/mm/as.c

    r1dbc43f r908bb96  
    13631363int as_page_fault(uintptr_t page, pf_access_t access, istate_t *istate)
    13641364{
     1365        int rc = AS_PF_FAULT;
     1366
    13651367        if (!THREAD)
    13661368                goto page_fault;
     
    14231425         * Resort to the backend page fault handler.
    14241426         */
    1425         if (area->backend->page_fault(area, page, access) != AS_PF_OK) {
     1427        rc = area->backend->page_fault(area, page, access);
     1428        if (rc != AS_PF_OK) {
    14261429                page_table_unlock(AS, false);
    14271430                mutex_unlock(&area->lock);
     
    14441447                istate_set_retaddr(istate,
    14451448                    (uintptr_t) &memcpy_to_uspace_failover_address);
     1449        } else if (rc == AS_PF_SILENT) {
     1450                printf("Killing task %" PRIu64 " due to a "
     1451                    "failed late reservation request.\n", TASK->taskid);
     1452                task_kill_self(true);
    14461453        } else {
    14471454                fault_if_from_uspace(istate, "Page fault: %p.", (void *) page);
  • kernel/generic/src/mm/backend_anon.c

    r1dbc43f r908bb96  
    255255                         * Reserve the memory for this page now.
    256256                         */
    257                         if (!reserve_try_alloc(1)) {
    258                                 printf("Killing task %" PRIu64 " due to a "
    259                                     "failed late reservation request.\n",
    260                                     TASK->taskid);
    261                                 TASK->silent_kill = true;
    262                                 return AS_PF_FAULT;
    263                         }
     257                        if (!reserve_try_alloc(1))
     258                                return AS_PF_SILENT;
    264259                }
    265260
  • kernel/generic/src/proc/task.c

    r1dbc43f r908bb96  
    197197        task->kcycles = 0;
    198198
    199         task->silent_kill = false;
    200        
    201199        task->ipc_info.call_sent = 0;
    202200        task->ipc_info.call_received = 0;
Note: See TracChangeset for help on using the changeset viewer.