Changeset 7c98874 in mainline


Ignore:
Timestamp:
2009-01-31T12:37:31Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
896ad9f
Parents:
ee79df74
Message:

use secondary hash for kernel identity mapping to avoid livelocks on colliding PHT addresses

File:
1 edited

Legend:

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

    ree79df74 r7c98874  
    152152        bool found = false;
    153153       
    154         /* Find unused or colliding
    155            PTE in PTEG */
     154        /* Find unused or colliding PTE in PTEG */
    156155        for (i = 0; i < 8; i++) {
    157                 if ((!phte[base + i].v) || ((phte[base + i].vsid == vsid) &&
    158                     (phte[base + i].api == api))) {
     156                if ((!phte[base + i].v) ||
     157                    ((phte[base + i].vsid == vsid)
     158                    && (phte[base + i].api == api)
     159                    && (phte[base + i].h == 0))) {
    159160                        found = true;
    160161                        break;
     
    166167                uint32_t base2 = (~hash & 0x3ff) << 3;
    167168               
    168                 /* Find unused or colliding
    169                    PTE in PTEG */
     169                /* Find unused or colliding PTE in PTEG */
    170170                for (i = 0; i < 8; i++) {
    171171                        if ((!phte[base2 + i].v) ||
    172                             ((phte[base2 + i].vsid == vsid) &&
    173                             (phte[base2 + i].api == api))) {
     172                            ((phte[base2 + i].vsid == vsid)
     173                            && (phte[base2 + i].api == api)
     174                            && (phte[base2 + i].h == 1))) {
    174175                                found = true;
    175176                                base = base2;
     
    179180                }
    180181               
    181                 if (!found) {
    182                         // TODO: A/C precedence groups
     182                if (!found)
    183183                        i = page % 8;
    184                 }
    185         }
     184        }
     185       
     186       
    186187       
    187188        phte[base + i].v = 1;
     
    223224        bool found = false;
    224225       
    225         /* Find unused or colliding
    226            PTE in PTEG */
     226        /* Find unused or colliding PTE in PTEG */
    227227        for (i = 0; i < 8; i++) {
    228228                if ((!phte_physical[base + i].v) ||
    229                     ((phte_physical[base + i].vsid == vsid) &&
    230                     (phte_physical[base + i].api == api))) {
     229                    ((phte_physical[base + i].vsid == vsid)
     230                    && (phte_physical[base + i].api == api)
     231                    && (phte_physical[base + i].h == 0))) {
    231232                        found = true;
    232233                        break;
     
    238239                uint32_t base2 = (~hash & 0x3ff) << 3;
    239240               
    240                 /* Find unused or colliding
    241                    PTE in PTEG */
     241                /* Find unused or colliding PTE in PTEG */
    242242                for (i = 0; i < 8; i++) {
    243243                        if ((!phte_physical[base2 + i].v) ||
    244                             ((phte_physical[base2 + i].vsid == vsid) &&
    245                             (phte_physical[base2 + i].api == api))) {
     244                            ((phte_physical[base2 + i].vsid == vsid)
     245                            && (phte_physical[base2 + i].api == api)
     246                            && (phte_physical[base2 + i].h == 1))) {
    246247                                found = true;
    247248                                base = base2;
     
    252253               
    253254                if (!found) {
    254                         // TODO: A/C precedence groups
    255255                        i = page % 8;
     256                        base = base2;
     257                        h = 1;
    256258                }
    257259        }
Note: See TracChangeset for help on using the changeset viewer.