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>
Subject: [PATCH] fix x86 page table init
Date: Sun, 04 Aug 2002 12:36:11 -0400	[thread overview]
Message-ID: <3D4D57FB.1070208@quark.didntduck.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 405 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 is the third iteration of the patch and it 
goes back to the 2.4 method, which is compatabile with the boot 
pagetable changes I just sent in.

--
				Brian Gerst


[-- Attachment #2: pte_init-3 --]
[-- Type: text/plain, Size: 1031 bytes --]

diff -urN linux-bg1/arch/i386/mm/init.c linux/arch/i386/mm/init.c
--- linux-bg1/arch/i386/mm/init.c	Fri Aug  2 10:15:28 2002
+++ linux/arch/i386/mm/init.c	Sun Aug  4 12:14:42 2002
@@ -126,7 +126,7 @@
 	unsigned long pfn;
 	pgd_t *pgd;
 	pmd_t *pmd;
-	pte_t *pte;
+	pte_t *pte, *pte_base;
 	int pgd_ofs, pmd_ofs, pte_ofs;
 
 	pgd_ofs = __pgd_offset(PAGE_OFFSET);
@@ -141,10 +141,19 @@
 				set_pmd(pmd, pfn_pmd(pfn, PAGE_KERNEL_LARGE));
 				pfn += PTRS_PER_PTE;
 			} else {
-				pte = one_page_table_init(pmd);
+				/*
+				 * We cannot set the pmd until the page is full, since we are
+				 * changing the pte under running code and a tlb miss will
+				 * cause an oops.
+				 */
+				pte_base = pte = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE);
 
 				for (pte_ofs = 0; pte_ofs < PTRS_PER_PTE && pfn < max_low_pfn; pte++, pfn++, pte_ofs++)
 					set_pte(pte, pfn_pte(pfn, PAGE_KERNEL));
+
+				set_pmd(pmd, __pmd(__pa(pte_base) | _KERNPG_TABLE));
+				if (pte_base != pte_offset_kernel(pmd, 0))
+					BUG();	
 			}
 		}
 	}	

             reply	other threads:[~2002-08-04 16:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-04 16:36 Brian Gerst [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-07-31  1:45 Brian Gerst
2002-07-31  3:05 ` Dan Aloni
2002-07-31  4:35   ` 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=3D4D57FB.1070208@quark.didntduck.org \
    --to=bgerst@quark.didntduck.org \
    --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®