# HG changeset patch
# User Jeremy Fitzhardinge <jeremy@xxxxxxxxxxxxx>
# Date 1180000138 -3600
# Node ID 03c213fd2360e2b5e825108140dd4bc8b0b6936f
# Parent 020530a6ff5c24c3a8289f8f687ce2f10aff5ca7
# Parent 297d98f057e83f37e9aee1177d32eb5fe971710d
merged
---
linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c | 29 ++++++++++++++++++-
linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c | 29 ++++++++++++++++++-
tools/blktap/lib/Makefile | 4 +-
xen/arch/x86/traps.c | 30 +++++++++++++-------
4 files changed, 78 insertions(+), 14 deletions(-)
diff -r 020530a6ff5c -r 03c213fd2360
linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c
--- a/linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c Thu May 24 10:47:27
2007 +0100
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c Thu May 24 10:48:58
2007 +0100
@@ -1583,6 +1583,7 @@ void __init setup_arch(char **cmdline_p)
int i, j, k, fpp;
struct physdev_set_iopl set_iopl;
unsigned long max_low_pfn;
+ unsigned long p2m_pages;
/* Force a quick death if the kernel panics (not domain 0). */
extern int panic_timeout;
@@ -1725,6 +1726,32 @@ void __init setup_arch(char **cmdline_p)
find_smp_config();
#endif
+ p2m_pages = max_pfn;
+ if (xen_start_info->nr_pages > max_pfn) {
+ /*
+ * the max_pfn was shrunk (probably by mem= or highmem=
+ * kernel parameter); shrink reservation with the HV
+ */
+ struct xen_memory_reservation reservation = {
+ .address_bits = 0,
+ .extent_order = 0,
+ .domid = DOMID_SELF
+ };
+ unsigned int difference;
+ int ret;
+
+ difference = xen_start_info->nr_pages - max_pfn;
+
+ set_xen_guest_handle(reservation.extent_start,
+ ((unsigned long
*)xen_start_info->mfn_list) + max_pfn);
+ reservation.nr_extents = difference;
+ ret = HYPERVISOR_memory_op(XENMEM_decrease_reservation,
+ &reservation);
+ BUG_ON (ret != difference);
+ }
+ else if (max_pfn > xen_start_info->nr_pages)
+ p2m_pages = xen_start_info->nr_pages;
+
/* Make sure we have a correctly sized P->M table. */
if (!xen_feature(XENFEAT_auto_translated_physmap)) {
phys_to_machine_mapping = alloc_bootmem_low_pages(
@@ -1733,7 +1760,7 @@ void __init setup_arch(char **cmdline_p)
max_pfn * sizeof(unsigned long));
memcpy(phys_to_machine_mapping,
(unsigned long *)xen_start_info->mfn_list,
- xen_start_info->nr_pages * sizeof(unsigned long));
+ p2m_pages * sizeof(unsigned long));
free_bootmem(
__pa(xen_start_info->mfn_list),
PFN_PHYS(PFN_UP(xen_start_info->nr_pages *
diff -r 020530a6ff5c -r 03c213fd2360
linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c
--- a/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c Thu May 24
10:47:27 2007 +0100
+++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c Thu May 24
10:48:58 2007 +0100
@@ -792,6 +792,33 @@ void __init setup_arch(char **cmdline_p)
#ifdef CONFIG_XEN
{
int i, j, k, fpp;
+ unsigned long p2m_pages;
+
+ p2m_pages = end_pfn;
+ if (xen_start_info->nr_pages > end_pfn) {
+ /*
+ * the end_pfn was shrunk (probably by mem= or highmem=
+ * kernel parameter); shrink reservation with the HV
+ */
+ struct xen_memory_reservation reservation = {
+ .address_bits = 0,
+ .extent_order = 0,
+ .domid = DOMID_SELF
+ };
+ unsigned int difference;
+ int ret;
+
+ difference = xen_start_info->nr_pages - end_pfn;
+
+ set_xen_guest_handle(reservation.extent_start,
+ ((unsigned long
*)xen_start_info->mfn_list) + end_pfn);
+ reservation.nr_extents = difference;
+ ret = HYPERVISOR_memory_op(XENMEM_decrease_reservation,
+ &reservation);
+ BUG_ON (ret != difference);
+ }
+ else if (end_pfn > xen_start_info->nr_pages)
+ p2m_pages = xen_start_info->nr_pages;
if (!xen_feature(XENFEAT_auto_translated_physmap)) {
/* Make sure we have a large enough P->M table. */
@@ -801,7 +828,7 @@ void __init setup_arch(char **cmdline_p)
end_pfn * sizeof(unsigned long));
memcpy(phys_to_machine_mapping,
(unsigned long *)xen_start_info->mfn_list,
- xen_start_info->nr_pages * sizeof(unsigned
long));
+ p2m_pages * sizeof(unsigned long));
free_bootmem(
__pa(xen_start_info->mfn_list),
PFN_PHYS(PFN_UP(xen_start_info->nr_pages *
diff -r 020530a6ff5c -r 03c213fd2360 tools/blktap/lib/Makefile
--- a/tools/blktap/lib/Makefile Thu May 24 10:47:27 2007 +0100
+++ b/tools/blktap/lib/Makefile Thu May 24 10:48:58 2007 +0100
@@ -42,10 +42,10 @@ install: all
install: all
$(INSTALL_DIR) $(DESTDIR)/usr/$(LIBDIR)
$(INSTALL_DIR) $(DESTDIR)/usr/include
- $(INSTALL_PROG) $(LIB) $(DESTDIR)/usr/$(LIBDIR)
+ $(INSTALL_DATA) $(LIB) $(DESTDIR)/usr/$(LIBDIR)
ln -sf libblktap.so.$(MAJOR).$(MINOR)
$(DESTDIR)/usr/$(LIBDIR)/libblktap.so.$(MAJOR)
ln -sf libblktap.so.$(MAJOR) $(DESTDIR)/usr/$(LIBDIR)/libblktap.so
- $(INSTALL_PROG) blktaplib.h $(DESTDIR)/usr/include
+ $(INSTALL_DATA) blktaplib.h $(DESTDIR)/usr/include
clean:
rm -rf *.a *.so* *.o *.rpm $(LIB) *~ $(DEPS) xen TAGS
diff -r 020530a6ff5c -r 03c213fd2360 xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c Thu May 24 10:47:27 2007 +0100
+++ b/xen/arch/x86/traps.c Thu May 24 10:48:58 2007 +0100
@@ -345,16 +345,26 @@ char *trapstr(int trapnr)
*/
asmlinkage void fatal_trap(int trapnr, struct cpu_user_regs *regs)
{
- watchdog_disable();
- console_start_sync();
-
- show_execution_state(regs);
-
- if ( trapnr == TRAP_page_fault )
- {
- unsigned long cr2 = read_cr2();
- printk("Faulting linear address: %p\n", _p(cr2));
- show_page_walk(cr2);
+ static DEFINE_PER_CPU(char, depth);
+
+ /*
+ * In some cases, we can end up in a vicious cycle of fatal_trap()s
+ * within fatal_trap()s. We give the problem a couple of iterations to
+ * bottom out, and then we just panic.
+ */
+ if ( ++this_cpu(depth) < 3 )
+ {
+ watchdog_disable();
+ console_start_sync();
+
+ show_execution_state(regs);
+
+ if ( trapnr == TRAP_page_fault )
+ {
+ unsigned long cr2 = read_cr2();
+ printk("Faulting linear address: %p\n", _p(cr2));
+ show_page_walk(cr2);
+ }
}
panic("FATAL TRAP: vector = %d (%s)\n"
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|