Changeset 38dc82d in mainline for kernel/arch/mips32/src/mm/tlb.c


Ignore:
Timestamp:
2016-08-31T14:16:45Z (9 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
346b12a2
Parents:
dc05a9a
Message:

Make page_mapping_find() return a copy rather than the actual PTE

This makes page_mapping_find() more suitable for use with lock-free data
structures such as CHT that guarantee existence of the data only for
some limited time while a condition holds (e.g. inside of a RCU-protected
critical section that must be around all CHT lookups).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/mips32/src/mm/tlb.c

    rdc05a9a r38dc82d  
    9797        entry_lo_t lo;
    9898        uintptr_t badvaddr;
    99         pte_t *pte;
     99        pte_t pte;
    100100       
    101101        badvaddr = cp0_badvaddr_read();
    102102
    103         pte = page_mapping_find(AS, badvaddr, true);
    104         if (pte && pte->p) {
     103        bool found = page_mapping_find(AS, badvaddr, true, &pte);
     104        if (found && pte.p) {
    105105                /*
    106106                 * Record access to PTE.
    107107                 */
    108                 pte->a = 1;
    109 
    110                 tlb_prepare_entry_lo(&lo, pte->g, pte->p, pte->d,
    111                     pte->cacheable, pte->pfn);
     108                pte.a = 1;
     109
     110                tlb_prepare_entry_lo(&lo, pte.g, pte.p, pte.d,
     111                    pte.cacheable, pte.pfn);
    112112
    113113                /*
     
    138138        tlb_index_t index;
    139139        uintptr_t badvaddr;
    140         pte_t *pte;
     140        pte_t pte;
    141141
    142142        /*
     
    162162        badvaddr = cp0_badvaddr_read();
    163163
    164         pte = page_mapping_find(AS, badvaddr, true);
    165         if (pte && pte->p) {
     164        bool found = page_mapping_find(AS, badvaddr, true, &pte);
     165        if (found && pte.p) {
    166166                /*
    167167                 * Read the faulting TLB entry.
     
    172172                 * Record access to PTE.
    173173                 */
    174                 pte->a = 1;
    175 
    176                 tlb_prepare_entry_lo(&lo, pte->g, pte->p, pte->d,
    177                     pte->cacheable, pte->pfn);
     174                pte.a = 1;
     175
     176                tlb_prepare_entry_lo(&lo, pte.g, pte.p, pte.d,
     177                    pte.cacheable, pte.pfn);
    178178
    179179                /*
     
    200200        tlb_index_t index;
    201201        uintptr_t badvaddr;
    202         pte_t *pte;
     202        pte_t pte;
    203203
    204204        badvaddr = cp0_badvaddr_read();
     
    224224        }
    225225
    226         pte = page_mapping_find(AS, badvaddr, true);
    227         if (pte && pte->p && pte->w) {
     226        bool found = page_mapping_find(AS, badvaddr, true, &pte);
     227        if (found && pte.p && pte.w) {
    228228                /*
    229229                 * Read the faulting TLB entry.
     
    234234                 * Record access and write to PTE.
    235235                 */
    236                 pte->a = 1;
    237                 pte->d = 1;
    238 
    239                 tlb_prepare_entry_lo(&lo, pte->g, pte->p, pte->w,
    240                     pte->cacheable, pte->pfn);
     236                pte.a = 1;
     237                pte.d = 1;
     238
     239                tlb_prepare_entry_lo(&lo, pte.g, pte.p, pte.w,
     240                    pte.cacheable, pte.pfn);
    241241
    242242                /*
Note: See TracChangeset for help on using the changeset viewer.