mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] x86_32 cleanup: KERNEL_IMAGE_SIZE
@ 2011-02-27 21:21 Stratos Psomadakis
  2011-02-27 21:21 ` [PATCH 1/2] Remove KERNEL_IMAGE_SIZE for x86_32 code(no longer used) Stratos Psomadakis
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stratos Psomadakis @ 2011-02-27 21:21 UTC (permalink / raw)
  To: linux-kernel; +Cc: Stratos Psomadakis

I noticed that KERNEL_IMAGE_SIZE is no longer used by x86_32 code
(head_32.S no longer uses it for the initial kernel mapping).

We can thus remove the assert from the vmlinux.lds.S file, and 
remove it completely for x86_32 code. 

Since head_32.S doesn't use it anymore, I can't find a reason 
why we should impose such a limit on the kernel image size
(although a 512+MB kernel image isn't what one would call a realistic
scenario :P)

I think that a limit on the size of the image is imposed anyway
by decompress_kernel()(if I understood correctly).

I also updated the comments in head_32.S which still had references
to KERNEL_IMAGE_SIZE.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] Remove KERNEL_IMAGE_SIZE for x86_32 code(no longer used)
  2011-02-27 21:21 [PATCH 0/2] x86_32 cleanup: KERNEL_IMAGE_SIZE Stratos Psomadakis
@ 2011-02-27 21:21 ` Stratos Psomadakis
  2011-02-27 21:21 ` [PATCH 2/2] head_32.S: Update the comments for the initial kernel mapping(KERNEL_IMAGE_SIZE no " Stratos Psomadakis
  2011-02-28 19:58 ` [PATCH 0/2] x86_32 cleanup: KERNEL_IMAGE_SIZE Stratos Psomadakis
  2 siblings, 0 replies; 4+ messages in thread
From: Stratos Psomadakis @ 2011-02-27 21:21 UTC (permalink / raw)
  To: linux-kernel; +Cc: Stratos Psomadakis

KERNEL_IMAGE_SIZE is no longer used by head_32.S for the kernel mapping, and thus
it is no longer needed. 

Remove its definition from page_32_types.h, and the assert from the vmlinux.lds.S 
for the 32bit executable.

Signed-off-by: Stratos Psomadakis <psomas@cslab.ece.ntua.gr>
---
 arch/x86/include/asm/page_32_types.h |    5 -----
 arch/x86/kernel/vmlinux.lds.S        |   13 ++++---------
 2 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/arch/x86/include/asm/page_32_types.h b/arch/x86/include/asm/page_32_types.h
index ade619f..ec5c104 100644
--- a/arch/x86/include/asm/page_32_types.h
+++ b/arch/x86/include/asm/page_32_types.h
@@ -35,11 +35,6 @@
 #define __VIRTUAL_MASK_SHIFT	32
 #endif	/* CONFIG_X86_PAE */
 
-/*
- * Kernel image size is limited to 512 MB (see in arch/x86/kernel/head_32.S)
- */
-#define KERNEL_IMAGE_SIZE	(512 * 1024 * 1024)
-
 #ifndef __ASSEMBLY__
 
 /*
diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index bf47007..3f8d8e7 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -362,13 +362,7 @@ SECTIONS
 }
 
 
-#ifdef CONFIG_X86_32
-/*
- * The ASSERT() sink to . is intentional, for binutils 2.14 compatibility:
- */
-. = ASSERT((_end - LOAD_OFFSET <= KERNEL_IMAGE_SIZE),
-	   "kernel image bigger than KERNEL_IMAGE_SIZE");
-#else
+#ifdef CONFIG_X86_64
 /*
  * Per-cpu symbols which need to be offset from __per_cpu_load
  * for the boot processor.
@@ -378,7 +372,8 @@ INIT_PER_CPU(gdt_page);
 INIT_PER_CPU(irq_stack_union);
 
 /*
- * Build-time check on the image size:
+ * Build-time check on the image size.
+ * The ASSERT() sink to . is intentional, for binutils 2.14 compatibility.
  */
 . = ASSERT((_end - _text <= KERNEL_IMAGE_SIZE),
 	   "kernel image bigger than KERNEL_IMAGE_SIZE");
@@ -388,7 +383,7 @@ INIT_PER_CPU(irq_stack_union);
            "irq_stack_union is not at start of per-cpu area");
 #endif
 
-#endif /* CONFIG_X86_32 */
+#endif /* CONFIG_X86_64 */
 
 #ifdef CONFIG_KEXEC
 #include <asm/kexec.h>
-- 
1.7.4.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] head_32.S: Update the comments for the initial kernel mapping(KERNEL_IMAGE_SIZE no longer used)
  2011-02-27 21:21 [PATCH 0/2] x86_32 cleanup: KERNEL_IMAGE_SIZE Stratos Psomadakis
  2011-02-27 21:21 ` [PATCH 1/2] Remove KERNEL_IMAGE_SIZE for x86_32 code(no longer used) Stratos Psomadakis
@ 2011-02-27 21:21 ` Stratos Psomadakis
  2011-02-28 19:58 ` [PATCH 0/2] x86_32 cleanup: KERNEL_IMAGE_SIZE Stratos Psomadakis
  2 siblings, 0 replies; 4+ messages in thread
From: Stratos Psomadakis @ 2011-02-27 21:21 UTC (permalink / raw)
  To: linux-kernel; +Cc: Stratos Psomadakis

Update the comments regarding the initial kernel mapping in head_32.S and 
cleanup the code(KERNEL_IMAGE_SIZE no longer used).

Signed-off-by: Stratos Psomadakis <psomas@cslab.ece.ntua.gr>
---
 arch/x86/kernel/head_32.S |   44 +++++++++++++++++---------------------------
 1 files changed, 17 insertions(+), 27 deletions(-)

diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
index 187aa63..77990a5 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -39,42 +39,32 @@
 #define X86_VENDOR_ID	new_cpu_data+CPUINFO_x86_vendor_id
 
 /*
- * This is how much memory in addition to the memory covered up to
- * and including _end we need mapped initially.
- * We need:
- *     (KERNEL_IMAGE_SIZE/4096) / 1024 pages (worst case, non PAE)
- *     (KERNEL_IMAGE_SIZE/4096) / 512 + 4 pages (worst case for PAE)
- *
- * Modulo rounding, each megabyte assigned here requires a kilobyte of
- * memory, which is currently unreclaimed.
- *
- * This should be a multiple of a page.
- *
- * KERNEL_IMAGE_SIZE should be greater than pa(_end)
- * and small than max_low_pfn, otherwise will waste some page table entries
+ * Worst-case size of the kernel mapping we need to make:
+ * a relocatable kernel can live anywhere in lowmem, so we need to be able
+ * to map all of lowmem.
  */
 
-#if PTRS_PER_PMD > 1
-#define PAGE_TABLE_SIZE(pages) (((pages) / PTRS_PER_PMD) + PTRS_PER_PGD)
-#else
-#define PAGE_TABLE_SIZE(pages) ((pages) / PTRS_PER_PGD)
-#endif
-
 /* Number of possible pages in the lowmem region */
 LOWMEM_PAGES = (((1<<32) - __PAGE_OFFSET) >> PAGE_SHIFT)
-	
-/* Enough space to fit pagetables for the low memory linear map */
-MAPPING_BEYOND_END = PAGE_TABLE_SIZE(LOWMEM_PAGES) << PAGE_SHIFT
 
 /*
- * Worst-case size of the kernel mapping we need to make:
- * a relocatable kernel can live anywhere in lowmem, so we need to be able
- * to map all of lowmem.
+ * This is the size of the pagetable(in pages) we need for the kernel mapping.
+ * We need:
+ *     LOWMEM_PAGES / 1024 pages (worst case, non PAE)
+ *     LOWMEM_PAGES / 512 + 4 pages (worst casem, PAE)
  */
-KERNEL_PAGES = LOWMEM_PAGES
 
-INIT_MAP_SIZE = PAGE_TABLE_SIZE(KERNEL_PAGES) * PAGE_SIZE
+#if PTRS_PER_PMD > 1
+#define PAGE_TABLE_SIZE(pages) ((pages) / PTRS_PER_PMD) + PTRS_PER_PGD
+#else
+#define PAGE_TABLE_SIZE(pages) (pages) / PTRS_PER_PGD
+#endif
+
+INIT_MAP_SIZE = PAGE_TABLE_SIZE(LOWMEM_PAGES) << PAGE_SHIFT
 RESERVE_BRK(pagetables, INIT_MAP_SIZE)
+	
+/* Map enough space after _end for the lowmem linear map */
+MAPPING_BEYOND_END = INIT_MAP_SIZE
 
 /*
  * 32-bit kernel entrypoint; only used by the boot CPU.  On entry,
-- 
1.7.4.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] x86_32 cleanup: KERNEL_IMAGE_SIZE
  2011-02-27 21:21 [PATCH 0/2] x86_32 cleanup: KERNEL_IMAGE_SIZE Stratos Psomadakis
  2011-02-27 21:21 ` [PATCH 1/2] Remove KERNEL_IMAGE_SIZE for x86_32 code(no longer used) Stratos Psomadakis
  2011-02-27 21:21 ` [PATCH 2/2] head_32.S: Update the comments for the initial kernel mapping(KERNEL_IMAGE_SIZE no " Stratos Psomadakis
@ 2011-02-28 19:58 ` Stratos Psomadakis
  2 siblings, 0 replies; 4+ messages in thread
From: Stratos Psomadakis @ 2011-02-28 19:58 UTC (permalink / raw)
  To: linux-kernel; +Cc: H. Peter Anvin, Ingo Molnar, psomas

On 02/27/2011 11:21 PM, Stratos Psomadakis wrote:
> I noticed that KERNEL_IMAGE_SIZE is no longer used by x86_32 code
> (head_32.S no longer uses it for the initial kernel mapping).
>
> We can thus remove the assert from the vmlinux.lds.S file, and 
> remove it completely for x86_32 code. 
>
> Since head_32.S doesn't use it anymore, I can't find a reason 
> why we should impose such a limit on the kernel image size
> (although a 512+MB kernel image isn't what one would call a realistic
> scenario :P)
>
> I think that a limit on the size of the image is imposed anyway
> by decompress_kernel()(if I understood correctly).
>
> I also updated the comments in head_32.S which still had references
> to KERNEL_IMAGE_SIZE.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>
added cc, just in case anyone is interested

-- 
Stratos Psomadakis
<psomas@ece.ntua.gr>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-02-28 19:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-27 21:21 [PATCH 0/2] x86_32 cleanup: KERNEL_IMAGE_SIZE Stratos Psomadakis
2011-02-27 21:21 ` [PATCH 1/2] Remove KERNEL_IMAGE_SIZE for x86_32 code(no longer used) Stratos Psomadakis
2011-02-27 21:21 ` [PATCH 2/2] head_32.S: Update the comments for the initial kernel mapping(KERNEL_IMAGE_SIZE no " Stratos Psomadakis
2011-02-28 19:58 ` [PATCH 0/2] x86_32 cleanup: KERNEL_IMAGE_SIZE Stratos Psomadakis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome