ia64/xen-unstable

changeset 8097:7363637e2721

merge

Keir did a similar change earlier, but my version removed some special case
code as well, now that __gpfn_to_mfn() can protect itself.
author Michael.Fetterman@cl.cam.ac.uk
date Mon Nov 28 15:22:47 2005 +0100 (2005-11-28)
parents 14d733e5e1d0 48aaa39eaa7e
children b3f8d3158a1c
files xen/common/grant_table.c xen/include/asm-x86/shadow.h
line diff
     1.1 --- a/install.sh	Wed Nov 23 14:15:35 2005 +0100
     1.2 +++ b/install.sh	Mon Nov 28 15:22:47 2005 +0100
     1.3 @@ -28,7 +28,7 @@ cp -fdRL $src/etc/init.d/* $dst/etc/init
     1.4  echo "All done."
     1.5  
     1.6  [ -x "$(which udevinfo)" ] && \
     1.7 -  UDEV_VERSION=$(udevinfo -V | sed -e 's/^.*\s\([0-9]\+\)[^0-9]*/\1/')
     1.8 +  UDEV_VERSION=$(udevinfo -V | sed -e 's/^.*\ \([0-9]\+\)[^0-9]*/\1/')
     1.9  
    1.10  if [ -n "$UDEV_VERSION" ] && [ $UDEV_VERSION -ge 059 ]; then
    1.11    cp -f $src/etc/udev/rules.d/*.rules $dst/etc/udev/rules.d/
     2.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/ia32/Makefile	Wed Nov 23 14:15:35 2005 +0100
     2.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/ia32/Makefile	Mon Nov 28 15:22:47 2005 +0100
     2.3 @@ -21,6 +21,12 @@ c-obj-$(CONFIG_IA32_AOUT) += ia32_aout.o
     2.4  $(obj)/syscall32.o: $(src)/syscall32.c \
     2.5  	$(foreach F,int80 sysenter syscall,$(obj)/vsyscall-$F.so)
     2.6  
     2.7 +# syscall32.c currently contains inline asm which has .incbin directives.
     2.8 +# This defeats ccache's signature checks, and also breaks distcc.
     2.9 +# Make sure neither ccache nor distcc compiles this file.
    2.10 +#
    2.11 +$(obj)/syscall32.o: override CC := env CCACHE_DISABLE=1 DISTCC_HOSTS=localhost $(CC)
    2.12 +
    2.13  # Teach kbuild about targets
    2.14  targets := $(foreach F,int80 sysenter syscall,vsyscall-$F.o vsyscall-$F.so)
    2.15  
     3.1 --- a/tools/check/check_hotplug	Wed Nov 23 14:15:35 2005 +0100
     3.2 +++ b/tools/check/check_hotplug	Mon Nov 28 15:22:47 2005 +0100
     3.3 @@ -7,7 +7,7 @@ function error {
     3.4     exit 1
     3.5  }
     3.6  [ -x "$(which udevinfo)" ] && \
     3.7 -  UDEV_VERSION=$(udevinfo -V | sed -e 's/^.*\s\([0-9]\+\)[^0-9]*/\1/')
     3.8 +  UDEV_VERSION=$(udevinfo -V | sed -e 's/^.*\ \([0-9]\+\)[^0-9]*/\1/')
     3.9  
    3.10  if [ -n "$UDEV_VERSION" ] && [ $UDEV_VERSION -ge 059 ]; then
    3.11    exit 0
     4.1 --- a/xen/arch/x86/shadow.c	Wed Nov 23 14:15:35 2005 +0100
     4.2 +++ b/xen/arch/x86/shadow.c	Mon Nov 28 15:22:47 2005 +0100
     4.3 @@ -1075,8 +1075,8 @@ static void shadow_mark_va_out_of_sync(
     4.4      entry->next = d->arch.out_of_sync;
     4.5      d->arch.out_of_sync = entry;
     4.6  
     4.7 -    FSH_LOG("mark_out_of_sync(va=%lx -> writable_pl1e=%lx)",
     4.8 -            va, entry->writable_pl1e);
     4.9 +    FSH_LOG("%s(va=%lx -> writable_pl1e=%lx)",
    4.10 +            __func__, va, entry->writable_pl1e);
    4.11  }
    4.12  
    4.13  /*
     5.1 --- a/xen/arch/x86/shadow32.c	Wed Nov 23 14:15:35 2005 +0100
     5.2 +++ b/xen/arch/x86/shadow32.c	Mon Nov 28 15:22:47 2005 +0100
     5.3 @@ -1423,7 +1423,7 @@ int shadow_mode_control(struct domain *d
     5.4  }
     5.5  
     5.6  unsigned long
     5.7 -gpfn_to_mfn_foreign(struct domain *d, unsigned long gpfn)
     5.8 +get_mfn_from_pfn_foreign(struct domain *d, unsigned long gpfn)
     5.9  {
    5.10      unsigned long va, tabpfn;
    5.11      l1_pgentry_t *l1, l1e;
    5.12 @@ -1431,7 +1431,7 @@ gpfn_to_mfn_foreign(struct domain *d, un
    5.13  
    5.14      ASSERT(shadow_mode_translate(d));
    5.15  
    5.16 -    perfc_incrc(gpfn_to_mfn_foreign);
    5.17 +    perfc_incrc(get_mfn_from_pfn_foreign);
    5.18  
    5.19      va = gpfn << PAGE_SHIFT;
    5.20      tabpfn = pagetable_get_pfn(d->arch.phys_table);
    5.21 @@ -1440,8 +1440,8 @@ gpfn_to_mfn_foreign(struct domain *d, un
    5.22      unmap_domain_page(l2);
    5.23      if ( !(l2e_get_flags(l2e) & _PAGE_PRESENT) )
    5.24      {
    5.25 -        printk("gpfn_to_mfn_foreign(d->id=%d, gpfn=%lx) => 0 l2e=%" PRIpte "\n",
    5.26 -               d->domain_id, gpfn, l2e_get_intpte(l2e));
    5.27 +        printk("%s(d->id=%d, gpfn=%lx) => 0 l2e=%" PRIpte "\n",
    5.28 +               __func__, d->domain_id, gpfn, l2e_get_intpte(l2e));
    5.29          return INVALID_MFN;
    5.30      }
    5.31      l1 = map_domain_page(l2e_get_pfn(l2e));
    5.32 @@ -1449,14 +1449,14 @@ gpfn_to_mfn_foreign(struct domain *d, un
    5.33      unmap_domain_page(l1);
    5.34  
    5.35  #if 0
    5.36 -    printk("gpfn_to_mfn_foreign(d->id=%d, gpfn=%lx) => %lx tabpfn=%lx l2e=%lx l1tab=%lx, l1e=%lx\n",
    5.37 -           d->domain_id, gpfn, l1_pgentry_val(l1e) >> PAGE_SHIFT, tabpfn, l2e, l1tab, l1e);
    5.38 +    printk("%s(d->id=%d, gpfn=%lx) => %lx tabpfn=%lx l2e=%lx l1tab=%lx, l1e=%lx\n",
    5.39 +           __func__, d->domain_id, gpfn, l1_pgentry_val(l1e) >> PAGE_SHIFT, tabpfn, l2e, l1tab, l1e);
    5.40  #endif
    5.41  
    5.42      if ( !(l1e_get_flags(l1e) & _PAGE_PRESENT) )
    5.43      {
    5.44 -        printk("gpfn_to_mfn_foreign(d->id=%d, gpfn=%lx) => 0 l1e=%" PRIpte "\n",
    5.45 -               d->domain_id, gpfn, l1e_get_intpte(l1e));
    5.46 +        printk("%s(d->id=%d, gpfn=%lx) => 0 l1e=%" PRIpte "\n",
    5.47 +               __func__, d->domain_id, gpfn, l1e_get_intpte(l1e));
    5.48          return INVALID_MFN;
    5.49      }
    5.50  
    5.51 @@ -1945,8 +1945,8 @@ void shadow_mark_va_out_of_sync(
    5.52      entry->next = d->arch.out_of_sync;
    5.53      d->arch.out_of_sync = entry;
    5.54  
    5.55 -    FSH_LOG("mark_out_of_sync(va=%lx -> writable_pl1e=%lx)",
    5.56 -            va, entry->writable_pl1e);
    5.57 +    FSH_LOG("%s(va=%lx -> writable_pl1e=%lx)",
    5.58 +            __func__, va, entry->writable_pl1e);
    5.59  }
    5.60  
    5.61  /*
     6.1 --- a/xen/arch/x86/shadow_public.c	Wed Nov 23 14:15:35 2005 +0100
     6.2 +++ b/xen/arch/x86/shadow_public.c	Mon Nov 28 15:22:47 2005 +0100
     6.3 @@ -1607,7 +1607,7 @@ remove_shadow(struct domain *d, unsigned
     6.4  }
     6.5  
     6.6  unsigned long
     6.7 -gpfn_to_mfn_foreign(struct domain *d, unsigned long gpfn)
     6.8 +get_mfn_from_pfn_foreign(struct domain *d, unsigned long gpfn)
     6.9  {
    6.10      unsigned long va, tabpfn;
    6.11      l1_pgentry_t *l1, l1e;
    6.12 @@ -1615,7 +1615,7 @@ gpfn_to_mfn_foreign(struct domain *d, un
    6.13  
    6.14      ASSERT(shadow_mode_translate(d));
    6.15  
    6.16 -    perfc_incrc(gpfn_to_mfn_foreign);
    6.17 +    perfc_incrc(get_mfn_from_pfn_foreign);
    6.18  
    6.19      va = gpfn << PAGE_SHIFT;
    6.20      tabpfn = pagetable_get_pfn(d->arch.phys_table);
    6.21 @@ -1624,8 +1624,8 @@ gpfn_to_mfn_foreign(struct domain *d, un
    6.22      unmap_domain_page(l2);
    6.23      if ( !(l2e_get_flags(l2e) & _PAGE_PRESENT) )
    6.24      {
    6.25 -        printk("gpfn_to_mfn_foreign(d->id=%d, gpfn=%lx) => 0 l2e=%" PRIpte "\n",
    6.26 -               d->domain_id, gpfn, l2e_get_intpte(l2e));
    6.27 +        printk("%s(d->id=%d, gpfn=%lx) => 0 l2e=%" PRIpte "\n",
    6.28 +               __func__, d->domain_id, gpfn, l2e_get_intpte(l2e));
    6.29          return INVALID_MFN;
    6.30      }
    6.31      l1 = map_domain_page(l2e_get_pfn(l2e));
    6.32 @@ -1633,14 +1633,14 @@ gpfn_to_mfn_foreign(struct domain *d, un
    6.33      unmap_domain_page(l1);
    6.34  
    6.35  #if 0
    6.36 -    printk("gpfn_to_mfn_foreign(d->id=%d, gpfn=%lx) => %lx tabpfn=%lx l2e=%lx l1tab=%lx, l1e=%lx\n",
    6.37 -           d->domain_id, gpfn, l1_pgentry_val(l1e) >> PAGE_SHIFT, tabpfn, l2e, l1tab, l1e);
    6.38 +    printk("%s(d->id=%d, gpfn=%lx) => %lx tabpfn=%lx l2e=%lx l1tab=%lx, l1e=%lx\n",
    6.39 +           __func__, d->domain_id, gpfn, l1_pgentry_val(l1e) >> PAGE_SHIFT, tabpfn, l2e, l1tab, l1e);
    6.40  #endif
    6.41  
    6.42      if ( !(l1e_get_flags(l1e) & _PAGE_PRESENT) )
    6.43      {
    6.44 -        printk("gpfn_to_mfn_foreign(d->id=%d, gpfn=%lx) => 0 l1e=%" PRIpte "\n",
    6.45 -               d->domain_id, gpfn, l1e_get_intpte(l1e));
    6.46 +        printk("%s(d->id=%d, gpfn=%lx) => 0 l1e=%" PRIpte "\n",
    6.47 +               __func__, d->domain_id, gpfn, l1e_get_intpte(l1e));
    6.48          return INVALID_MFN;
    6.49      }
    6.50  
     7.1 --- a/xen/common/grant_table.c	Wed Nov 23 14:15:35 2005 +0100
     7.2 +++ b/xen/common/grant_table.c	Mon Nov 28 15:22:47 2005 +0100
     7.3 @@ -234,7 +234,7 @@ static int
     7.4  
     7.5          /* rmb(); */ /* not on x86 */
     7.6  
     7.7 -        frame = __gpfn_to_mfn_foreign(rd, sha->frame);
     7.8 +        frame = __gpfn_to_mfn(rd, sha->frame);
     7.9  
    7.10          if ( unlikely(!pfn_valid(frame)) ||
    7.11               unlikely(!((dev_hst_ro_flags & GNTMAP_readonly) ?
     8.1 --- a/xen/include/asm-x86/shadow.h	Wed Nov 23 14:15:35 2005 +0100
     8.2 +++ b/xen/include/asm-x86/shadow.h	Mon Nov 28 15:22:47 2005 +0100
     8.3 @@ -283,26 +283,21 @@ static inline void shadow_mode_disable(s
     8.4  
     8.5  /************************************************************************/
     8.6  
     8.7 -#define __mfn_to_gpfn(_d, mfn)                  \
     8.8 -    ( (shadow_mode_translate(_d))               \
     8.9 -      ? get_pfn_from_mfn(mfn)                   \
    8.10 +#define __mfn_to_gpfn(_d, mfn)                         \
    8.11 +    ( (shadow_mode_translate(_d))                      \
    8.12 +      ? get_pfn_from_mfn(mfn)                          \
    8.13        : (mfn) )
    8.14  
    8.15 -#define __gpfn_to_mfn(_d, gpfn)                 \
    8.16 -    ({                                          \
    8.17 -        (shadow_mode_translate(_d))             \
    8.18 -        ? (((_d) == current->domain) ?          \
    8.19 -           get_mfn_from_pfn(gpfn) :             \
    8.20 -           gpfn_to_mfn_foreign((_d), (gpfn)))   \
    8.21 -        : (gpfn);                               \
    8.22 +#define __gpfn_to_mfn(_d, gpfn)                        \
    8.23 +    ({                                                 \
    8.24 +        unlikely(shadow_mode_translate(_d))            \
    8.25 +        ? (likely(current->domain == (_d))             \
    8.26 +           ? get_mfn_from_pfn(gpfn)                    \
    8.27 +           : get_mfn_from_pfn_foreign(_d, gpfn))       \
    8.28 +        : (gpfn);                                      \
    8.29      })
    8.30  
    8.31 -#define __gpfn_to_mfn_foreign(_d, gpfn)         \
    8.32 -    ( (shadow_mode_translate(_d))               \
    8.33 -      ? gpfn_to_mfn_foreign(_d, gpfn)           \
    8.34 -      : (gpfn) )
    8.35 -
    8.36 -extern unsigned long gpfn_to_mfn_foreign(
    8.37 +extern unsigned long get_mfn_from_pfn_foreign(
    8.38      struct domain *d, unsigned long gpfn);
    8.39  
    8.40  /************************************************************************/
    8.41 @@ -873,18 +868,7 @@ static inline void hl2e_propagate_from_g
    8.42  
    8.43      if ( l2e_get_flags(gpde) & _PAGE_PRESENT )
    8.44      {
    8.45 -        if ( unlikely((current->domain != d) && !shadow_mode_external(d)) )
    8.46 -        {
    8.47 -            // Can't use __gpfn_to_mfn() if we don't have one of this domain's
    8.48 -            // page tables currently installed.
    8.49 -            // This isn't common -- it only happens during shadow mode setup
    8.50 -            // and mode changes.
    8.51 -            //
    8.52 -            mfn = gpfn_to_mfn_foreign(d, pfn);
    8.53 -        }
    8.54 -        else
    8.55 -            mfn = __gpfn_to_mfn(d, pfn);
    8.56 -
    8.57 +        mfn = __gpfn_to_mfn(d, pfn);
    8.58          if ( VALID_MFN(mfn) && (mfn < max_page) )
    8.59              hl2e = l1e_from_pfn(mfn, __PAGE_HYPERVISOR);
    8.60      }
     9.1 --- a/xen/include/xen/perfc_defn.h	Wed Nov 23 14:15:35 2005 +0100
     9.2 +++ b/xen/include/xen/perfc_defn.h	Mon Nov 28 15:22:47 2005 +0100
     9.3 @@ -114,7 +114,7 @@ PERFCOUNTER_CPU(shadow_get_page_fail,   
     9.4  PERFCOUNTER_CPU(validate_hl2e_calls,    "calls to validate_hl2e_change")
     9.5  PERFCOUNTER_CPU(validate_hl2e_changes,  "validate_hl2e makes changes")
     9.6  PERFCOUNTER_CPU(exception_fixed,        "pre-exception fixed")
     9.7 -PERFCOUNTER_CPU(gpfn_to_mfn_foreign,    "calls to gpfn_to_mfn_foreign")
     9.8 +PERFCOUNTER_CPU(get_mfn_from_pfn_foreign, "calls to get_mfn_from_pfn_foreign")
     9.9  PERFCOUNTER_CPU(remove_all_access,      "calls to remove_all_access")
    9.10  PERFCOUNTER_CPU(remove_write_access,    "calls to remove_write_access")
    9.11  PERFCOUNTER_CPU(remove_write_access_easy, "easy outs of remove_write_access")