Changeset 235d31d in mainline for kernel/arch/ia64/src


Ignore:
Timestamp:
2014-12-22T17:47:40Z (11 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8c7d5ad
Parents:
eae91e0 (diff), 759ea0d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge the CHT pre-integration branch

This branch contains:

  • the merge of lp:~adam-hraska+lp/helenos/rcu, which brings:
  • a new preemptible kernel RCU variant called A-RCU,
  • a preemptible variant of Podzimek's non-preemptible kernel RCU and
  • a new variant of usersace RCU,
  • a new concurrent hash table (CHT) implementation based on RCU,
  • a deployment of CHT in kernel futex handling,
  • a deployment of the userspace RCU in the implementation of upgradable futexes,

all described in Adam Hraska's master thesis named Read-Copy-Update
for HelenOS, defended in 2013 at MFF UK; furthemore, the branch
fixes two synchronization bugs in condvars and waitq, respectively:

  • revid:adam.hraska+hos@gmail.com-20121116144921-3to9u1tn1sg07rg7
  • revid:adam.hraska+hos@gmail.com-20121116173623-km7gwtqixwudpe66
  • build fixes required to pass make check
  • overhaul of ia64 and sparc64 trap handling, to allow exc_dispatch() to be used now when the kernel is more picky about CPU state accounting
  • an important fix of the sparc64/sun4v preemptible trap handler
  • various other fixes of issues discovered on non-x86 architectures
Location:
kernel/arch/ia64/src
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ia64/src/ia64.c

    reae91e0 r235d31d  
    3737#include <errno.h>
    3838#include <interrupt.h>
     39#include <arch/interrupt.h>
    3940#include <macros.h>
    4041#include <str.h>
     
    8586void arch_pre_mm_init(void)
    8687{
     88        if (config.cpu_active == 1)
     89                exception_init();
    8790}
    8891
  • kernel/arch/ia64/src/interrupt.c

    reae91e0 r235d31d  
    5454#include <synch/spinlock.h>
    5555#include <mm/tlb.h>
     56#include <arch/mm/tlb.h>
    5657#include <symtab.h>
    5758#include <putchar.h>
     
    5960#define VECTORS_64_BUNDLE        20
    6061#define VECTORS_16_BUNDLE        48
    61 #define VECTORS_16_BUNDLE_START  0x5000
    62 
    63 #define VECTOR_MAX  0x7f00
    64 
    65 #define BUNDLE_SIZE  16
     62#define VECTORS_16_BUNDLE_START  0x50
     63
     64#define VECTOR_MAX  0x7f
    6665
    6766static const char *vector_names_64_bundle[VECTORS_64_BUNDLE] = {
     
    122121};
    123122
    124 static const char *vector_to_string(uint16_t vector)
    125 {
    126         ASSERT(vector <= VECTOR_MAX);
    127        
    128         if (vector >= VECTORS_16_BUNDLE_START)
    129                 return vector_names_16_bundle[(vector -
    130                     VECTORS_16_BUNDLE_START) / (16 * BUNDLE_SIZE)];
     123static const char *vector_to_string(unsigned int n)
     124{
     125        ASSERT(n <= VECTOR_MAX);
     126       
     127        if (n >= VECTORS_16_BUNDLE_START)
     128                return vector_names_16_bundle[n - VECTORS_16_BUNDLE_START];
    131129        else
    132                 return vector_names_64_bundle[vector / (64 * BUNDLE_SIZE)];
     130                return vector_names_64_bundle[n / 4];
    133131}
    134132
     
    153151}
    154152
    155 void general_exception(uint64_t vector, istate_t *istate)
     153void general_exception(unsigned int n, istate_t *istate)
    156154{
    157155        const char *desc;
     
    182180       
    183181        fault_if_from_uspace(istate, "General Exception (%s).", desc);
    184         panic_badtrap(istate, vector, "General Exception (%s).", desc);
    185 }
    186 
    187 void disabled_fp_register(uint64_t vector, istate_t *istate)
     182        panic_badtrap(istate, n, "General Exception (%s).", desc);
     183}
     184
     185void disabled_fp_register(unsigned int n, istate_t *istate)
    188186{
    189187#ifdef CONFIG_FPU_LAZY
     
    191189#else
    192190        fault_if_from_uspace(istate, "Interruption: %#hx (%s).",
    193             (uint16_t) vector, vector_to_string(vector));
     191            (uint16_t) n, vector_to_string(n));
    194192        panic_badtrap(istate, vector, "Interruption: %#hx (%s).",
    195             (uint16_t) vector, vector_to_string(vector));
     193            (uint16_t) n, vector_to_string(n));
    196194#endif
    197195}
    198196
    199 void nop_handler(uint64_t vector, istate_t *istate)
    200 {
    201 }
    202 
    203197/** Handle syscall. */
    204 int break_instruction(uint64_t vector, istate_t *istate)
    205 {
     198sysarg_t break_instruction(unsigned int n, istate_t *istate)
     199{
     200        sysarg_t ret;
     201
    206202        /*
    207203         * Move to next instruction after BREAK.
     
    214210        }
    215211       
    216         return syscall_handler(istate->in0, istate->in1, istate->in2,
     212        interrupts_enable();
     213        ret = syscall_handler(istate->in0, istate->in1, istate->in2,
    217214            istate->in3, istate->in4, istate->in5, istate->in6);
    218 }
    219 
    220 void universal_handler(uint64_t vector, istate_t *istate)
     215        interrupts_disable();
     216
     217        return ret;
     218}
     219
     220void universal_handler(unsigned int n, istate_t *istate)
    221221{
    222222        fault_if_from_uspace(istate, "Interruption: %#hx (%s).",
    223             (uint16_t) vector, vector_to_string(vector));
    224         panic_badtrap(istate, vector, "Interruption: %#hx (%s).",
    225             (uint16_t) vector, vector_to_string(vector));
     223            n, vector_to_string(n));
     224        panic_badtrap(istate, n, "Interruption: %#hx (%s).",
     225            n, vector_to_string(n));
    226226}
    227227
     
    229229{
    230230        asm volatile (
    231                 "mov cr.eoi=r0;;"
     231                "mov cr.eoi = r0 ;;"
    232232        );
    233233}
    234234
    235 void external_interrupt(uint64_t vector, istate_t *istate)
     235void external_interrupt(unsigned int n, istate_t *istate)
    236236{
    237237        cr_ivr_t ivr;
     
    298298}
    299299
     300void exception_init(void)
     301{
     302        unsigned int i;
     303
     304        for (i = 0; i < IVT_ITEMS; i++)
     305                exc_register(i, "universal_handler", false, universal_handler);
     306
     307        exc_register(EXC_ALT_ITLB_FAULT,
     308            vector_to_string(EXC_ALT_ITLB_FAULT), true,
     309            alternate_instruction_tlb_fault);
     310        exc_register(EXC_ALT_DTLB_FAULT,
     311            vector_to_string(EXC_ALT_DTLB_FAULT), true,
     312            alternate_data_tlb_fault);
     313        exc_register(EXC_NESTED_TLB_FAULT,
     314            vector_to_string(EXC_NESTED_TLB_FAULT), false,
     315            data_nested_tlb_fault);
     316        exc_register(EXC_DATA_D_BIT_FAULT,
     317            vector_to_string(EXC_DATA_D_BIT_FAULT), true,
     318            data_dirty_bit_fault);
     319        exc_register(EXC_INST_A_BIT_FAULT,
     320            vector_to_string(EXC_INST_A_BIT_FAULT), true,
     321            instruction_access_bit_fault);
     322        exc_register(EXC_DATA_A_BIT_FAULT,
     323            vector_to_string(EXC_DATA_A_BIT_FAULT), true,
     324            data_access_bit_fault);
     325        exc_register(EXC_EXT_INTERRUPT,
     326            vector_to_string(EXC_EXT_INTERRUPT), true,
     327            external_interrupt);
     328
     329        exc_register(EXC_PAGE_NOT_PRESENT,
     330            vector_to_string(EXC_PAGE_NOT_PRESENT), true,
     331            page_not_present);
     332        exc_register(EXC_DATA_AR_FAULT,
     333            vector_to_string(EXC_DATA_AR_FAULT), true,
     334            data_access_rights_fault);
     335        exc_register(EXC_GENERAL_EXCEPTION,
     336            vector_to_string(EXC_GENERAL_EXCEPTION), false,
     337            general_exception);
     338        exc_register(EXC_DISABLED_FP_REG,
     339            vector_to_string(EXC_DISABLED_FP_REG), true,
     340            disabled_fp_register);
     341}
     342
    300343/** @}
    301344 */
  • kernel/arch/ia64/src/ivt.S

    reae91e0 r235d31d  
    3131#include <arch/register.h>
    3232#include <arch/mm/page.h>
     33#include <arch/interrupt.h>
    3334#include <arch/istate_struct.h>
    3435#include <align.h>
     
    3940
    4041/** Partitioning of bank 0 registers. */
    41 #define R_OFFS          r16
     42#define R_VECTOR        r16
    4243#define R_HANDLER       r17
    4344#define R_RET           r18
    44 #define R_TMP           r19
    4545#define R_KSTACK_BSP    r22     /* keep in sync with before_thread_runs_arch() */
    4646#define R_KSTACK        r23     /* keep in sync with before_thread_runs_arch() */
    4747
    4848/* Speculation vector handler */
    49 .macro SPECULATION_VECTOR_HANDLER offs
    50     .org ivt + \offs
     49.macro SPECULATION_VECTOR_HANDLER vector
     50    .org ivt + \vector * 0x100
    5151
    5252    /* 1. Save predicates, IIM, IIP, IPSR and ISR CR's in bank 0 registers. */
     
    9494 * @param handler Interrupt handler address.
    9595 */
    96 .macro HEAVYWEIGHT_HANDLER offs, handler=universal_handler
    97     .org ivt + \offs
    98         mov R_OFFS = \offs
     96.macro HEAVYWEIGHT_HANDLER vector, handler=exc_dispatch
     97    .org ivt + \vector * 0x100
     98        mov R_VECTOR = \vector
    9999        movl R_HANDLER = \handler ;;
    100100        br heavyweight_handler
     
    165165         * copy input parameters to stack.
    166166         */
    167         mov R_TMP = 0x2c00 ;;
    168         cmp.eq p6, p5 = R_OFFS, R_TMP ;;
     167        cmp.eq p6, p5 = EXC_BREAK_INSTRUCTION, R_VECTOR ;;
    169168       
    170169        /*
     
    309308        mov loc1 = R_RET        /* b0 belonging to interrupted context */
    310309        mov loc2 = R_HANDLER
    311         mov out0 = R_OFFS
     310        mov out0 = R_VECTOR
    312311       
    313312        add out1 = STACK_SCRATCH_AREA_SIZE, r12
     
    543542.align 32768
    544543ivt:
    545         HEAVYWEIGHT_HANDLER 0x0000
    546         HEAVYWEIGHT_HANDLER 0x0400
    547         HEAVYWEIGHT_HANDLER 0x0800
    548         HEAVYWEIGHT_HANDLER 0x0c00 alternate_instruction_tlb_fault
    549         HEAVYWEIGHT_HANDLER 0x1000 alternate_data_tlb_fault
    550         HEAVYWEIGHT_HANDLER 0x1400 data_nested_tlb_fault
    551         HEAVYWEIGHT_HANDLER 0x1800
    552         HEAVYWEIGHT_HANDLER 0x1c00
    553         HEAVYWEIGHT_HANDLER 0x2000 data_dirty_bit_fault
    554         HEAVYWEIGHT_HANDLER 0x2400 instruction_access_bit_fault
    555         HEAVYWEIGHT_HANDLER 0x2800 data_access_bit_fault
    556         HEAVYWEIGHT_HANDLER 0x2c00 break_instruction
    557         HEAVYWEIGHT_HANDLER 0x3000 external_interrupt   /* For external interrupt, heavyweight handler is used. */
    558         HEAVYWEIGHT_HANDLER 0x3400
    559         HEAVYWEIGHT_HANDLER 0x3800
    560         HEAVYWEIGHT_HANDLER 0x3c00
    561         HEAVYWEIGHT_HANDLER 0x4000
    562         HEAVYWEIGHT_HANDLER 0x4400
    563         HEAVYWEIGHT_HANDLER 0x4800
    564         HEAVYWEIGHT_HANDLER 0x4c00
    565 
    566         HEAVYWEIGHT_HANDLER 0x5000 page_not_present
    567         HEAVYWEIGHT_HANDLER 0x5100
    568         HEAVYWEIGHT_HANDLER 0x5200
    569         HEAVYWEIGHT_HANDLER 0x5300 data_access_rights_fault
    570         HEAVYWEIGHT_HANDLER 0x5400 general_exception
    571         HEAVYWEIGHT_HANDLER 0x5500 disabled_fp_register
    572         HEAVYWEIGHT_HANDLER 0x5600
    573         SPECULATION_VECTOR_HANDLER 0x5700
    574         HEAVYWEIGHT_HANDLER 0x5800
    575         HEAVYWEIGHT_HANDLER 0x5900
    576         HEAVYWEIGHT_HANDLER 0x5a00
    577         HEAVYWEIGHT_HANDLER 0x5b00
    578         HEAVYWEIGHT_HANDLER 0x5c00
    579         HEAVYWEIGHT_HANDLER 0x5d00
    580         HEAVYWEIGHT_HANDLER 0x5e00
    581         HEAVYWEIGHT_HANDLER 0x5f00
    582        
    583         HEAVYWEIGHT_HANDLER 0x6000
    584         HEAVYWEIGHT_HANDLER 0x6100
    585         HEAVYWEIGHT_HANDLER 0x6200
    586         HEAVYWEIGHT_HANDLER 0x6300
    587         HEAVYWEIGHT_HANDLER 0x6400
    588         HEAVYWEIGHT_HANDLER 0x6500
    589         HEAVYWEIGHT_HANDLER 0x6600
    590         HEAVYWEIGHT_HANDLER 0x6700
    591         HEAVYWEIGHT_HANDLER 0x6800
    592         HEAVYWEIGHT_HANDLER 0x6900
    593         HEAVYWEIGHT_HANDLER 0x6a00
    594         HEAVYWEIGHT_HANDLER 0x6b00
    595         HEAVYWEIGHT_HANDLER 0x6c00
    596         HEAVYWEIGHT_HANDLER 0x6d00
    597         HEAVYWEIGHT_HANDLER 0x6e00
    598         HEAVYWEIGHT_HANDLER 0x6f00
    599 
    600         HEAVYWEIGHT_HANDLER 0x7000
    601         HEAVYWEIGHT_HANDLER 0x7100
    602         HEAVYWEIGHT_HANDLER 0x7200
    603         HEAVYWEIGHT_HANDLER 0x7300
    604         HEAVYWEIGHT_HANDLER 0x7400
    605         HEAVYWEIGHT_HANDLER 0x7500
    606         HEAVYWEIGHT_HANDLER 0x7600
    607         HEAVYWEIGHT_HANDLER 0x7700
    608         HEAVYWEIGHT_HANDLER 0x7800
    609         HEAVYWEIGHT_HANDLER 0x7900
    610         HEAVYWEIGHT_HANDLER 0x7a00
    611         HEAVYWEIGHT_HANDLER 0x7b00
    612         HEAVYWEIGHT_HANDLER 0x7c00
    613         HEAVYWEIGHT_HANDLER 0x7d00
    614         HEAVYWEIGHT_HANDLER 0x7e00
    615         HEAVYWEIGHT_HANDLER 0x7f00
     544        HEAVYWEIGHT_HANDLER 0x00
     545        HEAVYWEIGHT_HANDLER 0x04
     546        HEAVYWEIGHT_HANDLER 0x08
     547        HEAVYWEIGHT_HANDLER 0x0c
     548        HEAVYWEIGHT_HANDLER 0x10
     549        HEAVYWEIGHT_HANDLER 0x14
     550        HEAVYWEIGHT_HANDLER 0x18
     551        HEAVYWEIGHT_HANDLER 0x1c
     552        HEAVYWEIGHT_HANDLER 0x20
     553        HEAVYWEIGHT_HANDLER 0x24
     554        HEAVYWEIGHT_HANDLER 0x28
     555        HEAVYWEIGHT_HANDLER 0x2c break_instruction
     556        HEAVYWEIGHT_HANDLER 0x30
     557        HEAVYWEIGHT_HANDLER 0x34
     558        HEAVYWEIGHT_HANDLER 0x38
     559        HEAVYWEIGHT_HANDLER 0x3c
     560        HEAVYWEIGHT_HANDLER 0x40
     561        HEAVYWEIGHT_HANDLER 0x44
     562        HEAVYWEIGHT_HANDLER 0x48
     563        HEAVYWEIGHT_HANDLER 0x4c
     564
     565        HEAVYWEIGHT_HANDLER 0x50
     566        HEAVYWEIGHT_HANDLER 0x51
     567        HEAVYWEIGHT_HANDLER 0x52
     568        HEAVYWEIGHT_HANDLER 0x53
     569        HEAVYWEIGHT_HANDLER 0x54
     570        HEAVYWEIGHT_HANDLER 0x55
     571        HEAVYWEIGHT_HANDLER 0x56
     572        SPECULATION_VECTOR_HANDLER 0x57
     573        HEAVYWEIGHT_HANDLER 0x58
     574        HEAVYWEIGHT_HANDLER 0x59
     575        HEAVYWEIGHT_HANDLER 0x5a
     576        HEAVYWEIGHT_HANDLER 0x5b
     577        HEAVYWEIGHT_HANDLER 0x5c
     578        HEAVYWEIGHT_HANDLER 0x5d
     579        HEAVYWEIGHT_HANDLER 0x5e
     580        HEAVYWEIGHT_HANDLER 0x5f
     581       
     582        HEAVYWEIGHT_HANDLER 0x60
     583        HEAVYWEIGHT_HANDLER 0x61
     584        HEAVYWEIGHT_HANDLER 0x62
     585        HEAVYWEIGHT_HANDLER 0x63
     586        HEAVYWEIGHT_HANDLER 0x64
     587        HEAVYWEIGHT_HANDLER 0x65
     588        HEAVYWEIGHT_HANDLER 0x66
     589        HEAVYWEIGHT_HANDLER 0x67
     590        HEAVYWEIGHT_HANDLER 0x68
     591        HEAVYWEIGHT_HANDLER 0x69
     592        HEAVYWEIGHT_HANDLER 0x6a
     593        HEAVYWEIGHT_HANDLER 0x6b
     594        HEAVYWEIGHT_HANDLER 0x6c
     595        HEAVYWEIGHT_HANDLER 0x6d
     596        HEAVYWEIGHT_HANDLER 0x6e
     597        HEAVYWEIGHT_HANDLER 0x6f
     598
     599        HEAVYWEIGHT_HANDLER 0x70
     600        HEAVYWEIGHT_HANDLER 0x71
     601        HEAVYWEIGHT_HANDLER 0x72
     602        HEAVYWEIGHT_HANDLER 0x73
     603        HEAVYWEIGHT_HANDLER 0x74
     604        HEAVYWEIGHT_HANDLER 0x75
     605        HEAVYWEIGHT_HANDLER 0x76
     606        HEAVYWEIGHT_HANDLER 0x77
     607        HEAVYWEIGHT_HANDLER 0x78
     608        HEAVYWEIGHT_HANDLER 0x79
     609        HEAVYWEIGHT_HANDLER 0x7a
     610        HEAVYWEIGHT_HANDLER 0x7b
     611        HEAVYWEIGHT_HANDLER 0x7c
     612        HEAVYWEIGHT_HANDLER 0x7d
     613        HEAVYWEIGHT_HANDLER 0x7e
     614        HEAVYWEIGHT_HANDLER 0x7f
  • kernel/arch/ia64/src/mm/tlb.c

    reae91e0 r235d31d  
    477477/** Instruction TLB fault handler for faults with VHPT turned off.
    478478 *
    479  * @param vector Interruption vector.
    480  * @param istate Structure with saved interruption state.
    481  *
    482  */
    483 void alternate_instruction_tlb_fault(uint64_t vector, istate_t *istate)
     479 * @param n Interruption vector.
     480 * @param istate Structure with saved interruption state.
     481 *
     482 */
     483void alternate_instruction_tlb_fault(unsigned int n, istate_t *istate)
    484484{
    485485        uintptr_t va;
     
    566566/** Data TLB fault handler for faults with VHPT turned off.
    567567 *
    568  * @param vector Interruption vector.
    569  * @param istate Structure with saved interruption state.
    570  *
    571  */
    572 void alternate_data_tlb_fault(uint64_t vector, istate_t *istate)
     568 * @param n Interruption vector.
     569 * @param istate Structure with saved interruption state.
     570 *
     571 */
     572void alternate_data_tlb_fault(unsigned int n, istate_t *istate)
    573573{
    574574        if (istate->cr_isr.sp) {
     
    623623 * This fault should not occur.
    624624 *
    625  * @param vector Interruption vector.
    626  * @param istate Structure with saved interruption state.
    627  *
    628  */
    629 void data_nested_tlb_fault(uint64_t vector, istate_t *istate)
     625 * @param n Interruption vector.
     626 * @param istate Structure with saved interruption state.
     627 *
     628 */
     629void data_nested_tlb_fault(unsigned int n, istate_t *istate)
    630630{
    631631        ASSERT(false);
     
    634634/** Data Dirty bit fault handler.
    635635 *
    636  * @param vector Interruption vector.
    637  * @param istate Structure with saved interruption state.
    638  *
    639  */
    640 void data_dirty_bit_fault(uint64_t vector, istate_t *istate)
     636 * @param n Interruption vector.
     637 * @param istate Structure with saved interruption state.
     638 *
     639 */
     640void data_dirty_bit_fault(unsigned int n, istate_t *istate)
    641641{
    642642        uintptr_t va;
     
    665665/** Instruction access bit fault handler.
    666666 *
    667  * @param vector Interruption vector.
    668  * @param istate Structure with saved interruption state.
    669  *
    670  */
    671 void instruction_access_bit_fault(uint64_t vector, istate_t *istate)
     667 * @param n Interruption vector.
     668 * @param istate Structure with saved interruption state.
     669 *
     670 */
     671void instruction_access_bit_fault(unsigned int n, istate_t *istate)
    672672{
    673673        uintptr_t va;
     
    694694/** Data access bit fault handler.
    695695 *
    696  * @param vector Interruption vector.
    697  * @param istate Structure with saved interruption state.
    698  *
    699  */
    700 void data_access_bit_fault(uint64_t vector, istate_t *istate)
     696 * @param n Interruption vector.
     697 * @param istate Structure with saved interruption state.
     698 *
     699 */
     700void data_access_bit_fault(unsigned int n, istate_t *istate)
    701701{
    702702        uintptr_t va;
     
    729729/** Data access rights fault handler.
    730730 *
    731  * @param vector Interruption vector.
    732  * @param istate Structure with saved interruption state.
    733  *
    734  */
    735 void data_access_rights_fault(uint64_t vector, istate_t *istate)
     731 * @param n Interruption vector.
     732 * @param istate Structure with saved interruption state.
     733 *
     734 */
     735void data_access_rights_fault(unsigned int n, istate_t *istate)
    736736{
    737737        uintptr_t va;
     
    753753/** Page not present fault handler.
    754754 *
    755  * @param vector Interruption vector.
    756  * @param istate Structure with saved interruption state.
    757  *
    758  */
    759 void page_not_present(uint64_t vector, istate_t *istate)
     755 * @param n Interruption vector.
     756 * @param istate Structure with saved interruption state.
     757 *
     758 */
     759void page_not_present(unsigned int n, istate_t *istate)
    760760{
    761761        uintptr_t va;
Note: See TracChangeset for help on using the changeset viewer.