ia64/xen-unstable

changeset 4829:6d36a84988c8

bitkeeper revision 1.1389.1.39 (4280b9edgpXcv7Ln0ytJwS4QaBJdSg)

Merge firebug.cl.cam.ac.uk:/auto/groups/xeno-xenod/BK/xen-unstable.bk
into firebug.cl.cam.ac.uk:/local/scratch/cl349/xen-unstable.bk
author cl349@firebug.cl.cam.ac.uk[cl349]
date Tue May 10 13:41:01 2005 +0000 (2005-05-10)
parents 036c7e34fdd8 4f1ddb677017
children 2dadbd7de2c0 4abe6df100e3
files linux-2.6.11-xen-sparse/arch/xen/i386/kernel/smpboot.c linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/mach-xen/smpboot_hooks.h linux-2.6.11-xen-sparse/include/asm-xen/asm-x86_64/mach-xen/smpboot_hooks.h xen/Rules.mk xen/arch/x86/acpi/boot.c xen/arch/x86/mm.c xen/arch/x86/shadow.c xen/common/perfc.c xen/include/asm-x86/shadow.h xen/include/xen/perfc.h
line diff
     1.1 --- a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/smpboot.c	Tue May 10 12:29:18 2005 +0000
     1.2 +++ b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/smpboot.c	Tue May 10 13:41:01 2005 +0000
     1.3 @@ -54,11 +54,6 @@
     1.4  #include <asm/desc.h>
     1.5  #include <asm/arch_hooks.h>
     1.6  
     1.7 -#if 1
     1.8 -#define Dprintk(args...)
     1.9 -#else
    1.10 -#include <mach_apic.h>
    1.11 -#endif
    1.12  #include <mach_wakecpu.h>
    1.13  #include <smpboot_hooks.h>
    1.14  
    1.15 @@ -472,7 +467,7 @@ extern void local_setup_timer(void);
    1.16  /*
    1.17   * Activate a secondary processor.
    1.18   */
    1.19 -static int __init start_secondary(void *unused)
    1.20 +static void __init start_secondary(void *unused)
    1.21  {
    1.22  	/*
    1.23  	 * Dont put anything before smp_callin(), SMP
    1.24 @@ -1278,9 +1273,11 @@ static void __init smp_boot_cpus(unsigne
    1.25  #if 0
    1.26  	if (nmi_watchdog == NMI_LOCAL_APIC)
    1.27  		check_nmi_watchdog();
    1.28 +#endif
    1.29  
    1.30  	smpboot_setup_io_apic();
    1.31  
    1.32 +#if 0
    1.33  	setup_boot_APIC_clock();
    1.34  
    1.35  	/*
     2.1 --- a/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/mach-xen/smpboot_hooks.h	Tue May 10 12:29:18 2005 +0000
     2.2 +++ b/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/mach-xen/smpboot_hooks.h	Tue May 10 13:41:01 2005 +0000
     2.3 @@ -43,16 +43,12 @@ static inline void smpboot_restore_warm_
     2.4  
     2.5  static inline void smpboot_setup_io_apic(void)
     2.6  {
     2.7 -#if 1
     2.8 -	printk("smpboot_setup_io_apic\n");
     2.9 -#else
    2.10  	/*
    2.11  	 * Here we can be sure that there is an IO-APIC in the system. Let's
    2.12  	 * go and set it up:
    2.13  	 */
    2.14  	if (!skip_ioapic_setup && nr_ioapics)
    2.15  		setup_IO_APIC();
    2.16 -#endif
    2.17  }
    2.18  
    2.19  
     3.1 --- a/linux-2.6.11-xen-sparse/include/asm-xen/asm-x86_64/mach-xen/smpboot_hooks.h	Tue May 10 12:29:18 2005 +0000
     3.2 +++ b/linux-2.6.11-xen-sparse/include/asm-xen/asm-x86_64/mach-xen/smpboot_hooks.h	Tue May 10 13:41:01 2005 +0000
     3.3 @@ -43,16 +43,12 @@ static inline void smpboot_restore_warm_
     3.4  
     3.5  static inline void smpboot_setup_io_apic(void)
     3.6  {
     3.7 -#if 1
     3.8 -	printk("smpboot_setup_io_apic\n");
     3.9 -#else
    3.10  	/*
    3.11  	 * Here we can be sure that there is an IO-APIC in the system. Let's
    3.12  	 * go and set it up:
    3.13  	 */
    3.14  	if (!skip_ioapic_setup && nr_ioapics)
    3.15  		setup_IO_APIC();
    3.16 -#endif
    3.17  }
    3.18  
    3.19  
     4.1 --- a/xen/Rules.mk	Tue May 10 12:29:18 2005 +0000
     4.2 +++ b/xen/Rules.mk	Tue May 10 13:41:01 2005 +0000
     4.3 @@ -2,6 +2,7 @@
     4.4  verbose     ?= n
     4.5  debug       ?= n
     4.6  perfc       ?= n
     4.7 +perfc_arrays?= n
     4.8  trace       ?= n
     4.9  optimize    ?= y
    4.10  domu_debug  ?= n
    4.11 @@ -54,6 +55,9 @@ endif
    4.12  
    4.13  ifeq ($(perfc),y)
    4.14  CFLAGS += -DPERF_COUNTERS
    4.15 +ifeq ($(perfc_arrays),y)
    4.16 +CFLAGS += -DPERF_ARRAYS
    4.17 +endif
    4.18  endif
    4.19  
    4.20  ifeq ($(trace),y)
     5.1 --- a/xen/arch/x86/acpi/boot.c	Tue May 10 12:29:18 2005 +0000
     5.2 +++ b/xen/arch/x86/acpi/boot.c	Tue May 10 13:41:01 2005 +0000
     5.3 @@ -647,7 +647,7 @@ acpi_find_rsdp (void)
     5.4  	 */
     5.5  	rsdp_phys = acpi_scan_rsdp (0, 0x400);
     5.6  	if (!rsdp_phys)
     5.7 -		rsdp_phys = acpi_scan_rsdp (0xE0000, 0xFFFFF);
     5.8 +		rsdp_phys = acpi_scan_rsdp (0xE0000, 0x20000);
     5.9  
    5.10  	return rsdp_phys;
    5.11  }
     6.1 --- a/xen/arch/x86/mm.c	Tue May 10 12:29:18 2005 +0000
     6.2 +++ b/xen/arch/x86/mm.c	Tue May 10 13:41:01 2005 +0000
     6.3 @@ -1992,7 +1992,7 @@ int do_mmu_update(
     6.4                  printk("privileged guest dom%d requests pfn=%lx to map mfn=%lx for dom%d\n",
     6.5                         d->id, gpfn, mfn, FOREIGNDOM->id);
     6.6                  set_machinetophys(mfn, gpfn);
     6.7 -                set_p2m_entry(FOREIGNDOM, gpfn, mfn, NULL, NULL);
     6.8 +                set_p2m_entry(FOREIGNDOM, gpfn, mfn, &sh_mapcache, &mapcache);
     6.9                  okay = 1;
    6.10                  shadow_unlock(FOREIGNDOM);
    6.11                  break;
     7.1 --- a/xen/arch/x86/shadow.c	Tue May 10 12:29:18 2005 +0000
     7.2 +++ b/xen/arch/x86/shadow.c	Tue May 10 13:41:01 2005 +0000
     7.3 @@ -1901,37 +1901,34 @@ void shadow_mark_va_out_of_sync(
     7.4   * Returns 0 otherwise.
     7.5   */
     7.6  static int snapshot_entry_matches(
     7.7 -    struct exec_domain *ed, unsigned long gmfn, unsigned index)
     7.8 +    struct domain *d, l1_pgentry_t *guest_pt,
     7.9 +    unsigned long gpfn, unsigned index)
    7.10  {
    7.11 -    unsigned long gpfn = __mfn_to_gpfn(ed->domain, gmfn);
    7.12 -    unsigned long smfn = __shadow_status(ed->domain, gpfn, PGT_snapshot);
    7.13 -    unsigned long *guest, *snapshot;
    7.14 -    int compare;
    7.15 -
    7.16 -    ASSERT( ! IS_INVALID_M2P_ENTRY(gpfn) );
    7.17 +    unsigned long smfn = __shadow_status(d, gpfn, PGT_snapshot);
    7.18 +    l1_pgentry_t *snapshot; // could be L1s or L2s or ...
    7.19 +    int entries_match;
    7.20  
    7.21      perfc_incrc(snapshot_entry_matches_calls);
    7.22  
    7.23      if ( !smfn )
    7.24          return 0;
    7.25  
    7.26 -    guest    = map_domain_mem(gmfn << PAGE_SHIFT);
    7.27      snapshot = map_domain_mem(smfn << PAGE_SHIFT);
    7.28  
    7.29      // This could probably be smarter, but this is sufficent for
    7.30      // our current needs.
    7.31      //
    7.32 -    compare = (guest[index] == snapshot[index]);
    7.33 -
    7.34 -    unmap_domain_mem(guest);
    7.35 +    entries_match = !l1e_has_changed(&guest_pt[index], &snapshot[index],
    7.36 +                                     PAGE_FLAG_MASK);
    7.37 +
    7.38      unmap_domain_mem(snapshot);
    7.39  
    7.40  #ifdef PERF_COUNTERS
    7.41 -    if ( compare )
    7.42 +    if ( entries_match )
    7.43          perfc_incrc(snapshot_entry_matches_true);
    7.44  #endif
    7.45  
    7.46 -    return compare;
    7.47 +    return entries_match;
    7.48  }
    7.49  
    7.50  /*
    7.51 @@ -1942,37 +1939,35 @@ int __shadow_out_of_sync(struct exec_dom
    7.52  {
    7.53      struct domain *d = ed->domain;
    7.54      unsigned long l2mfn = pagetable_get_pfn(ed->arch.guest_table);
    7.55 +    unsigned long l2pfn = __mfn_to_gpfn(d, l2mfn);
    7.56      l2_pgentry_t l2e;
    7.57 -    unsigned long l1mfn;
    7.58 +    unsigned long l1pfn, l1mfn;
    7.59  
    7.60      ASSERT(spin_is_locked(&d->arch.shadow_lock));
    7.61 +    ASSERT(VALID_M2P(l2pfn));
    7.62  
    7.63      perfc_incrc(shadow_out_of_sync_calls);
    7.64  
    7.65 -    // PERF BUG: snapshot_entry_matches will call map_domain_mem() on the l2
    7.66 -    // page, but it's already available at ed->arch.guest_vtable...
    7.67 -    // Ditto for the sl2 page and ed->arch.shadow_vtable.
    7.68 -    //
    7.69      if ( page_out_of_sync(&frame_table[l2mfn]) &&
    7.70 -         !snapshot_entry_matches(ed, l2mfn, l2_table_offset(va)) )
    7.71 +         !snapshot_entry_matches(d, (l1_pgentry_t *)ed->arch.guest_vtable,
    7.72 +                                 l2pfn, l2_table_offset(va)) )
    7.73          return 1;
    7.74  
    7.75      __guest_get_l2e(ed, va, &l2e);
    7.76      if ( !(l2e_get_flags(l2e) & _PAGE_PRESENT) )
    7.77          return 0;
    7.78  
    7.79 -    l1mfn = __gpfn_to_mfn(d, l2e_get_pfn(l2e));
    7.80 +    l1pfn = l2e_get_pfn(l2e);
    7.81 +    l1mfn = __gpfn_to_mfn(d, l1pfn);
    7.82  
    7.83      // If the l1 pfn is invalid, it can't be out of sync...
    7.84      if ( !VALID_MFN(l1mfn) )
    7.85          return 0;
    7.86  
    7.87 -    // PERF BUG: snapshot_entry_matches will call map_domain_mem() on the l1
    7.88 -    // page, but it's already available at linear_pg_table[l1_linear_offset()].
    7.89 -    // Ditto for the sl1 page and shadow_linear_pg_table[]...
    7.90 -    //
    7.91      if ( page_out_of_sync(&frame_table[l1mfn]) &&
    7.92 -         !snapshot_entry_matches(ed, l1mfn, l1_table_offset(va)) )
    7.93 +         !snapshot_entry_matches(
    7.94 +             d, &linear_pg_table[l1_linear_offset(va) & ~(L1_PAGETABLE_ENTRIES-1)],
    7.95 +             l1pfn, l1_table_offset(va)) )
    7.96          return 1;
    7.97  
    7.98      return 0;
     8.1 --- a/xen/common/perfc.c	Tue May 10 12:29:18 2005 +0000
     8.2 +++ b/xen/common/perfc.c	Tue May 10 13:41:01 2005 +0000
     8.3 @@ -4,6 +4,7 @@
     8.4  #include <xen/time.h>
     8.5  #include <xen/perfc.h>
     8.6  #include <xen/keyhandler.h> 
     8.7 +#include <xen/spinlock.h>
     8.8  #include <public/dom0_ops.h>
     8.9  #include <asm/uaccess.h>
    8.10  
    8.11 @@ -66,6 +67,14 @@ void perfc_printall(unsigned char key)
    8.12              for ( j = sum = 0; j < perfc_info[i].nr_elements; j++ )
    8.13                  sum += atomic_read(&counters[j]);
    8.14              printk("TOTAL[%10d]  ", sum);
    8.15 +#ifdef PERF_ARRAYS
    8.16 +            for ( j = 0; j < perfc_info[i].nr_elements; j++ )
    8.17 +            {
    8.18 +                if ( (j != 0) && ((j % 4) == 0) )
    8.19 +                    printk("\n                   ");
    8.20 +                printk("ARR%02d[%10d]  ", j, atomic_read(&counters[j]));
    8.21 +            }
    8.22 +#endif
    8.23              counters += j;
    8.24              break;
    8.25          }
     9.1 --- a/xen/include/asm-x86/shadow.h	Tue May 10 12:29:18 2005 +0000
     9.2 +++ b/xen/include/asm-x86/shadow.h	Tue May 10 13:41:01 2005 +0000
     9.3 @@ -518,9 +518,9 @@ update_hl2e(struct exec_domain *ed, unsi
     9.4      else
     9.5          new_hl2e = l1e_empty();
     9.6  
     9.7 -    // only do the ref counting if something important changed.
     9.8 +    // only do the ref counting if something has changed.
     9.9      //
    9.10 -    if ( (l1e_has_changed(&old_hl2e, &new_hl2e, _PAGE_PRESENT)) )
    9.11 +    if ( (l1e_has_changed(&old_hl2e, &new_hl2e, PAGE_FLAG_MASK)) )
    9.12      {
    9.13          if ( (l1e_get_flags(new_hl2e) & _PAGE_PRESENT) &&
    9.14               !shadow_get_page(ed->domain, pfn_to_page(l1e_get_pfn(new_hl2e)),
    9.15 @@ -531,14 +531,15 @@ update_hl2e(struct exec_domain *ed, unsi
    9.16              shadow_put_page(ed->domain, pfn_to_page(l1e_get_pfn(old_hl2e)));
    9.17              need_flush = 1;
    9.18          }
    9.19 -    }
    9.20  
    9.21 -    ed->arch.hl2_vtable[l2_table_offset(va)] = new_hl2e;
    9.22 +        ed->arch.hl2_vtable[l2_table_offset(va)] = new_hl2e;
    9.23  
    9.24 -    if ( need_flush )
    9.25 -    {
    9.26 -        perfc_incrc(update_hl2e_invlpg);
    9.27 -        local_flush_tlb_one(&linear_pg_table[l1_linear_offset(va)]);
    9.28 +        if ( need_flush )
    9.29 +        {
    9.30 +            perfc_incrc(update_hl2e_invlpg);
    9.31 +            // SMP BUG???
    9.32 +            local_flush_tlb_one(&linear_pg_table[l1_linear_offset(va)]);
    9.33 +        }
    9.34      }
    9.35  }
    9.36  
    9.37 @@ -1501,11 +1502,6 @@ shadow_set_l1e(unsigned long va, l1_pgen
    9.38      struct domain *d = ed->domain;
    9.39      l2_pgentry_t sl2e;
    9.40  
    9.41 -#if 0
    9.42 -    printk("shadow_set_l1e(va=%p, new_spte=%p, create=%d)\n",
    9.43 -           va, l1e_get_value(new_spte), create_l1_shadow);
    9.44 -#endif
    9.45 -
    9.46      __shadow_get_l2e(ed, va, &sl2e);
    9.47      if ( !(l2e_get_flags(sl2e) & _PAGE_PRESENT) )
    9.48      {
    10.1 --- a/xen/include/xen/perfc.h	Tue May 10 12:29:18 2005 +0000
    10.2 +++ b/xen/include/xen/perfc.h	Tue May 10 13:41:01 2005 +0000
    10.3 @@ -87,6 +87,7 @@ extern struct perfcounter perfcounters;
    10.4   * Histogram: special treatment for 0 and 1 count. After that equally spaced 
    10.5   * with last bucket taking the rest.
    10.6   */
    10.7 +#ifdef PERFC_ARRAYS
    10.8  #define perfc_incr_histo(_x,_v,_n)                                          \
    10.9      do {                                                                    \
   10.10          if ( (_v) == 0 )                                                    \
   10.11 @@ -99,6 +100,9 @@ extern struct perfcounter perfcounters;
   10.12          else                                                                \
   10.13              perfc_incra(_x, PERFC_MAX_ ## _n - 1);                          \
   10.14      } while ( 0 )
   10.15 +#else
   10.16 +#define perfc_incr_histo(_x,_v,_n) ((void)0)
   10.17 +#endif
   10.18      
   10.19  #else /* PERF_COUNTERS */
   10.20