Ignore:
Timestamp:
2016-08-31T14:16:45Z (8 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/sparc64/src/mm/sun4v/tlb.c

    rdc05a9a r38dc82d  
    211211{
    212212        uintptr_t va = ALIGN_DOWN(istate->tpc, PAGE_SIZE);
    213         pte_t *t;
    214 
    215         t = page_mapping_find(AS, va, true);
    216 
    217         if (t && PTE_EXECUTABLE(t)) {
     213        pte_t t;
     214
     215        bool found = page_mapping_find(AS, va, true, &t);
     216        if (found && PTE_EXECUTABLE(&t)) {
    218217                /*
    219218                 * The mapping was found in the software page hash table.
    220219                 * Insert it into ITLB.
    221220                 */
    222                 t->a = true;
    223                 itlb_pte_copy(t);
     221                t.a = true;
     222                itlb_pte_copy(&t);
    224223#ifdef CONFIG_TSB
    225                 itsb_pte_copy(t);
     224                itsb_pte_copy(&t);
    226225#endif
    227226        } else {
     
    244243void fast_data_access_mmu_miss(unsigned int tt, istate_t *istate)
    245244{
    246         pte_t *t;
     245        pte_t t;
    247246        uintptr_t va = DMISS_ADDRESS(istate->tlb_tag_access);
    248247        uint16_t ctx = DMISS_CONTEXT(istate->tlb_tag_access);
     
    261260        }
    262261
    263         t = page_mapping_find(as, va, true);
    264         if (t) {
     262        bool found = page_mapping_find(as, va, true, &t);
     263        if (found) {
    265264                /*
    266265                 * The mapping was found in the software page hash table.
    267266                 * Insert it into DTLB.
    268267                 */
    269                 t->a = true;
    270                 dtlb_pte_copy(t, true);
     268                t.a = true;
     269                dtlb_pte_copy(&t, true);
    271270#ifdef CONFIG_TSB
    272                 dtsb_pte_copy(t, true);
     271                dtsb_pte_copy(&t, true);
    273272#endif
    274273        } else {
     
    288287void fast_data_access_protection(unsigned int tt, istate_t *istate)
    289288{
    290         pte_t *t;
     289        pte_t t;
    291290        uintptr_t va = DMISS_ADDRESS(istate->tlb_tag_access);
    292291        uint16_t ctx = DMISS_CONTEXT(istate->tlb_tag_access);
     
    296295                as = AS_KERNEL;
    297296
    298         t = page_mapping_find(as, va, true);
    299         if (t && PTE_WRITABLE(t)) {
     297        bool found = page_mapping_find(as, va, true, &t);
     298        if (found && PTE_WRITABLE(&t)) {
    300299                /*
    301300                 * The mapping was found in the software page hash table and is
     
    303302                 * into DTLB.
    304303                 */
    305                 t->a = true;
    306                 t->d = true;
     304                t.a = true;
     305                t.d = true;
    307306                mmu_demap_page(va, ctx, MMU_FLAG_DTLB);
    308                 dtlb_pte_copy(t, false);
     307                dtlb_pte_copy(&t, false);
    309308#ifdef CONFIG_TSB
    310                 dtsb_pte_copy(t, false);
     309                dtsb_pte_copy(&t, false);
    311310#endif
    312311        } else {
Note: See TracChangeset for help on using the changeset viewer.