Changeset 434f700 in mainline


Ignore:
Timestamp:
2005-04-26T16:17:41Z (20 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
babcb148
Parents:
dba84ff
Message:

Replace the deadlock-prone TLB shootdown algorithm with a deadlock-free implementation.
The implementation is a variant of the CMU TLB consistency algorithm.
Very inefficient implementation of a very inefficient (but correct) algorithm.

Files:
8 edited

Legend:

Unmodified
Added
Removed
  • arch/ia32/src/bios/bios.c

    rdba84ff r434f700  
    3434void bios_init(void)
    3535{
    36         /* Copy the EBDA out from BIOS Data Area */
     36        /* Copy the EBDA address out from BIOS Data Area */
    3737        ebda = *((__u16 *) BIOS_EBDA_PTR) * 0x10;
    3838}
  • arch/ia32/src/interrupt.c

    rdba84ff r434f700  
    9393{
    9494        printf("cpu%d: syscall\n", CPU->id);
    95         thread_usleep(1000000);
     95        thread_usleep(1000);
    9696}
    9797
  • arch/ia32/src/smp/apic.c

    rdba84ff r434f700  
    231231        l_apic[TPR] &= TPRClear;
    232232
    233 //      if (CPU->arch.family >= 6)
    234 //              enable_l_apic_in_msr();
     233        if (CPU->arch.family >= 6)
     234                enable_l_apic_in_msr();
    235235       
    236236        tmp = l_apic[ICRlo] & ICRloClear;
     
    257257       
    258258        l_apic[ICRT] = t1-t2;
     259       
    259260}
    260261
  • include/cpu.h

    rdba84ff r434f700  
    6161        int id;
    6262        int active;
     63        int tlb_active;
    6364
    6465        __u16 frequency_mhz;
  • src/Makefile.config

    rdba84ff r434f700  
    2323#TEST_DIR=synch/rwlock2/
    2424#TEST_DIR=synch/rwlock3/
    25 #TEST_DIR=synch/rwlock4/
    26 TEST_DIR=synch/rwlock5/
     25TEST_DIR=synch/rwlock4/
     26#TEST_DIR=synch/rwlock5/
    2727#TEST_DIR=synch/semaphore1/
    2828#TEST_DIR=synch/semaphore2/
  • src/cpu/cpu.c

    rdba84ff r434f700  
    8383       
    8484        CPU->active = 1;
     85        CPU->tlb_active = 1;
    8586       
    8687        cpu_identify();
  • src/mm/tlb.c

    rdba84ff r434f700  
    3434#include <arch/interrupt.h>
    3535#include <config.h>
     36#include <arch.h>
    3637
    3738#ifdef __SMP__
    3839static spinlock_t tlblock;
    39 static volatile int tlb_shootdown_cnt;
    4040
    4141void tlb_init(void)
    4242{
    4343        spinlock_initialize(&tlblock);
    44         tlb_shootdown_cnt = 0;
    4544}
    4645
     
    4847void tlb_shootdown_start(void)
    4948{
     49        int i;
     50
     51        CPU->tlb_active = 0;
    5052        spinlock_lock(&tlblock);
    5153        tlb_shootdown_ipi_send();
     54        tlb_invalidate(0); /* TODO: use valid ASID */
    5255       
    53         while (tlb_shootdown_cnt < config.cpu_active - 1)
    54                 ;
    55                
    56         tlb_shootdown_cnt = 0;
     56busy_wait:     
     57        for (i = 0; i<config.cpu_active; i++)
     58                if (cpus[i].tlb_active)
     59                        goto busy_wait;
    5760}
    5861
     
    6063{
    6164        spinlock_unlock(&tlblock);
     65        CPU->tlb_active = 1;
    6266}
    6367
     
    6973void tlb_shootdown_ipi_recv(void)
    7074{
    71         atomic_inc((int *) &tlb_shootdown_cnt);
     75        CPU->tlb_active = 0;
    7276        spinlock_lock(&tlblock);
    7377        spinlock_unlock(&tlblock);
    7478        tlb_invalidate(0);      /* TODO: use valid ASID */
     79        CPU->tlb_active = 1;
    7580}
    7681#endif /* __SMP__ */
  • src/mm/vm.c

    rdba84ff r434f700  
    180180        spinlock_unlock(&m->lock);
    181181
    182         tlb_invalidate(0);
    183182        tlb_shootdown_finalize();
    184183
Note: See TracChangeset for help on using the changeset viewer.