Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / kernel_patches / patches / 3.5G-address-space-2.4.22-vanilla.patch
1  Rules.make                     |   17 +++++++
2  arch/i386/Makefile             |    4 +
3  arch/i386/config.in            |   10 ++++
4  arch/i386/vmlinux.lds          |   99 -----------------------------------------
5  arch/i386/vmlinux.lds.S        |   99 +++++++++++++++++++++++++++++++++++++++++
6  include/asm-i386/page.h        |    4 +
7  include/asm-i386/page_offset.h |   10 ++++
8  include/asm-i386/processor.h   |    4 +
9  mm/memory.c                    |   23 +++++++--
10  9 files changed, 165 insertions(+), 105 deletions(-)
11
12 Index: linux-2.4.22-vanilla/arch/i386/config.in
13 ===================================================================
14 --- linux-2.4.22-vanilla.orig/arch/i386/config.in       2003-12-02 23:55:28.000000000 +0300
15 +++ linux-2.4.22-vanilla/arch/i386/config.in    2003-12-15 23:09:28.000000000 +0300
16 @@ -212,6 +212,16 @@
17  fi
18  if [ "$CONFIG_HIGHMEM64G" = "y" ]; then
19     define_bool CONFIG_X86_PAE y
20 +   choice 'User address space size' \
21 +       "3GB            CONFIG_1GB \
22 +        2GB            CONFIG_2GB \
23 +        1GB            CONFIG_3GB" 3GB
24 +else
25 +   choice 'User address space size' \
26 +       "3GB            CONFIG_1GB \
27 +        2GB            CONFIG_2GB \
28 +        1GB            CONFIG_3GB \
29 +        3.5GB          CONFIG_05GB" 3GB
30  fi
31  
32  if [ "$CONFIG_HIGHMEM" = "y" ]; then
33 Index: linux-2.4.22-vanilla/arch/i386/Makefile
34 ===================================================================
35 --- linux-2.4.22-vanilla.orig/arch/i386/Makefile        2003-11-03 22:50:58.000000000 +0300
36 +++ linux-2.4.22-vanilla/arch/i386/Makefile     2003-12-15 23:09:28.000000000 +0300
37 @@ -114,6 +114,9 @@
38  
39  MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
40  
41 +arch/i386/vmlinux.lds: arch/i386/vmlinux.lds.S FORCE
42 +       $(CPP) -C -P -I$(HPATH) -imacros $(HPATH)/asm-i386/page_offset.h -Ui386 arch/i386/vmlinux.lds.S >arch/i386/vmlinux.lds
43 +
44  vmlinux: arch/i386/vmlinux.lds
45  
46  FORCE: ;
47 @@ -150,6 +153,7 @@
48         @$(MAKEBOOT) clean
49  
50  archmrproper:
51 +       rm -f arch/i386/vmlinux.lds
52  
53  archdep:
54         @$(MAKEBOOT) dep
55 Index: linux-2.4.22-vanilla/arch/i386/vmlinux.lds.S
56 ===================================================================
57 --- linux-2.4.22-vanilla.orig/arch/i386/vmlinux.lds.S   2003-01-30 13:24:37.000000000 +0300
58 +++ linux-2.4.22-vanilla/arch/i386/vmlinux.lds.S        2003-12-15 23:10:46.000000000 +0300
59 @@ -0,0 +1,83 @@
60 +/* ld script to make i386 Linux kernel
61 + * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>;
62 + */
63 +OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
64 +OUTPUT_ARCH(i386)
65 +ENTRY(_start)
66 +SECTIONS
67 +{
68 +  . = PAGE_OFFSET_RAW + 0x100000;
69 +  _text = .;                   /* Text and read-only data */
70 +  .text : {
71 +       *(.text)
72 +       *(.fixup)
73 +       *(.gnu.warning)
74 +       } = 0x9090
75 +
76 +  _etext = .;                  /* End of text section */
77 +
78 +  .rodata : { *(.rodata) *(.rodata.*) }
79 +  .kstrtab : { *(.kstrtab) }
80 +
81 +  . = ALIGN(16);               /* Exception table */
82 +  __start___ex_table = .;
83 +  __ex_table : { *(__ex_table) }
84 +  __stop___ex_table = .;
85 +
86 +  __start___ksymtab = .;       /* Kernel symbol table */
87 +  __ksymtab : { *(__ksymtab) }
88 +  __stop___ksymtab = .;
89 +
90 +  .data : {                    /* Data */
91 +       *(.data)
92 +       CONSTRUCTORS
93 +       }
94 +
95 +  _edata = .;                  /* End of data section */
96 +
97 +/* chose the biggest of the possible stack sizes here? */
98 +  . = ALIGN(65536);            /* init_task */
99 +  .data.init_task : { *(.data.init_task) }
100 +
101 +  . = ALIGN(4096);             /* Init code and data */
102 +  __init_begin = .;
103 +  .text.init : { *(.text.init) }
104 +  .data.init : { *(.data.init) }
105 +  . = ALIGN(16);
106 +  __setup_start = .;
107 +  .setup.init : { *(.setup.init) }
108 +  __setup_end = .;
109 +  __initcall_start = .;
110 +  .initcall.init : { *(.initcall.init) }
111 +  __initcall_end = .;
112 +  . = ALIGN(4096);
113 +  __init_end = .;
114 +
115 +  . = ALIGN(4096);
116 +  .data.page_aligned : { *(.data.idt) }
117 +
118 +  . = ALIGN(32);
119 +  .data.cacheline_aligned : { *(.data.cacheline_aligned) }
120 +
121 +  __bss_start = .;             /* BSS */
122 +  .bss : {
123 +       *(.bss)
124 +       }
125 +  _end = . ;
126 +
127 +  /* Sections to be discarded */
128 +  /DISCARD/ : {
129 +       *(.text.exit)
130 +       *(.data.exit)
131 +       *(.exitcall.exit)
132 +       }
133 +
134 +  /* Stabs debugging sections.  */
135 +  .stab 0 : { *(.stab) }
136 +  .stabstr 0 : { *(.stabstr) }
137 +  .stab.excl 0 : { *(.stab.excl) }
138 +  .stab.exclstr 0 : { *(.stab.exclstr) }
139 +  .stab.index 0 : { *(.stab.index) }
140 +  .stab.indexstr 0 : { *(.stab.indexstr) }
141 +  .comment 0 : { *(.comment) }
142 +}
143 Index: linux-2.4.22-vanilla/arch/i386/vmlinux.lds
144 ===================================================================
145 --- linux-2.4.22-vanilla.orig/arch/i386/vmlinux.lds     2003-12-15 23:17:09.000000000 +0300
146 +++ linux-2.4.22-vanilla/arch/i386/vmlinux.lds  2003-01-30 13:24:37.000000000 +0300
147 @@ -1,83 +0,0 @@
148 -/* ld script to make i386 Linux kernel
149 - * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>;
150 - */
151 -OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
152 -OUTPUT_ARCH(i386)
153 -ENTRY(_start)
154 -SECTIONS
155 -{
156 -  . = 0xC0000000 + 0x100000;
157 -  _text = .;                   /* Text and read-only data */
158 -  .text : {
159 -       *(.text)
160 -       *(.fixup)
161 -       *(.gnu.warning)
162 -       } = 0x9090
163 -
164 -  _etext = .;                  /* End of text section */
165 -
166 -  .rodata : { *(.rodata) *(.rodata.*) }
167 -  .kstrtab : { *(.kstrtab) }
168 -
169 -  . = ALIGN(16);               /* Exception table */
170 -  __start___ex_table = .;
171 -  __ex_table : { *(__ex_table) }
172 -  __stop___ex_table = .;
173 -
174 -  __start___ksymtab = .;       /* Kernel symbol table */
175 -  __ksymtab : { *(__ksymtab) }
176 -  __stop___ksymtab = .;
177 -
178 -  .data : {                    /* Data */
179 -       *(.data)
180 -       CONSTRUCTORS
181 -       }
182 -
183 -  _edata = .;                  /* End of data section */
184 -
185 -/* chose the biggest of the possible stack sizes here? */
186 -  . = ALIGN(65536);            /* init_task */
187 -  .data.init_task : { *(.data.init_task) }
188 -
189 -  . = ALIGN(4096);             /* Init code and data */
190 -  __init_begin = .;
191 -  .text.init : { *(.text.init) }
192 -  .data.init : { *(.data.init) }
193 -  . = ALIGN(16);
194 -  __setup_start = .;
195 -  .setup.init : { *(.setup.init) }
196 -  __setup_end = .;
197 -  __initcall_start = .;
198 -  .initcall.init : { *(.initcall.init) }
199 -  __initcall_end = .;
200 -  . = ALIGN(4096);
201 -  __init_end = .;
202 -
203 -  . = ALIGN(4096);
204 -  .data.page_aligned : { *(.data.idt) }
205 -
206 -  . = ALIGN(32);
207 -  .data.cacheline_aligned : { *(.data.cacheline_aligned) }
208 -
209 -  __bss_start = .;             /* BSS */
210 -  .bss : {
211 -       *(.bss)
212 -       }
213 -  _end = . ;
214 -
215 -  /* Sections to be discarded */
216 -  /DISCARD/ : {
217 -       *(.text.exit)
218 -       *(.data.exit)
219 -       *(.exitcall.exit)
220 -       }
221 -
222 -  /* Stabs debugging sections.  */
223 -  .stab 0 : { *(.stab) }
224 -  .stabstr 0 : { *(.stabstr) }
225 -  .stab.excl 0 : { *(.stab.excl) }
226 -  .stab.exclstr 0 : { *(.stab.exclstr) }
227 -  .stab.index 0 : { *(.stab.index) }
228 -  .stab.indexstr 0 : { *(.stab.indexstr) }
229 -  .comment 0 : { *(.comment) }
230 -}
231 Index: linux-2.4.22-vanilla/include/asm-i386/page.h
232 ===================================================================
233 --- linux-2.4.22-vanilla.orig/include/asm-i386/page.h   2003-11-03 23:51:46.000000000 +0300
234 +++ linux-2.4.22-vanilla/include/asm-i386/page.h        2003-12-15 23:09:28.000000000 +0300
235 @@ -78,7 +78,9 @@
236   * and CONFIG_HIGHMEM64G options in the kernel configuration.
237   */
238  
239 -#define __PAGE_OFFSET          (0xC0000000)
240 +#include <asm/page_offset.h>
241 +
242 +#define __PAGE_OFFSET          (PAGE_OFFSET_RAW)
243  
244  /*
245   * This much address space is reserved for vmalloc() and iomap()
246 Index: linux-2.4.22-vanilla/include/asm-i386/page_offset.h
247 ===================================================================
248 --- linux-2.4.22-vanilla.orig/include/asm-i386/page_offset.h    2003-01-30 13:24:37.000000000 +0300
249 +++ linux-2.4.22-vanilla/include/asm-i386/page_offset.h 2003-12-15 23:09:28.000000000 +0300
250 @@ -0,0 +1,10 @@
251 +#include <linux/config.h>
252 +#ifdef CONFIG_05GB
253 +#define PAGE_OFFSET_RAW 0xE0000000
254 +#elif defined(CONFIG_1GB)
255 +#define PAGE_OFFSET_RAW 0xC0000000
256 +#elif defined(CONFIG_2GB)
257 +#define PAGE_OFFSET_RAW 0x80000000
258 +#elif defined(CONFIG_3GB)
259 +#define PAGE_OFFSET_RAW 0x40000000
260 +#endif
261 Index: linux-2.4.22-vanilla/include/asm-i386/processor.h
262 ===================================================================
263 --- linux-2.4.22-vanilla.orig/include/asm-i386/processor.h      2003-12-02 23:55:28.000000000 +0300
264 +++ linux-2.4.22-vanilla/include/asm-i386/processor.h   2003-12-15 23:09:28.000000000 +0300
265 @@ -265,7 +265,11 @@
266  /* This decides where the kernel will search for a free chunk of vm
267   * space during mmap's.
268   */
269 +#ifndef CONFIG_05GB
270  #define TASK_UNMAPPED_BASE     (TASK_SIZE / 3)
271 +#else
272 +#define TASK_UNMAPPED_BASE     (TASK_SIZE / 16)
273 +#endif
274  
275  /*
276   * Size of io_bitmap in longwords: 32 is ports 0-0x3ff.
277 Index: linux-2.4.22-vanilla/mm/memory.c
278 ===================================================================
279 --- linux-2.4.22-vanilla.orig/mm/memory.c       2003-05-16 05:29:15.000000000 +0400
280 +++ linux-2.4.22-vanilla/mm/memory.c    2003-12-15 23:09:28.000000000 +0300
281 @@ -108,8 +108,7 @@
282  
283  static inline void free_one_pgd(pgd_t * dir)
284  {
285 -       int j;
286 -       pmd_t * pmd;
287 +       pmd_t * pmd, * md, * emd;
288  
289         if (pgd_none(*dir))
290                 return;
291 @@ -120,9 +119,23 @@
292         }
293         pmd = pmd_offset(dir, 0);
294         pgd_clear(dir);
295 -       for (j = 0; j < PTRS_PER_PMD ; j++) {
296 -               prefetchw(pmd+j+(PREFETCH_STRIDE/16));
297 -               free_one_pmd(pmd+j);
298 +
299 +       /*
300 +        * Beware if changing the loop below.  It once used int j,
301 +        *      for (j = 0; j < PTRS_PER_PMD; j++)
302 +        *              free_one_pmd(pmd+j);
303 +        * but some older i386 compilers (e.g. egcs-2.91.66, gcc-2.95.3)
304 +        * terminated the loop with a _signed_ address comparison
305 +        * using "jle", when configured for HIGHMEM64GB (X86_PAE).
306 +        * If also configured for 3GB of kernel virtual address space,
307 +        * if page at physical 0x3ffff000 virtual 0x7ffff000 is used as
308 +        * a pmd, when that mm exits the loop goes on to free "entries"
309 +        * found at 0x80000000 onwards.  The loop below compiles instead
310 +        * to be terminated by unsigned address comparison using "jb".
311 +        */
312 +       for (md = pmd, emd = pmd + PTRS_PER_PMD; md < emd; md++) {
313 +               prefetchw(md+(PREFETCH_STRIDE/16));
314 +               free_one_pmd(md);
315         }
316         pmd_free(pmd);
317  }
318 Index: linux-2.4.22-vanilla/Rules.make
319 ===================================================================
320 --- linux-2.4.22-vanilla.orig/Rules.make        2003-05-16 05:28:27.000000000 +0400
321 +++ linux-2.4.22-vanilla/Rules.make     2003-12-15 23:09:28.000000000 +0300
322 @@ -215,6 +215,7 @@
323  #
324  # Added the SMP separator to stop module accidents between uniprocessor
325  # and SMP Intel boxes - AC - from bits by Michael Chastain
326 +# Added separator for different PAGE_OFFSET memory models - Ingo.
327  #
328  
329  ifdef CONFIG_SMP
330 @@ -223,6 +224,22 @@
331         genksyms_smp_prefix := 
332  endif
333  
334 +ifdef CONFIG_2GB
335 +ifdef CONFIG_SMP
336 +       genksyms_smp_prefix := -p smp_2gig_
337 +else
338 +       genksyms_smp_prefix := -p 2gig_
339 +endif
340 +endif
341 +
342 +ifdef CONFIG_3GB
343 +ifdef CONFIG_SMP
344 +       genksyms_smp_prefix := -p smp_3gig_
345 +else
346 +       genksyms_smp_prefix := -p 3gig_
347 +endif
348 +endif
349 +
350  $(MODINCL)/%.ver: %.c
351         @if [ ! -r $(MODINCL)/$*.stamp -o $(MODINCL)/$*.stamp -ot $< ]; then \
352                 echo '$(CC) $(CFLAGS) $(EXTRA_CFLAGS_nostdinc) -E -D__GENKSYMS__ $<'; \