mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Brian Gerst <bgerst@quark.didntduck.org>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Linux-Kernel <linux-kernel@vger.kernel.org>, da-x@gmx.net
Subject: [PATCH] fix x86 page table init
Date: Tue, 30 Jul 2002 21:45:17 -0400	[thread overview]
Message-ID: <3D47412D.1060407@quark.didntduck.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 393 bytes --]

The recent changes to the x86 page table init reintroduced a bug with 
the 4k pagetables.  The page table must be filled with entries before it 
is inserted into the pmd or else you risk a tlb miss on a kernel code 
page causing an oops.  This patch takes a different approach than before 
- it allows for reuse of the boot pagetable pages instead of allocating 
new ones.

--
				Brian Gerst

[-- Attachment #2: pte_init-1 --]
[-- Type: text/plain, Size: 1007 bytes --]

diff -urN linux-bk/arch/i386/mm/init.c linux/arch/i386/mm/init.c
--- linux-bk/arch/i386/mm/init.c	Tue Jul 30 20:59:27 2002
+++ linux/arch/i386/mm/init.c	Tue Jul 30 21:02:41 2002
@@ -70,10 +70,14 @@
  */
 static pte_t * __init one_page_table_init(pmd_t *pmd)
 {
-	pte_t *page_table = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE);
-	set_pmd(pmd, __pmd(__pa(page_table) | _KERNPG_TABLE));
-	if (page_table != pte_offset_kernel(pmd, 0))
-		BUG();	
+	pte_t *page_table;
+	page_table = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE);
+	if (pmd_none(*pmd)) {
+		set_pmd(pmd, __pmd(__pa(page_table) | _KERNPG_TABLE));
+		if (page_table != pte_offset_kernel(pmd, 0))
+			BUG();	
+	} else
+		page_table = pte_offset_kernel(pmd, 0);
 
 	return page_table;
 }
@@ -107,9 +111,7 @@
 
 		pmd = pmd_offset(pgd, vaddr);
 		for (; (pmd_ofs < PTRS_PER_PMD) && (vaddr != end); pmd++, pmd_ofs++) {
-			if (pmd_none(*pmd)) 
-				one_page_table_init(pmd);
-
+			one_page_table_init(pmd);
 			vaddr += PMD_SIZE;
 		}
 		pmd_ofs = 0;

             reply	other threads:[~2002-07-31  1:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-31  1:45 Brian Gerst [this message]
2002-07-31  3:05 ` Dan Aloni
2002-07-31  4:35   ` Brian Gerst
2002-08-04 16:36 Brian Gerst

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=3D47412D.1060407@quark.didntduck.org \
    --to=bgerst@quark.didntduck.org \
    --cc=da-x@gmx.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®