[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [linux-2.6.18-xen] merge with linux-2.6.18-xen.hg



# HG changeset patch
# User Alex Williamson <alex.williamson@xxxxxx>
# Date 1208279427 21600
# Node ID ae505684a995b9aa366fffc4d78cebfdf0552ddc
# Parent  dbe8a35dcaf7c12b816e358c596f7fcc9b926e77
# Parent  7f8b544237bf70b05d0ac2b2ee9d537b6fa50100
merge with linux-2.6.18-xen.hg
---
 arch/i386/kernel/acpi/sleep-xen.c       |   21 -------------
 arch/i386/kernel/sysenter.c             |   12 ++++---
 arch/powerpc/kernel/vdso.c              |    7 ++++
 arch/x86_64/ia32/ia32_binfmt.c          |   49 --------------------------------
 arch/x86_64/ia32/syscall32.c            |    7 ++++
 arch/x86_64/kernel/acpi/sleep-xen.c     |   21 -------------
 drivers/acpi/hardware/hwsleep.c         |   21 ++++++++-----
 drivers/char/mem.c                      |   10 ++++++
 drivers/pci/quirks.c                    |   14 ++++++++-
 drivers/xen/balloon/balloon.c           |   37 +++++++++++++++++++++++-
 drivers/xen/blkback/common.h            |    2 -
 drivers/xen/blkback/vbd.c               |    4 +-
 drivers/xen/blkback/xenbus.c            |   10 +++++-
 drivers/xen/blktap/blktap.c             |    2 -
 drivers/xen/evtchn/evtchn.c             |    2 +
 drivers/xen/gntdev/gntdev.c             |    2 -
 drivers/xen/netfront/netfront.c         |   38 ++++++++++++++++++------
 drivers/xen/xenbus/xenbus_probe.c       |    3 +
 fs/binfmt_elf.c                         |    4 ++
 fs/compat_ioctl.c                       |    2 +
 include/asm-i386/acpi.h                 |   28 +++++++++++++++---
 include/asm-i386/elf.h                  |   44 ----------------------------
 include/asm-i386/mach-xen/asm/pgtable.h |    4 +-
 include/asm-x86_64/acpi.h               |   29 +++++++++++++++---
 include/linux/mm.h                      |    1 
 25 files changed, 197 insertions(+), 177 deletions(-)

diff -r dbe8a35dcaf7 -r ae505684a995 arch/i386/kernel/acpi/sleep-xen.c
--- a/arch/i386/kernel/acpi/sleep-xen.c Mon Apr 14 13:29:37 2008 -0600
+++ b/arch/i386/kernel/acpi/sleep-xen.c Tue Apr 15 11:10:27 2008 -0600
@@ -110,25 +110,4 @@ static int __init acpisleep_dmi_init(voi
 }
 
 core_initcall(acpisleep_dmi_init);
-
-#else /* CONFIG_ACPI_PV_SLEEP */
-#include <asm/hypervisor.h>
-#include <xen/interface/platform.h>
-int acpi_notify_hypervisor_state(u8 sleep_state,
-       u32 pm1a_cnt, u32 pm1b_cnt)
-{
-       struct xen_platform_op op = {
-               .cmd = XENPF_enter_acpi_sleep,
-               .interface_version = XENPF_INTERFACE_VERSION,
-               .u = {
-                       .enter_acpi_sleep = {
-                               .pm1a_cnt_val = (u16)pm1a_cnt,
-                               .pm1b_cnt_val = (u16)pm1b_cnt,
-                               .sleep_state = sleep_state,
-                       },
-               },
-       };
-
-       return HYPERVISOR_platform_op(&op);
-}
 #endif /* CONFIG_ACPI_PV_SLEEP */
diff -r dbe8a35dcaf7 -r ae505684a995 arch/i386/kernel/sysenter.c
--- a/arch/i386/kernel/sysenter.c       Mon Apr 14 13:29:37 2008 -0600
+++ b/arch/i386/kernel/sysenter.c       Tue Apr 15 11:10:27 2008 -0600
@@ -109,11 +109,6 @@ int __init sysenter_setup(void)
 #ifdef CONFIG_COMPAT_VDSO
        __set_fixmap(FIX_VDSO, __pa(syscall_page), PAGE_READONLY);
        printk("Compat vDSO mapped to %08lx.\n", __fix_to_virt(FIX_VDSO));
-#else
-       /*
-        * In the non-compat case the ELF coredumping code needs the fixmap:
-        */
-       __set_fixmap(FIX_VDSO, __pa(syscall_page), PAGE_KERNEL_RO);
 #endif
 
        if (!boot_cpu_has(X86_FEATURE_SEP)) {
@@ -176,6 +171,13 @@ int arch_setup_additional_pages(struct l
        vma->vm_end = addr + PAGE_SIZE;
        /* MAYWRITE to allow gdb to COW and set breakpoints */
        vma->vm_flags = VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYEXEC|VM_MAYWRITE;
+       /*
+        * Make sure the vDSO gets into every core dump.
+        * Dumping its contents makes post-mortem fully interpretable later
+        * without matching up the same kernel and hardware config to see
+        * what PC values meant.
+        */
+       vma->vm_flags |= VM_ALWAYSDUMP;
        vma->vm_flags |= mm->def_flags;
        vma->vm_page_prot = protection_map[vma->vm_flags & 7];
        vma->vm_ops = &syscall_vm_ops;
diff -r dbe8a35dcaf7 -r ae505684a995 arch/powerpc/kernel/vdso.c
--- a/arch/powerpc/kernel/vdso.c        Mon Apr 14 13:29:37 2008 -0600
+++ b/arch/powerpc/kernel/vdso.c        Tue Apr 15 11:10:27 2008 -0600
@@ -282,6 +282,13 @@ int arch_setup_additional_pages(struct l
         * pages though
         */
        vma->vm_flags = VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC;
+       /*
+        * Make sure the vDSO gets into every core dump.
+        * Dumping its contents makes post-mortem fully interpretable later
+        * without matching up the same kernel and hardware config to see
+        * what PC values meant.
+        */
+       vma->vm_flags |= VM_ALWAYSDUMP;
        vma->vm_flags |= mm->def_flags;
        vma->vm_page_prot = protection_map[vma->vm_flags & 0x7];
        vma->vm_ops = &vdso_vmops;
diff -r dbe8a35dcaf7 -r ae505684a995 arch/x86_64/ia32/ia32_binfmt.c
--- a/arch/x86_64/ia32/ia32_binfmt.c    Mon Apr 14 13:29:37 2008 -0600
+++ b/arch/x86_64/ia32/ia32_binfmt.c    Tue Apr 15 11:10:27 2008 -0600
@@ -64,55 +64,6 @@ typedef unsigned int elf_greg_t;
 
 #define ELF_NGREG (sizeof (struct user_regs_struct32) / sizeof(elf_greg_t))
 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
-
-/*
- * These macros parameterize elf_core_dump in fs/binfmt_elf.c to write out
- * extra segments containing the vsyscall DSO contents.  Dumping its
- * contents makes post-mortem fully interpretable later without matching up
- * the same kernel and hardware config to see what PC values meant.
- * Dumping its extra ELF program headers includes all the other information
- * a debugger needs to easily find how the vsyscall DSO was being used.
- */
-#define ELF_CORE_EXTRA_PHDRS   (find_vma(current->mm, VSYSCALL32_BASE) ?     \
-    (VSYSCALL32_EHDR->e_phnum) : 0)
-#define ELF_CORE_WRITE_EXTRA_PHDRS                                           \
-do {                                                                         \
-       if (find_vma(current->mm, VSYSCALL32_BASE)) {                         \
-               const struct elf32_phdr *const vsyscall_phdrs =               \
-                       (const struct elf32_phdr *) (VSYSCALL32_BASE          \
-                                                  + VSYSCALL32_EHDR->e_phoff);\
-               int i;                                                        \
-               Elf32_Off ofs = 0;                                            \
-               for (i = 0; i < VSYSCALL32_EHDR->e_phnum; ++i) {              \
-                       struct elf32_phdr phdr = vsyscall_phdrs[i];           \
-                       if (phdr.p_type == PT_LOAD) {                         \
-                               BUG_ON(ofs != 0);                             \
-                               ofs = phdr.p_offset = offset;                 \
-                               phdr.p_memsz = PAGE_ALIGN(phdr.p_memsz);      \
-                               phdr.p_filesz = phdr.p_memsz;                 \
-                               offset += phdr.p_filesz;                      \
-                       }                                                     \
-                       else                                                  \
-                               phdr.p_offset += ofs;                         \
-                       phdr.p_paddr = 0; /* match other core phdrs */        \
-                       DUMP_WRITE(&phdr, sizeof(phdr));                      \
-               }                                                             \
-       }                                                                     \
-} while (0)
-#define ELF_CORE_WRITE_EXTRA_DATA                                            \
-do {                                                                         \
-       if (find_vma(current->mm, VSYSCALL32_BASE)) {                         \
-               const struct elf32_phdr *const vsyscall_phdrs =               \
-                       (const struct elf32_phdr *) (VSYSCALL32_BASE          \
-                                                  + VSYSCALL32_EHDR->e_phoff); 
     \
-               int i;                                                        \
-               for (i = 0; i < VSYSCALL32_EHDR->e_phnum; ++i) {              \
-                       if (vsyscall_phdrs[i].p_type == PT_LOAD)              \
-                               DUMP_WRITE((void *) (u64) 
vsyscall_phdrs[i].p_vaddr,\
-                                   PAGE_ALIGN(vsyscall_phdrs[i].p_memsz));   \
-               }                                                             \
-       }                                                                     \
-} while (0)
 
 struct elf_siginfo
 {
diff -r dbe8a35dcaf7 -r ae505684a995 arch/x86_64/ia32/syscall32.c
--- a/arch/x86_64/ia32/syscall32.c      Mon Apr 14 13:29:37 2008 -0600
+++ b/arch/x86_64/ia32/syscall32.c      Tue Apr 15 11:10:27 2008 -0600
@@ -59,6 +59,13 @@ int syscall32_setup_pages(struct linux_b
        vma->vm_end = VSYSCALL32_END;
        /* MAYWRITE to allow gdb to COW and set breakpoints */
        vma->vm_flags = VM_READ|VM_EXEC|VM_MAYREAD|VM_MAYEXEC|VM_MAYWRITE;
+       /*
+        * Make sure the vDSO gets into every core dump.
+        * Dumping its contents makes post-mortem fully interpretable later
+        * without matching up the same kernel and hardware config to see
+        * what PC values meant.
+        */
+       vma->vm_flags |= VM_ALWAYSDUMP;
        vma->vm_flags |= mm->def_flags;
        vma->vm_page_prot = protection_map[vma->vm_flags & 7];
        vma->vm_ops = &syscall32_vm_ops;
diff -r dbe8a35dcaf7 -r ae505684a995 arch/x86_64/kernel/acpi/sleep-xen.c
--- a/arch/x86_64/kernel/acpi/sleep-xen.c       Mon Apr 14 13:29:37 2008 -0600
+++ b/arch/x86_64/kernel/acpi/sleep-xen.c       Tue Apr 15 11:10:27 2008 -0600
@@ -137,27 +137,6 @@ static int __init acpi_sleep_setup(char 
 }
 
 __setup("acpi_sleep=", acpi_sleep_setup);
-
-#else /* CONFIG_ACPI_PV_SLEEP */
-#include <asm/hypervisor.h>
-#include <xen/interface/platform.h>
-int acpi_notify_hypervisor_state(u8 sleep_state,
-       u32 pm1a_cnt, u32 pm1b_cnt)
-{
-       struct xen_platform_op op = {
-               .cmd = XENPF_enter_acpi_sleep,
-               .interface_version = XENPF_INTERFACE_VERSION,
-               .u = {
-                       .enter_acpi_sleep = {
-                               .pm1a_cnt_val = (u16)pm1a_cnt,
-                               .pm1b_cnt_val = (u16)pm1b_cnt,
-                               .sleep_state = sleep_state,
-                       },
-               },
-       };
-
-       return HYPERVISOR_platform_op(&op);
-}
 #endif                         /* CONFIG_ACPI_PV_SLEEP */
 
 #endif                         /*CONFIG_ACPI_SLEEP */
diff -r dbe8a35dcaf7 -r ae505684a995 drivers/acpi/hardware/hwsleep.c
--- a/drivers/acpi/hardware/hwsleep.c   Mon Apr 14 13:29:37 2008 -0600
+++ b/drivers/acpi/hardware/hwsleep.c   Tue Apr 15 11:10:27 2008 -0600
@@ -227,7 +227,11 @@ acpi_status asmlinkage acpi_enter_sleep_
        u32 PM1Bcontrol;
        struct acpi_bit_register_info *sleep_type_reg_info;
        struct acpi_bit_register_info *sleep_enable_reg_info;
+#if !(defined(CONFIG_XEN) && defined(CONFIG_X86))
        u32 in_value;
+#else
+       int err;
+#endif
        acpi_status status;
 
        ACPI_FUNCTION_TRACE(acpi_enter_sleep_state);
@@ -327,7 +331,7 @@ acpi_status asmlinkage acpi_enter_sleep_
 
        ACPI_FLUSH_CPU_CACHE();
 
-#ifndef CONFIG_ACPI_PV_SLEEP
+#if !(defined(CONFIG_XEN) && defined(CONFIG_X86))
        status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
                                        ACPI_REGISTER_PM1A_CONTROL,
                                        PM1Acontrol);
@@ -377,17 +381,18 @@ acpi_status asmlinkage acpi_enter_sleep_
                /* Spin until we wake */
 
        } while (!in_value);
-
-       return_ACPI_STATUS(AE_OK);
 #else
        /* PV ACPI just need check hypercall return value */
-       status = acpi_notify_hypervisor_state(sleep_state,
+       err = acpi_notify_hypervisor_state(sleep_state,
                        PM1Acontrol, PM1Bcontrol);
-       if (ACPI_FAILURE(status))
-               return_ACPI_STATUS(status);
-       else
-               return_ACPI_STATUS(AE_OK);
+       if (err) {
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Hypervisor failure [%d]\n", err));
+               return_ACPI_STATUS(AE_ERROR);
+       }
 #endif
+
+       return_ACPI_STATUS(AE_OK);
 }
 
 ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state)
diff -r dbe8a35dcaf7 -r ae505684a995 drivers/char/mem.c
--- a/drivers/char/mem.c        Mon Apr 14 13:29:37 2008 -0600
+++ b/drivers/char/mem.c        Tue Apr 15 11:10:27 2008 -0600
@@ -264,6 +264,9 @@ static int mmap_kmem(struct file * file,
 static int mmap_kmem(struct file * file, struct vm_area_struct * vma)
 {
        unsigned long pfn;
+#ifdef CONFIG_XEN
+       unsigned long i, count;
+#endif
 
        /* Turn a kernel-virtual address into a physical page frame */
        pfn = __pa((u64)vma->vm_pgoff << PAGE_SHIFT) >> PAGE_SHIFT;
@@ -277,6 +280,13 @@ static int mmap_kmem(struct file * file,
         */
        if (!pfn_valid(pfn))
                return -EIO;
+
+#ifdef CONFIG_XEN
+       count = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
+       for (i = 0; i < count; i++)
+               if ((pfn + i) != mfn_to_local_pfn(pfn_to_mfn(pfn + i)))
+                       return -EIO;
+#endif
 
        vma->vm_pgoff = pfn;
        return mmap_mem(file, vma);
diff -r dbe8a35dcaf7 -r ae505684a995 drivers/pci/quirks.c
--- a/drivers/pci/quirks.c      Mon Apr 14 13:29:37 2008 -0600
+++ b/drivers/pci/quirks.c      Tue Apr 15 11:10:27 2008 -0600
@@ -1528,10 +1528,11 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_N
 
 static void __devinit quirk_e100_interrupt(struct pci_dev *dev)
 {
-       u16 command;
+       u16 command, pmcsr;
        u32 bar;
        u8 __iomem *csr;
        u8 cmd_hi;
+       int pm;
 
        switch (dev->device) {
        /* PCI IDs taken from drivers/net/e100.c */
@@ -1566,6 +1567,17 @@ static void __devinit quirk_e100_interru
        if (!(command & PCI_COMMAND_MEMORY) || !bar)
                return;
 
+        /*
+         * Check that the device is in the D0 power state. If it's not,
+         * there is no point to look any further.
+         */
+        pm = pci_find_capability(dev, PCI_CAP_ID_PM);
+        if (pm) {
+                pci_read_config_word(dev, pm + PCI_PM_CTRL, &pmcsr);
+                if ((pmcsr & PCI_PM_CTRL_STATE_MASK) != PCI_D0)
+                        return;
+        }
+
        csr = ioremap(bar, 8);
        if (!csr) {
                printk(KERN_WARNING "PCI: Can't map %s e100 registers\n",
diff -r dbe8a35dcaf7 -r ae505684a995 drivers/xen/balloon/balloon.c
--- a/drivers/xen/balloon/balloon.c     Mon Apr 14 13:29:37 2008 -0600
+++ b/drivers/xen/balloon/balloon.c     Tue Apr 15 11:10:27 2008 -0600
@@ -194,6 +194,41 @@ static unsigned long current_target(void
        return target;
 }
 
+static unsigned long minimum_target(void)
+{
+#ifndef CONFIG_XEN
+       return 0;
+#else
+       unsigned long min_pages, curr_pages = current_target();
+
+#define MB2PAGES(mb) ((mb) << (20 - PAGE_SHIFT))
+       /* Simple continuous piecewiese linear function:
+        *  max MiB -> min MiB  gradient
+        *       0         0
+        *      16        16
+        *      32        24
+        *     128        72    (1/2)
+        *     512       168    (1/4)
+        *    2048       360    (1/8)
+        *    8192       552    (1/32)
+        *   32768      1320
+        *  131072      4392
+        */
+       if (max_pfn < MB2PAGES(128))
+               min_pages = MB2PAGES(8) + (max_pfn >> 1);
+       else if (max_pfn < MB2PAGES(512))
+               min_pages = MB2PAGES(40) + (max_pfn >> 2);
+       else if (max_pfn < MB2PAGES(2048))
+               min_pages = MB2PAGES(104) + (max_pfn >> 3);
+       else
+               min_pages = MB2PAGES(296) + (max_pfn >> 5);
+#undef MB2PAGES
+
+       /* Don't enforce growth */
+       return min(min_pages, curr_pages);
+#endif
+}
+
 static int increase_reservation(unsigned long nr_pages)
 {
        unsigned long  pfn, i, flags;
@@ -384,7 +419,7 @@ void balloon_set_new_target(unsigned lon
 {
        /* No need for lock. Not read-modify-write updates. */
        bs.hard_limit   = ~0UL;
-       bs.target_pages = target;
+       bs.target_pages = max(target, minimum_target());
        schedule_work(&balloon_worker);
 }
 
diff -r dbe8a35dcaf7 -r ae505684a995 drivers/xen/blkback/common.h
--- a/drivers/xen/blkback/common.h      Mon Apr 14 13:29:37 2008 -0600
+++ b/drivers/xen/blkback/common.h      Tue Apr 15 11:10:27 2008 -0600
@@ -110,7 +110,7 @@ int blkif_map(blkif_t *blkif, unsigned l
 
 /* Create a vbd. */
 int vbd_create(blkif_t *blkif, blkif_vdev_t vdevice, unsigned major,
-              unsigned minor, int readonly);
+              unsigned minor, int readonly, int cdrom);
 void vbd_free(struct vbd *vbd);
 
 unsigned long long vbd_size(struct vbd *vbd);
diff -r dbe8a35dcaf7 -r ae505684a995 drivers/xen/blkback/vbd.c
--- a/drivers/xen/blkback/vbd.c Mon Apr 14 13:29:37 2008 -0600
+++ b/drivers/xen/blkback/vbd.c Tue Apr 15 11:10:27 2008 -0600
@@ -51,7 +51,7 @@ unsigned long vbd_secsize(struct vbd *vb
 }
 
 int vbd_create(blkif_t *blkif, blkif_vdev_t handle, unsigned major,
-              unsigned minor, int readonly)
+              unsigned minor, int readonly, int cdrom)
 {
        struct vbd *vbd;
        struct block_device *bdev;
@@ -81,7 +81,7 @@ int vbd_create(blkif_t *blkif, blkif_vde
                return -ENOENT;
        }
 
-       if (vbd->bdev->bd_disk->flags & GENHD_FL_CD)
+       if (vbd->bdev->bd_disk->flags & GENHD_FL_CD || cdrom)
                vbd->type |= VDISK_CDROM;
        if (vbd->bdev->bd_disk->flags & GENHD_FL_REMOVABLE)
                vbd->type |= VDISK_REMOVABLE;
diff -r dbe8a35dcaf7 -r ae505684a995 drivers/xen/blkback/xenbus.c
--- a/drivers/xen/blkback/xenbus.c      Mon Apr 14 13:29:37 2008 -0600
+++ b/drivers/xen/blkback/xenbus.c      Tue Apr 15 11:10:27 2008 -0600
@@ -270,6 +270,8 @@ static void backend_changed(struct xenbu
        struct backend_info *be
                = container_of(watch, struct backend_info, backend_watch);
        struct xenbus_device *dev = be->dev;
+       int cdrom = 0;
+       char *device_type;
 
        DPRINTK("");
 
@@ -303,6 +305,12 @@ static void backend_changed(struct xenbu
                return;
        }
 
+       device_type = xenbus_read(XBT_NIL, dev->otherend, "device-type", NULL);
+       if (!IS_ERR(device_type)) {
+               cdrom = strcmp(device_type, "cdrom") == 0;
+               kfree(device_type);
+       }
+
        if (be->major == 0 && be->minor == 0) {
                /* Front end dir is a number, which is used as the handle. */
 
@@ -313,7 +321,7 @@ static void backend_changed(struct xenbu
                be->minor = minor;
 
                err = vbd_create(be->blkif, handle, major, minor,
-                                (NULL == strchr(be->mode, 'w')));
+                                (NULL == strchr(be->mode, 'w')), cdrom);
                if (err) {
                        be->major = be->minor = 0;
                        xenbus_dev_fatal(dev, err, "creating vbd structure");
diff -r dbe8a35dcaf7 -r ae505684a995 drivers/xen/blktap/blktap.c
--- a/drivers/xen/blktap/blktap.c       Mon Apr 14 13:29:37 2008 -0600
+++ b/drivers/xen/blktap/blktap.c       Tue Apr 15 11:10:27 2008 -0600
@@ -684,7 +684,7 @@ static int blktap_mmap(struct file *filp
 
        /* Mark this VM as containing foreign pages, and set up mappings. */
        map = kzalloc(((vma->vm_end - vma->vm_start) >> PAGE_SHIFT)
-                     * sizeof(struct page_struct*),
+                     * sizeof(struct page *),
                      GFP_KERNEL);
        if (map == NULL) {
                WPRINTK("Couldn't alloc VM_FOREIGN map.\n");
diff -r dbe8a35dcaf7 -r ae505684a995 drivers/xen/evtchn/evtchn.c
--- a/drivers/xen/evtchn/evtchn.c       Mon Apr 14 13:29:37 2008 -0600
+++ b/drivers/xen/evtchn/evtchn.c       Tue Apr 15 11:10:27 2008 -0600
@@ -349,6 +349,7 @@ static long evtchn_ioctl(struct file *fi
 
                port_user[unbind.port] = NULL;
                mask_evtchn(unbind.port);
+               rebind_evtchn_to_cpu(unbind.port, 0);
 
                spin_unlock_irq(&port_user_lock);
 
@@ -458,6 +459,7 @@ static int evtchn_release(struct inode *
 
                port_user[i] = NULL;
                mask_evtchn(i);
+               rebind_evtchn_to_cpu(i, 0);
 
                close.port = i;
                ret = HYPERVISOR_event_channel_op(EVTCHNOP_close, &close);
diff -r dbe8a35dcaf7 -r ae505684a995 drivers/xen/gntdev/gntdev.c
--- a/drivers/xen/gntdev/gntdev.c       Mon Apr 14 13:29:37 2008 -0600
+++ b/drivers/xen/gntdev/gntdev.c       Tue Apr 15 11:10:27 2008 -0600
@@ -555,7 +555,7 @@ static int gntdev_mmap (struct file *fli
     
        /* The VM area contains pages from another VM. */
        vma->vm_flags |= VM_FOREIGN;
-       vma->vm_private_data = kzalloc(size * sizeof(struct page_struct *), 
+       vma->vm_private_data = kzalloc(size * sizeof(struct page *),
                                       GFP_KERNEL);
        if (vma->vm_private_data == NULL) {
                printk(KERN_ERR "Couldn't allocate mapping structure for VM "
diff -r dbe8a35dcaf7 -r ae505684a995 drivers/xen/netfront/netfront.c
--- a/drivers/xen/netfront/netfront.c   Mon Apr 14 13:29:37 2008 -0600
+++ b/drivers/xen/netfront/netfront.c   Tue Apr 15 11:10:27 2008 -0600
@@ -366,10 +366,14 @@ static int talk_to_backend(struct xenbus
        struct xenbus_transaction xbt;
        int err;
 
-       err = xen_net_read_mac(dev, info->mac);
-       if (err) {
-               xenbus_dev_fatal(dev, err, "parsing %s/mac", dev->nodename);
-               goto out;
+       /* Read mac only in the first setup. */
+       if (!is_valid_ether_addr(info->mac)) {
+               err = xen_net_read_mac(dev, info->mac);
+               if (err) {
+                       xenbus_dev_fatal(dev, err, "parsing %s/mac",
+                                        dev->nodename);
+                       goto out;
+               }
        }
 
        /* Create shared ring, alloc event channel. */
@@ -1027,6 +1031,7 @@ static int network_start_xmit(struct sk_
 
        np->stats.tx_bytes += skb->len;
        np->stats.tx_packets++;
+       dev->trans_start = jiffies;
 
        /* Note: It is not safe to access skb after network_tx_buf_gc()! */
        network_tx_buf_gc(dev);
@@ -1059,6 +1064,7 @@ static irqreturn_t netif_int(int irq, vo
                        netfront_accelerator_call_stop_napi_irq(np, dev);
 
                        netif_rx_schedule(dev);
+                       dev->last_rx = jiffies;
                }
        }
 
@@ -1688,6 +1694,23 @@ static struct net_device_stats *network_
        return &np->stats;
 }
 
+static int xennet_set_mac_address(struct net_device *dev, void *p)
+{
+       struct netfront_info *np = netdev_priv(dev);
+       struct sockaddr *addr = p;
+
+       if (netif_running(dev))
+               return -EBUSY;
+
+       if (!is_valid_ether_addr(addr->sa_data))
+               return -EADDRNOTAVAIL;
+
+       memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
+       memcpy(np->mac, addr->sa_data, ETH_ALEN);
+
+       return 0;
+}
+
 static int xennet_change_mtu(struct net_device *dev, int mtu)
 {
        int max = xennet_can_sg(dev) ? 65535 - ETH_HLEN : ETH_DATA_LEN;
@@ -2075,6 +2098,7 @@ static struct net_device * __devinit cre
        netdev->poll            = netif_poll;
        netdev->set_multicast_list = network_set_multicast_list;
        netdev->uninit          = netif_uninit;
+       netdev->set_mac_address = xennet_set_mac_address;
        netdev->change_mtu      = xennet_change_mtu;
        netdev->weight          = 64;
        netdev->features        = NETIF_F_IP_CSUM;
@@ -2189,9 +2213,6 @@ static int __init netif_init(void)
                MODPARM_rx_flip = 1; /* Default is to flip. */
 #endif
 
-       if (is_initial_xendomain())
-               return 0;
-
        netif_init_accel();
 
        IPRINTK("Initialising virtual ethernet driver.\n");
@@ -2207,9 +2228,6 @@ module_init(netif_init);
 
 static void __exit netif_exit(void)
 {
-       if (is_initial_xendomain())
-               return;
-
 #ifdef CONFIG_INET
        unregister_inetaddr_notifier(&notifier_inetdev);
 #endif
diff -r dbe8a35dcaf7 -r ae505684a995 drivers/xen/xenbus/xenbus_probe.c
--- a/drivers/xen/xenbus/xenbus_probe.c Mon Apr 14 13:29:37 2008 -0600
+++ b/drivers/xen/xenbus/xenbus_probe.c Tue Apr 15 11:10:27 2008 -0600
@@ -347,6 +347,9 @@ static void xenbus_dev_shutdown(struct d
 
        DPRINTK("%s", dev->nodename);
 
+       if (is_initial_xendomain())
+               return;
+
        get_device(&dev->dev);
        if (dev->state != XenbusStateConnected) {
                printk("%s: %s: %s != Connected, skipping\n", __FUNCTION__,
diff -r dbe8a35dcaf7 -r ae505684a995 fs/binfmt_elf.c
--- a/fs/binfmt_elf.c   Mon Apr 14 13:29:37 2008 -0600
+++ b/fs/binfmt_elf.c   Tue Apr 15 11:10:27 2008 -0600
@@ -1170,6 +1170,10 @@ static int dump_seek(struct file *file, 
  */
 static int maydump(struct vm_area_struct *vma)
 {
+       /* The vma can be set up to tell us the answer directly.  */
+       if (vma->vm_flags & VM_ALWAYSDUMP)
+               return 1;
+
        /* Do not dump I/O mapped devices or special mappings */
        if (vma->vm_flags & (VM_IO | VM_RESERVED))
                return 0;
diff -r dbe8a35dcaf7 -r ae505684a995 fs/compat_ioctl.c
--- a/fs/compat_ioctl.c Mon Apr 14 13:29:37 2008 -0600
+++ b/fs/compat_ioctl.c Tue Apr 15 11:10:27 2008 -0600
@@ -124,10 +124,12 @@
 #include <linux/dvb/video.h>
 #include <linux/lp.h>
 
+#ifdef CONFIG_XEN
 #include <xen/interface/xen.h>
 #include <xen/public/evtchn.h>
 #include <xen/public/privcmd.h>
 #include <xen/compat_ioctl.h>
+#endif
 
 /* Aiee. Someone does not find a difference between int and long */
 #define EXT2_IOC32_GETFLAGS               _IOR('f', 1, int)
diff -r dbe8a35dcaf7 -r ae505684a995 include/asm-i386/acpi.h
--- a/include/asm-i386/acpi.h   Mon Apr 14 13:29:37 2008 -0600
+++ b/include/asm-i386/acpi.h   Tue Apr 15 11:10:27 2008 -0600
@@ -31,6 +31,9 @@
 #include <acpi/pdc_intel.h>
 
 #include <asm/system.h>                /* defines cmpxchg */
+#ifdef CONFIG_XEN
+#include <xen/interface/platform.h>
+#endif
 
 #define COMPILER_DEPENDENT_INT64   long long
 #define COMPILER_DEPENDENT_UINT64  unsigned long long
@@ -156,6 +159,27 @@ static inline void acpi_disable_pci(void
 }
 extern int acpi_irq_balance_set(char *str);
 
+#ifdef CONFIG_XEN
+static inline int acpi_notify_hypervisor_state(u8 sleep_state,
+                                              u32 pm1a_cnt_val,
+                                              u32 pm1b_cnt_val)
+{
+       struct xen_platform_op op = {
+               .cmd = XENPF_enter_acpi_sleep,
+               .interface_version = XENPF_INTERFACE_VERSION,
+               .u = {
+                       .enter_acpi_sleep = {
+                               .pm1a_cnt_val = pm1a_cnt_val,
+                               .pm1b_cnt_val = pm1b_cnt_val,
+                               .sleep_state = sleep_state,
+                       },
+               },
+       };
+
+       return HYPERVISOR_platform_op(&op);
+}
+#endif /* CONFIG_XEN */
+
 #else  /* !CONFIG_ACPI */
 
 #define acpi_lapic 0
@@ -177,10 +201,6 @@ extern unsigned long acpi_wakeup_address
 /* early initialization routine */
 extern void acpi_reserve_bootmem(void);
 
-#ifdef CONFIG_ACPI_PV_SLEEP
-extern int acpi_notify_hypervisor_state(u8 sleep_state,
-       u32 pm1a_cnt, u32 pm1b_cnt);
-#endif /* CONFIG_ACPI_PV_SLEEP */
 #endif /*CONFIG_ACPI_SLEEP*/
 
 extern u8 x86_acpiid_to_apicid[];
diff -r dbe8a35dcaf7 -r ae505684a995 include/asm-i386/elf.h
--- a/include/asm-i386/elf.h    Mon Apr 14 13:29:37 2008 -0600
+++ b/include/asm-i386/elf.h    Tue Apr 15 11:10:27 2008 -0600
@@ -169,50 +169,6 @@ do if (vdso_enabled) {                                     
        \
                NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_COMPAT_BASE); \
 } while (0)
 
-/*
- * These macros parameterize elf_core_dump in fs/binfmt_elf.c to write out
- * extra segments containing the vsyscall DSO contents.  Dumping its
- * contents makes post-mortem fully interpretable later without matching up
- * the same kernel and hardware config to see what PC values meant.
- * Dumping its extra ELF program headers includes all the other information
- * a debugger needs to easily find how the vsyscall DSO was being used.
- */
-#define ELF_CORE_EXTRA_PHDRS           (VDSO_HIGH_EHDR->e_phnum)
-#define ELF_CORE_WRITE_EXTRA_PHDRS                                           \
-do {                                                                         \
-       const struct elf_phdr *const vsyscall_phdrs =                         \
-               (const struct elf_phdr *) (VDSO_HIGH_BASE                     \
-                                          + VDSO_HIGH_EHDR->e_phoff);    \
-       int i;                                                                \
-       Elf32_Off ofs = 0;                                                    \
-       for (i = 0; i < VDSO_HIGH_EHDR->e_phnum; ++i) {               \
-               struct elf_phdr phdr = vsyscall_phdrs[i];                     \
-               if (phdr.p_type == PT_LOAD) {                                 \
-                       BUG_ON(ofs != 0);                                     \
-                       ofs = phdr.p_offset = offset;                         \
-                       phdr.p_memsz = PAGE_ALIGN(phdr.p_memsz);              \
-                       phdr.p_filesz = phdr.p_memsz;                         \
-                       offset += phdr.p_filesz;                              \
-               }                                                             \
-               else                                                          \
-                       phdr.p_offset += ofs;                                 \
-               phdr.p_paddr = 0; /* match other core phdrs */                \
-               DUMP_WRITE(&phdr, sizeof(phdr));                              \
-       }                                                                     \
-} while (0)
-#define ELF_CORE_WRITE_EXTRA_DATA                                            \
-do {                                                                         \
-       const struct elf_phdr *const vsyscall_phdrs =                         \
-               (const struct elf_phdr *) (VDSO_HIGH_BASE                     \
-                                          + VDSO_HIGH_EHDR->e_phoff);    \
-       int i;                                                                \
-       for (i = 0; i < VDSO_HIGH_EHDR->e_phnum; ++i) {               \
-               if (vsyscall_phdrs[i].p_type == PT_LOAD)                      \
-                       DUMP_WRITE((void *) vsyscall_phdrs[i].p_vaddr,        \
-                                  PAGE_ALIGN(vsyscall_phdrs[i].p_memsz));    \
-       }                                                                     \
-} while (0)
-
 #endif
 
 #endif
diff -r dbe8a35dcaf7 -r ae505684a995 include/asm-i386/mach-xen/asm/pgtable.h
--- a/include/asm-i386/mach-xen/asm/pgtable.h   Mon Apr 14 13:29:37 2008 -0600
+++ b/include/asm-i386/mach-xen/asm/pgtable.h   Tue Apr 15 11:10:27 2008 -0600
@@ -105,7 +105,7 @@ void paging_init(void);
 #define _PAGE_BIT_DIRTY                6
 #define _PAGE_BIT_PSE          7       /* 4 MB (or 2MB) page, Pentium+, if 
present.. */
 #define _PAGE_BIT_GLOBAL       8       /* Global TLB entry PPro+ */
-#define _PAGE_BIT_UNUSED1      9       /* available for programmer */
+/*#define _PAGE_BIT_UNUSED1    9*/     /* available for programmer */
 #define _PAGE_BIT_UNUSED2      10
 #define _PAGE_BIT_UNUSED3      11
 #define _PAGE_BIT_NX           63
@@ -119,7 +119,7 @@ void paging_init(void);
 #define _PAGE_DIRTY    0x040
 #define _PAGE_PSE      0x080   /* 4 MB (or 2MB) page, Pentium+, if present.. */
 #define _PAGE_GLOBAL   0x100   /* Global TLB entry PPro+ */
-#define _PAGE_UNUSED1  0x200   /* available for programmer */
+/*#define _PAGE_UNUSED1        0x200*/ /* available for programmer */
 #define _PAGE_UNUSED2  0x400
 #define _PAGE_UNUSED3  0x800
 
diff -r dbe8a35dcaf7 -r ae505684a995 include/asm-x86_64/acpi.h
--- a/include/asm-x86_64/acpi.h Mon Apr 14 13:29:37 2008 -0600
+++ b/include/asm-x86_64/acpi.h Tue Apr 15 11:10:27 2008 -0600
@@ -28,6 +28,9 @@
 
 #ifdef __KERNEL__
 
+#ifdef CONFIG_XEN
+#include <xen/interface/platform.h>
+#endif
 #include <acpi/pdc_intel.h>
 
 #define COMPILER_DEPENDENT_INT64   long long
@@ -129,6 +132,27 @@ static inline void acpi_disable_pci(void
 }
 extern int acpi_irq_balance_set(char *str);
 
+#ifdef CONFIG_XEN
+static inline int acpi_notify_hypervisor_state(u8 sleep_state,
+                                              u32 pm1a_cnt_val,
+                                              u32 pm1b_cnt_val)
+{
+       struct xen_platform_op op = {
+               .cmd = XENPF_enter_acpi_sleep,
+               .interface_version = XENPF_INTERFACE_VERSION,
+               .u = {
+                       .enter_acpi_sleep = {
+                               .pm1a_cnt_val = pm1a_cnt_val,
+                               .pm1b_cnt_val = pm1b_cnt_val,
+                               .sleep_state = sleep_state,
+                       },
+               },
+       };
+
+       return HYPERVISOR_platform_op(&op);
+}
+#endif /* CONFIG_XEN */
+
 #else  /* !CONFIG_ACPI */
 
 #define acpi_lapic 0
@@ -152,11 +176,6 @@ extern unsigned long acpi_wakeup_address
 
 /* early initialization routine */
 extern void acpi_reserve_bootmem(void);
-
-#ifdef CONFIG_ACPI_PV_SLEEP
-extern int acpi_notify_hypervisor_state(u8 sleep_state,
-       u32 pm1a_cnt, u32 pm1b_cnt);
-#endif /* CONFIG_ACPI_PV_SLEEP */
 #endif /*CONFIG_ACPI_SLEEP*/
 
 #define boot_cpu_physical_apicid boot_cpu_id
diff -r dbe8a35dcaf7 -r ae505684a995 include/linux/mm.h
--- a/include/linux/mm.h        Mon Apr 14 13:29:37 2008 -0600
+++ b/include/linux/mm.h        Tue Apr 15 11:10:27 2008 -0600
@@ -167,6 +167,7 @@ extern unsigned int kobjsize(const void 
 #ifdef CONFIG_XEN
 #define VM_FOREIGN     0x04000000      /* Has pages belonging to another VM */
 #endif
+#define VM_ALWAYSDUMP  0x08000000      /* Always include in core dumps */
 
 #ifndef VM_STACK_DEFAULT_FLAGS         /* arch can override this */
 #define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.