debuggers.hg

changeset 4588:eb5407610fab

bitkeeper revision 1.1310 (4263d01alGeX35dYhvzi6Uo_ZNlWkQ)

Fix bug with get_page_type where validating an L2/L3/L4 page which contained a self
reference would cause xen to busy-wait forever.

Signed-off-by: michael.fetterman@cl.cam.ac.uk
author maf46@burn.cl.cam.ac.uk
date Mon Apr 18 15:19:54 2005 +0000 (2005-04-18)
parents d3c7465e457a
children 5a8c28c62a4d
files xen/arch/x86/mm.c
line diff
     1.1 --- a/xen/arch/x86/mm.c	Fri Apr 15 23:47:54 2005 +0000
     1.2 +++ b/xen/arch/x86/mm.c	Mon Apr 18 15:19:54 2005 +0000
     1.3 @@ -1229,35 +1229,38 @@ int get_page_type(struct pfn_info *page,
     1.4                      nx |= PGT_validated;
     1.5              }
     1.6          }
     1.7 -        else if ( unlikely(!(x & PGT_validated)) )
     1.8 +        else
     1.9          {
    1.10 -            /* Someone else is updating validation of this page. Wait... */
    1.11 -            while ( (y = page->u.inuse.type_info) == x )
    1.12 -                cpu_relax();
    1.13 -            goto again;
    1.14 -        }
    1.15 -        else if ( unlikely((x & (PGT_type_mask|PGT_va_mask)) != type) )
    1.16 -        {
    1.17 -            if ( unlikely((x & PGT_type_mask) != (type & PGT_type_mask) ) )
    1.18 +            if ( unlikely((x & (PGT_type_mask|PGT_va_mask)) != type) )
    1.19              {
    1.20 -                if ( ((x & PGT_type_mask) != PGT_l2_page_table) ||
    1.21 -                     ((type & PGT_type_mask) != PGT_l1_page_table) )
    1.22 -                    MEM_LOG("Bad type (saw %08x != exp %08x) for pfn %p",
    1.23 -                            x, type, page_to_pfn(page));
    1.24 -                return 0;
    1.25 +                if ( unlikely((x & PGT_type_mask) != (type & PGT_type_mask) ) )
    1.26 +                {
    1.27 +                    if ( ((x & PGT_type_mask) != PGT_l2_page_table) ||
    1.28 +                         ((type & PGT_type_mask) != PGT_l1_page_table) )
    1.29 +                        MEM_LOG("Bad type (saw %08x != exp %08x) for pfn %p",
    1.30 +                                x, type, page_to_pfn(page));
    1.31 +                    return 0;
    1.32 +                }
    1.33 +                else if ( (x & PGT_va_mask) == PGT_va_mutable )
    1.34 +                {
    1.35 +                    /* The va backpointer is mutable, hence we update it. */
    1.36 +                    nx &= ~PGT_va_mask;
    1.37 +                    nx |= type; /* we know the actual type is correct */
    1.38 +                }
    1.39 +                else if ( ((type & PGT_va_mask) != PGT_va_mutable) &&
    1.40 +                          ((type & PGT_va_mask) != (x & PGT_va_mask)) )
    1.41 +                {
    1.42 +                    /* This table is potentially mapped at multiple locations. */
    1.43 +                    nx &= ~PGT_va_mask;
    1.44 +                    nx |= PGT_va_unknown;
    1.45 +                }
    1.46              }
    1.47 -            else if ( (x & PGT_va_mask) == PGT_va_mutable )
    1.48 +            if ( unlikely(!(x & PGT_validated)) )
    1.49              {
    1.50 -                /* The va backpointer is mutable, hence we update it. */
    1.51 -                nx &= ~PGT_va_mask;
    1.52 -                nx |= type; /* we know the actual type is correct */
    1.53 -            }
    1.54 -            else if ( ((type & PGT_va_mask) != PGT_va_mutable) &&
    1.55 -                      ((type & PGT_va_mask) != (x & PGT_va_mask)) )
    1.56 -            {
    1.57 -                /* This table is potentially mapped at multiple locations. */
    1.58 -                nx &= ~PGT_va_mask;
    1.59 -                nx |= PGT_va_unknown;
    1.60 +                /* Someone else is updating validation of this page. Wait... */
    1.61 +                while ( (y = page->u.inuse.type_info) == x )
    1.62 +                    cpu_relax();
    1.63 +                goto again;
    1.64              }
    1.65          }
    1.66      }