ia64/xen-unstable

changeset 2557:62b8e960db56

bitkeeper revision 1.1159.93.1 (41556622dHm-ebfFQ37g3zM37ASpCw)

extra debug
author iap10@labyrinth.cl.cam.ac.uk
date Sat Sep 25 12:35:46 2004 +0000 (2004-09-25)
parents 1fc8bdfed466
children 0516d2b22caf
files xen/arch/x86/memory.c xen/arch/x86/shadow.c xen/include/asm-x86/shadow.h
line diff
     1.1 --- a/xen/arch/x86/memory.c	Fri Sep 24 17:46:24 2004 +0000
     1.2 +++ b/xen/arch/x86/memory.c	Sat Sep 25 12:35:46 2004 +0000
     1.3 @@ -1864,7 +1864,7 @@ void ptwr_status(void)
     1.4  
     1.5  void audit_domain( struct domain *d)
     1.6  {
     1.7 -    int ttot=0, ctot=0;
     1.8 +    int ttot=0, ctot=0, io_mappings=0, lowmem_mappings=0;
     1.9      void adjust ( struct pfn_info *page, int dir, int adjtype )
    1.10      {
    1.11          int count = page->count_info & PGC_count_mask;
    1.12 @@ -2059,7 +2059,7 @@ void audit_domain( struct domain *d)
    1.13  
    1.14                      if ( l1page->u.inuse.domain != d )
    1.15                      {
    1.16 -                        printk("Skip page belowing to other dom %p\n",
    1.17 +                        printk("L2: Skip bizare page belowing to other dom %p\n",
    1.18                                 l1page->u.inuse.domain);    
    1.19                          continue;
    1.20                      }
    1.21 @@ -2128,6 +2128,18 @@ void audit_domain( struct domain *d)
    1.22                      unsigned long l1pfn = pt[i]>>PAGE_SHIFT;
    1.23                      struct pfn_info *l1page = &frame_table[l1pfn];
    1.24  
    1.25 +		    if ( l1pfn < 0x100 )
    1.26 +		    {
    1.27 +			lowmem_mappings++;
    1.28 +			continue;
    1.29 +		    }
    1.30 +
    1.31 +		    if ( l1pfn > max_page )
    1.32 +		    {
    1.33 +			io_mappings++;
    1.34 +			continue;
    1.35 +		    }
    1.36 +
    1.37                      if ( pt[i] & _PAGE_RW )
    1.38                      {
    1.39  
    1.40 @@ -2144,8 +2156,13 @@ void audit_domain( struct domain *d)
    1.41  
    1.42                      if ( l1page->u.inuse.domain != d )
    1.43                      {
    1.44 -                        printk("Skip page belowing to other dom %p\n",
    1.45 -                               l1page->u.inuse.domain);    
    1.46 +                        printk("Audit %d: [%lx,%x] Skip foreign page dom=%lx pfn=%lx c=%08x t=%08x m2p=%lx\n",
    1.47 +			       d->domain, pfn, i,
    1.48 +                               (unsigned long)l1page->u.inuse.domain,
    1.49 +			       l1pfn,
    1.50 +			       l1page->count_info,
    1.51 +			       l1page->u.inuse.type_info,
    1.52 +			       machine_to_phys_mapping[l1pfn]);    
    1.53                          continue;
    1.54                      }
    1.55  
    1.56 @@ -2156,13 +2173,15 @@ void audit_domain( struct domain *d)
    1.57              unmap_domain_mem(pt);
    1.58  
    1.59              break;
    1.60 -        }
    1.61 -        
    1.62 -
    1.63 +        }       
    1.64  
    1.65          list_ent = frame_table[pfn].list.next;
    1.66      }
    1.67  
    1.68 +    if ( io_mappings>0 || lowmem_mappings>0 )
    1.69 +	printk("Audit %d: Found %d lowmem mappings and %d io mappings\n",
    1.70 +	       d->domain, lowmem_mappings, io_mappings);
    1.71 +
    1.72      /* phase 2 */
    1.73  
    1.74      ctot = ttot = 0;
    1.75 @@ -2252,8 +2271,11 @@ void audit_domain( struct domain *d)
    1.76                      unsigned long l1pfn = pt[i]>>PAGE_SHIFT;
    1.77                      struct pfn_info *l1page = &frame_table[l1pfn];
    1.78  
    1.79 -                    if ( l1page->u.inuse.domain == d)
    1.80 -                        adjust( l1page, 1, 0 );
    1.81 +                    if ( l1page->u.inuse.domain != d) continue;
    1.82 +		    if ( l1pfn < 0x100 ) continue;
    1.83 +		    if ( l1pfn > max_page ) continue;
    1.84 +
    1.85 +		    adjust( l1page, 1, 0 );
    1.86  #endif
    1.87                  }
    1.88              }
    1.89 @@ -2286,8 +2308,7 @@ void audit_domains(void)
    1.90  
    1.91      for_each_domain ( d )
    1.92      {
    1.93 -        if ( d->domain > 0 )
    1.94 -            audit_domain(d);
    1.95 +	audit_domain(d);
    1.96      }
    1.97  }
    1.98  
     2.1 --- a/xen/arch/x86/shadow.c	Fri Sep 24 17:46:24 2004 +0000
     2.2 +++ b/xen/arch/x86/shadow.c	Sat Sep 25 12:35:46 2004 +0000
     2.3 @@ -385,9 +385,12 @@ static int shadow_mode_table_op(struct d
     2.4  					0, bytes);
     2.5  		}
     2.6  
     2.7 +#if 0   /* This optimisation is dangerous for some uses of this function.
     2.8 +		 disable for the moment */
     2.9          /* Might as well stop the domain as an optimization. */
    2.10  		if ( zero )
    2.11              domain_pause_by_systemcontroller(d);
    2.12 +#endif
    2.13  
    2.14  		break;
    2.15      }
    2.16 @@ -487,8 +490,21 @@ int shadow_mode_control(struct domain *d
    2.17  
    2.18  static inline struct pfn_info *alloc_shadow_page(struct mm_struct *m)
    2.19  {
    2.20 +	struct pfn_info *page;
    2.21      m->shadow_page_count++;
    2.22 -    return alloc_domheap_page(NULL);
    2.23 +    page = alloc_domheap_page(NULL);
    2.24 +
    2.25 +	if( unlikely(page == NULL) )
    2.26 +	{
    2.27 +		printk("Couldn't alloc shadow page! count=%d\n",
    2.28 +			   m->shadow_page_count);
    2.29 +		SH_VLOG("Shadow tables l1=%d l2=%d",
    2.30 +				perfc_value(shadow_l1_pages), 
    2.31 +				perfc_value(shadow_l2_pages));
    2.32 +		BUG();  // FIXME: try a shadow flush to free up some memory
    2.33 +	}
    2.34 +
    2.35 +	return page;
    2.36  }
    2.37  
    2.38  void unshadow_table( unsigned long gpfn, unsigned int type )
     3.1 --- a/xen/include/asm-x86/shadow.h	Fri Sep 24 17:46:24 2004 +0000
     3.2 +++ b/xen/include/asm-x86/shadow.h	Sat Sep 25 12:35:46 2004 +0000
     3.3 @@ -118,17 +118,20 @@ static inline int __mark_dirty( struct m
     3.4      }
     3.5      else
     3.6      {
     3.7 -        SH_LOG("mark_dirty OOR! mfn=%x pfn=%x max=%x (mm %p)",
     3.8 -               mfn, pfn, m->shadow_dirty_bitmap_size, m );
     3.9 -        SH_LOG("dom=%p caf=%08x taf=%08x\n", 
    3.10 -               frame_table[mfn].u.inuse.domain,
    3.11 -               frame_table[mfn].count_info, 
    3.12 -               frame_table[mfn].u.inuse.type_info );
    3.13 +		if ( mfn < max_page )
    3.14  		{
    3.15 -			extern void show_trace(unsigned long *esp);		
    3.16 -			unsigned long *esp;
    3.17 -			__asm__ __volatile__ ("movl %%esp,%0" : "=r" (esp) : );
    3.18 -			show_trace(esp);
    3.19 +			SH_LOG("mark_dirty OOR! mfn=%x pfn=%x max=%x (mm %p)",
    3.20 +				   mfn, pfn, m->shadow_dirty_bitmap_size, m );
    3.21 +			SH_LOG("dom=%p caf=%08x taf=%08x\n", 
    3.22 +				   frame_table[mfn].u.inuse.domain,
    3.23 +				   frame_table[mfn].count_info, 
    3.24 +				   frame_table[mfn].u.inuse.type_info );
    3.25 +			{
    3.26 +				extern void show_trace(unsigned long *esp);		
    3.27 +				unsigned long *esp;
    3.28 +				__asm__ __volatile__ ("movl %%esp,%0" : "=r" (esp) : );
    3.29 +				show_trace(esp);
    3.30 +			}
    3.31  		}
    3.32      }
    3.33