Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 27922b4260f65d317aabda37e42bbbff > files > 1492

kernel-2.6.18-238.el5.src.rpm

From: Doug Chapman <dchapman@redhat.com>
Date: Thu, 14 Aug 2008 14:59:01 -0400
Subject: [ia64] kdump: implement greater than 4G mem restriction
Message-id: 1218740341.5072.6.camel@oberon
O-Subject: Re: [RHEL5 PATCH]: ia64 systems >4G kdump memory restriction
Bugzilla: 446188
RH-Acked-by: Vivek Goyal <vgoyal@redhat.com>
RH-Acked-by: Prarit Bhargava <prarit@redhat.com>

Backport of

http://marc.info/?l=git-commits-head&m=121088524228704&w=2

and removal of "machvec=dig" WAR from BZ 218487 comment #13.

>From the upstream commit:

"Some IA64 machines map all cell-local memory above 4 GB (32 bit limit).
 However, in most cases, the kernel needs some memory below that limit that
is
 DMA-capable. So in this machine configuration, the crashkernel will be
reserved
 above 4 GB.

 For machines that use SWIOTLB implementation because they lack an I/O MMU
 the low memory is required by the SWIOTLB implementation. In that case,
 it doesn't make sense to reserve the crashkernel at all because it's
unusable
 for kdump."

Successfully tested by myself and dchapman.

Resolves BZ 446188.
=====

I did some testing on a modified version of this patch.  This includes
the 4G stuff that prarit was adding (for SGI systems iirc?) but this
patch does not pull out the stuff that HP needs (and is now upstream).

I have tested this on various HP systems with success.  I don't see any
compile warnings with this.

- Doug

diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index 3ff12e9..3b5949c 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -62,7 +62,6 @@
 #include <asm/system.h>
 #include <asm/unistd.h>
 #include <asm/system.h>
-#include <asm/kexec.h>
 #ifdef CONFIG_XEN
 #include <asm/hypervisor.h>
 #include <asm/xen/xencomm.h>
@@ -301,6 +300,26 @@ static int __init register_memory(void)
 
 __initcall(register_memory);
 
+/*
+ * This function checks if the reserved crashkernel is allowed on the specific
+ * IA64 machine flavour. Machines without an IO TLB use swiotlb and require
+ * some memory below 4 GB (i.e. in 32 bit area), see the implementation of
+ * lib/swiotlb.c. The hpzx1 architecture has an IO TLB but cannot use that
+ * in kdump case. See the comment in sba_init() in sba_iommu.c.
+ *
+ * So, the only machvec that really supports loading the kdump kernel
+ * over 4 GB is "sn2".
+ */
+static int __init check_crashkernel_memory(unsigned long pbase, size_t size)
+{
+       if (ia64_platform_is("sn2"))
+               return 1;
+       else {
+	       printk("%s: pbase = %0lx\n", __FUNCTION__, pbase);
+               return pbase < (1UL << 32);
+       }
+}
+
 /**
  * reserve_memory - setup reserved memory areas
  *
@@ -367,7 +386,18 @@ reserve_memory (void)
 			if (size) {
 				sort_regions(rsvd_region, n);
 				base = kdump_find_rsvd_region(size,
-				rsvd_region, n);
+							      rsvd_region, n);
+				printk("%s: base = %0lx\n", __FUNCTION__, base);
+				if (!check_crashkernel_memory(base,size)) {
+					printk("crashkernel: There would be "
+					       "kdump memory at %ld GB but "
+					       "this is unusable because it "
+					       "must\nbe below 4 GB. Change "
+					       "the memory configuration of "
+					       "of the machine.\n",
+					       (unsigned long)(base >> 30));
+					return;
+				}
 				if (base != ~0UL) {
 					rsvd_region[n].start =
 						(unsigned long)__va(base);