Opened 14 years ago

Closed 13 years ago

#243 closed defect (fixed)

ppc32 exception handling broken

Reported by: Jakub Jermář Owned by: Martin Decky
Priority: critical Milestone: 0.5.0
Component: helenos/kernel/ppc32 Version: mainline
Keywords: sashimi_regression Cc:
Blocker for: Depends on: #343
See also:

Description

This problem is described in this mailing list thread.

Excerpt from symptoms:

On PowerPC I sometimes trigger the assertion

        PREEMPTION_DISABLED in preemption_enable() with stack trace:
           preemption_enable()
           event_is_subscribed()
           putchar()
           vprintf_str_write()
           printf_core()
           vprintf()
           printf()
           waitq_sleep_timeout()
           _semaphore_down_timeout()
           _mutex_lock_timeout()
           pt_lock()
           page_table_lock()
           pht_refill()
           exc_dispatch()

    and

        (!PREEMPTION_DISABLED) || (PARAM_NON_BLOCKING(flags, usec)) with
        stack trace:
           waitq_sleep_timeout()
           _mutex_lock_timeout()
           pt_lock()
           page_table_lock()
           pht_refill()
           exc_dispatch()

Initial assesment by Martin:

I believe that I already know the reason for the problems on ppc32: The 
code does not respect the assumption that the THE structure must be 
always valid, even in the interrupt context.

The reason lies in the complicated exception handling mechanism where 
all memory virtualization is turned off. Thus you cannot use the 
thread's original stack for storing the context (because generally you 
don't know where in the physical memory the kernel stack is).

Currently we use a dedicated kernel stack, which certainly does not 
contain the THE structure. Suprisingly this worked fine for many years 
until your changeset 434 where you added the !PREEMPTION_DISABLED 
assertion. Even more suprisingly this was probably the first time the 
exception code started to touch the THE structure.

Change History (9)

comment:1 by Jakub Jermář, 13 years ago

Owner: set to Martin Decky
Status: newassigned

comment:2 by Martin Decky, 13 years ago

Status: assignedaccepted

comment:3 by Martin Decky, 13 years ago

Milestone: 0.4.30.5.0

comment:4 by Jakub Jermář, 13 years ago

Keywords: sashimi_regression added

comment:5 by Jakub Jermář, 13 years ago

And couldn't we fix this by using a different mechanism for remembering thread local data on ppc32? On ia32, we also needn't use the stack based solution, but we could make use of e.g. segmentation or on sparc64 and ia64 we could use a banked register.

comment:6 by Martin Decky, 13 years ago

Resolution: fixed
Status: acceptedclosed

Fixed as of mainline,971, more details in mailing list.

comment:7 by Martin Decky, 13 years ago

Depends on: #343
Resolution: fixed
Status: closedreopened

comment:8 by Jakub Jermář, 13 years ago

This should be theoretically non-reproducible in changeset:mainline,981. Unfortunately, ppc32 suffers occasional panics on various assertions triggered usually from as_destroy() and as_area_destroy(). The issue seems to be ppc32 specific.

comment:9 by Martin Decky, 13 years ago

Resolution: fixed
Status: reopenedclosed

Although I have not fully reviewed the changeset, the conceptual idea has been discussed on the mailing list and the implementation seems to work fine. Therefore I am marking this ticket as closed and fixed again.

Note: See TracTickets for help on using tickets.