LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: [patch 17/18] Remove BUILD_BUG_ON() in vmem code.
Date: Tue, 05 Feb 2008 16:38:52 +0100	[thread overview]
Message-ID: <20080205153915.892066661@de.ibm.com> (raw)
In-Reply-To: <20080205153835.337897404@de.ibm.com>

[-- Attachment #1: 017-vmem-bug.diff --]
[-- Type: text/plain, Size: 3322 bytes --]

From: Heiko Carstens <heiko.carstens@de.ibm.com>

Remove BUILD_BUG_ON() in vmem code since it causes build failures if
the size of struct page increases. Instead calculate at compile time
the address of the highest physical address that can be added to the
1:1 mapping.
This supposed to fix a build failure with the page owner tracking leak
detector patches as reported by akpm.

page-owner-tracking-leak-detector-broken-on-s390.patch can be removed
from -mm again when this is merged.

Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
---

 arch/s390/kernel/setup.c   |    2 +-
 arch/s390/mm/vmem.c        |    3 +--
 include/asm-s390/pgtable.h |   12 +++++++++---
 3 files changed, 11 insertions(+), 6 deletions(-)

Index: quilt-2.6/arch/s390/kernel/setup.c
===================================================================
--- quilt-2.6.orig/arch/s390/kernel/setup.c
+++ quilt-2.6/arch/s390/kernel/setup.c
@@ -528,7 +528,7 @@ static void __init setup_memory_end(void
 	memory_size = 0;
 	memory_end &= PAGE_MASK;
 
-	max_mem = memory_end ? min(VMALLOC_START, memory_end) : VMALLOC_START;
+	max_mem = memory_end ? min(VMEM_MAX_PHYS, memory_end) : VMEM_MAX_PHYS;
 	memory_end = min(max_mem, memory_end);
 
 	/*
Index: quilt-2.6/arch/s390/mm/vmem.c
===================================================================
--- quilt-2.6.orig/arch/s390/mm/vmem.c
+++ quilt-2.6/arch/s390/mm/vmem.c
@@ -250,7 +250,7 @@ static int insert_memory_segment(struct 
 {
 	struct memory_segment *tmp;
 
-	if (seg->start + seg->size >= VMALLOC_START ||
+	if (seg->start + seg->size >= VMEM_MAX_PHYS ||
 	    seg->start + seg->size < seg->start)
 		return -ERANGE;
 
@@ -360,7 +360,6 @@ void __init vmem_map_init(void)
 {
 	int i;
 
-	BUILD_BUG_ON((unsigned long)VMEM_MAP + VMEM_MAP_SIZE > VMEM_MAP_MAX);
 	NODE_DATA(0)->node_mem_map = VMEM_MAP;
 	for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++)
 		vmem_add_mem(memory_chunk[i].addr, memory_chunk[i].size);
Index: quilt-2.6/include/asm-s390/pgtable.h
===================================================================
--- quilt-2.6.orig/include/asm-s390/pgtable.h
+++ quilt-2.6/include/asm-s390/pgtable.h
@@ -115,15 +115,21 @@ extern char empty_zero_page[PAGE_SIZE];
 #ifndef __s390x__
 #define VMALLOC_START	0x78000000UL
 #define VMALLOC_END	0x7e000000UL
-#define VMEM_MAP_MAX	0x80000000UL
+#define VMEM_MAP_END	0x80000000UL
 #else /* __s390x__ */
 #define VMALLOC_START	0x3e000000000UL
 #define VMALLOC_END	0x3e040000000UL
-#define VMEM_MAP_MAX	0x40000000000UL
+#define VMEM_MAP_END	0x40000000000UL
 #endif /* __s390x__ */
 
+/*
+ * VMEM_MAX_PHYS is the highest physical address that can be added to the 1:1
+ * mapping. This needs to be calculated at compile time since the size of the
+ * VMEM_MAP is static but the size of struct page can change.
+ */
+#define VMEM_MAX_PHYS	min(VMALLOC_START, ((VMEM_MAP_END - VMALLOC_END) / \
+			  sizeof(struct page) * PAGE_SIZE) & ~((16 << 20) - 1))
 #define VMEM_MAP	((struct page *) VMALLOC_END)
-#define VMEM_MAP_SIZE	((VMALLOC_START / PAGE_SIZE) * sizeof(struct page))
 
 /*
  * A 31 bit pagetable entry of S390 has following format:

-- 
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.


  parent reply	other threads:[~2008-02-05 15:44 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-05 15:38 [patch 00/18] s390 bug fix patches Martin Schwidefsky
2008-02-05 15:38 ` [patch 01/18] cio: make sense id procedure work with partial hardware response Martin Schwidefsky
2008-02-05 15:38 ` [patch 02/18] cio: Clean up chsc response code handling Martin Schwidefsky
2008-02-05 15:38 ` [patch 03/18] cio: Update documentation Martin Schwidefsky
2008-02-05 15:38 ` [patch 04/18] cio: Add shutdown callback for ccwgroup Martin Schwidefsky
2008-02-05 15:38 ` [patch 05/18] DEBUG_PAGEALLOC support for s390 Martin Schwidefsky
2008-02-05 15:38 ` [patch 06/18] Fix linker script Martin Schwidefsky
2008-02-05 15:38 ` [patch 07/18] Fix smp_call_function_mask semantics Martin Schwidefsky
2008-02-05 15:38 ` [patch 08/18] Fix couple of section mismatches Martin Schwidefsky
2008-02-05 15:38 ` [patch 09/18] console: allow vt220 console to be the only console Martin Schwidefsky
2008-02-05 15:38 ` [patch 10/18] Define GENERIC_LOCKBREAK Martin Schwidefsky
2008-02-05 15:38 ` [patch 11/18] Cleanup & optimize bitops Martin Schwidefsky
2008-02-05 15:38 ` [patch 12/18] Implement ext2_find_next_bit Martin Schwidefsky
2008-02-05 15:38 ` [patch 13/18] latencytop s390 support Martin Schwidefsky
2008-02-05 15:38 ` [patch 14/18] dasd: add ifcc handling Martin Schwidefsky
2008-02-05 15:38 ` [patch 15/18] dasd: fix panic caused by alias device offline Martin Schwidefsky
2008-02-05 15:38 ` [patch 16/18] sclp_tty/sclp_vt220: Fix scheduling while atomic Martin Schwidefsky
2008-02-05 15:38 ` Martin Schwidefsky [this message]
2008-02-05 15:38 ` [patch 18/18] dcss: Initialize workqueue before using it Martin Schwidefsky
2008-02-05 15:45   ` Carsten Otte

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080205153915.892066661@de.ibm.com \
    --to=schwidefsky@de.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --subject='Re: [patch 17/18] Remove BUILD_BUG_ON() in vmem code.' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).