All of lore.kernel.org
 help / color / mirror / Atom feed
From: venkatesh.pallipadi@intel.com
To: ak@muc.de, ebiederm@xmission.com, rdreier@cisco.com,
	torvalds@linux-foundation.org, gregkh@suse.de, airlied@skynet.ie,
	davej@redhat.com, mingo@elte.hu, tglx@linutronix.de,
	hpa@zytor.com, akpm@linux-foundation.org, arjan@infradead.org,
	jesse.barnes@intel.com, davem@davemloft.net
Cc: linux-kernel@vger.kernel.org,
	Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>,
	Suresh Siddha <suresh.b.siddha@intel.com>
Subject: [patch 3/4] x86: PAT followup - Remove reserved pages mapping to zero page and not map them
Date: Tue, 15 Jan 2008 18:39:58 -0800	[thread overview]
Message-ID: <20080116024112.059516000@intel.com> (raw)
In-Reply-To: 20080116023955.597433000@intel.com

[-- Attachment #1: remove_reserved_zeropages.patch --]
[-- Type: text/plain, Size: 4429 bytes --]

Remove reserved pages mapping to zeropage. Reserved and holes are now not
mapped at all.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>

Index: linux-2.6.git/arch/x86/mm/init_32.c
===================================================================
--- linux-2.6.git.orig/arch/x86/mm/init_32.c	2008-01-15 11:02:23.000000000 -0800
+++ linux-2.6.git/arch/x86/mm/init_32.c	2008-01-15 11:08:29.000000000 -0800
@@ -143,50 +143,6 @@
 	return 0;
 }
 
-static unsigned long __init get_res_page(void)
-{
-	static unsigned long res_phys_page;
-	if (!res_phys_page) {
-
-		res_phys_page = (unsigned long)
-		                alloc_bootmem_low_pages(PAGE_SIZE);
-		if (!res_phys_page)
-			BUG();
-
-		memset((char *)res_phys_page, 0xe, PAGE_SIZE);
-		res_phys_page = __pa(res_phys_page);
-	}
-	return res_phys_page;
-}
-
-static unsigned long __init get_res_ptepage(void)
-{
-	static unsigned long res_phys_ptepage;
-	pte_t *pte;
-	int pte_ofs;
-	unsigned long pfn;
-
-	if (!res_phys_ptepage) {
-
-		res_phys_ptepage = (unsigned long)
-		                   alloc_bootmem_low_pages(PAGE_SIZE);
-		if (!res_phys_ptepage)
-			BUG();
-
-		paravirt_alloc_pt(&init_mm,
-		                  __pa(res_phys_ptepage) >> PAGE_SHIFT);
-
-		/* Set all PTEs in the range to zero page */
-		pfn = get_res_page() >> PAGE_SHIFT;
-		pte = (pte_t *)res_phys_ptepage;
-		for (pte_ofs = 0; pte_ofs < PTRS_PER_PTE; pte++, pte_ofs++)
-			set_pte(pte, pfn_pte(pfn, PAGE_KERNEL));
-
-		res_phys_ptepage = __pa(res_phys_ptepage);
-	}
-	return res_phys_ptepage;
-}
-
 /*
  * This maps the physical memory to kernel virtual address space, a total 
  * of max_low_pfn pages, by creating page tables starting from address 
@@ -199,7 +155,6 @@
 	pmd_t *pmd;
 	pte_t *pte;
 	int pgd_idx, pmd_idx, pte_ofs;
-	unsigned long temp_pfn;
 
 	pgd_idx = pgd_index(PAGE_OFFSET);
 	pgd = pgd_base + pgd_idx;
@@ -238,9 +193,7 @@
 			}
 			if (cpu_has_pse &&
 			    !is_memory_any_valid(paddr, paddr + PMD_SIZE)) {
-
-				temp_pfn = get_res_ptepage();
-				set_pmd(pmd, __pmd(temp_pfn | _PAGE_TABLE));
+				set_pmd(pmd, __pmd(0));
 				pfn += PTRS_PER_PTE;
 				continue;
 			}
@@ -259,10 +212,7 @@
 
 				if (!is_memory_any_valid(paddr,
 				                         paddr + PAGE_SIZE)) {
-
-					temp_pfn = get_res_page() >> PAGE_SHIFT;
-					set_pte(pte,
-					        pfn_pte(temp_pfn, PAGE_KERNEL));
+					set_pte(pte, __pte(0));
 					continue;
 				}
 
Index: linux-2.6.git/arch/x86/mm/init_64.c
===================================================================
--- linux-2.6.git.orig/arch/x86/mm/init_64.c	2008-01-15 11:06:37.000000000 -0800
+++ linux-2.6.git/arch/x86/mm/init_64.c	2008-01-15 11:09:18.000000000 -0800
@@ -494,41 +494,6 @@
 			 kcore_vsyscall;
 
 
-static unsigned long __init get_res_page(void)
-{
-	static unsigned long res_phys_page;
-	if (!res_phys_page) {
-		pte_t *pte;
-		pte = alloc_low_page(&res_phys_page);
-		unmap_low_page(pte);
-	}
-	return res_phys_page;
-}
-
-static unsigned long __init get_res_ptepage(void)
-{
-	static unsigned long res_phys_ptepage;
-	if (!res_phys_ptepage) {
-		pte_t *pte_page;
-		unsigned long page_phys;
-		unsigned long entry;
-		int i;
-
-		pte_page = alloc_low_page(&res_phys_ptepage);
-
-		page_phys = get_res_page();
-		entry = _PAGE_NX | _KERNPG_TABLE | _PAGE_GLOBAL | page_phys;
-		entry &= __supported_pte_mask;
-		for (i = 0; i < PTRS_PER_PTE; i++) {
-			pte_t *pte = pte_page + i;
-			set_pte(pte, __pte(entry));
-		}
-
-		unmap_low_page(pte_page);
-	}
-	return res_phys_ptepage;
-}
-
 static void __init phys_pte_prune(pte_t *pte_page, unsigned long address,
 		unsigned long end, unsigned long vaddr, unsigned int exec)
 {
@@ -545,15 +510,7 @@
 		if (!(address & (~PAGE_MASK)) &&
 		    (address + PAGE_SIZE <= end) &&
 		    !is_memory_any_valid(address, address + PAGE_SIZE)) {
-			unsigned long phys_page;
-
-			phys_page = get_res_page();
-			entry = _PAGE_NX | _KERNPG_TABLE | _PAGE_GLOBAL |
-				phys_page;
-
-			entry &= __supported_pte_mask;
-			set_pte(pte, __pte(entry));
-
+			set_pte(pte, __pte(0));
 			continue;
 		}
 
@@ -587,10 +544,7 @@
 		if (!(address & (~PMD_MASK)) &&
 		    (address + PMD_SIZE <= end) &&
 		    !is_memory_any_valid(address, address + PMD_SIZE)) {
-
-			pte_phys = get_res_ptepage();
-			set_pmd(pmd, __pmd(pte_phys | _KERNPG_TABLE));
-
+			set_pmd(pmd, __pmd(0));
 			continue;
 		}
 

-- 

  parent reply	other threads:[~2008-01-16  2:42 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-16  2:39 [patch 0/4] x86: PAT followup - Incremental changes and bug fixes venkatesh.pallipadi
2008-01-16  2:39 ` [patch 1/4] x86: PAT followup - Do not fold two bits in _PAGE_PCD venkatesh.pallipadi
2008-01-16  2:39 ` [patch 2/4] x86: PAT followup - Remove KERNPG_TABLE from pte entry venkatesh.pallipadi
2008-01-16  8:14   ` Mika Penttilä
2008-01-16 18:17     ` Pallipadi, Venkatesh
2008-01-17  0:18     ` Venki Pallipadi
2008-01-16  2:39 ` venkatesh.pallipadi [this message]
2008-01-16  2:39 ` [patch 4/4] x86: PAT followup - use ioremap for devmem read of reserved regions venkatesh.pallipadi
2008-01-16  7:33   ` Ingo Molnar
2008-01-16  7:29 ` [patch 0/4] x86: PAT followup - Incremental changes and bug fixes Ingo Molnar
2008-01-16 18:57 ` Andreas Herrmann
2008-01-16 19:05   ` Pallipadi, Venkatesh
2008-01-16 19:37   ` Pallipadi, Venkatesh
2008-01-16 20:24   ` Ingo Molnar
2008-01-16 20:33   ` Venki Pallipadi
2008-01-16 22:01     ` Andi Kleen
2008-01-16 22:14       ` Pallipadi, Venkatesh
2008-01-16 22:29         ` Andi Kleen
2008-01-17 19:12     ` Andreas Herrmann3
2008-01-17 19:54       ` Andreas Herrmann3
2008-01-17 20:36       ` Ingo Molnar
2008-01-17 20:33         ` H. Peter Anvin
2008-01-17 20:56           ` Ingo Molnar
2008-01-17 20:57           ` Linus Torvalds
2008-01-17 20:44         ` Ingo Molnar
2008-01-17 21:03         ` Andreas Herrmann3
2008-01-17 21:13           ` Ingo Molnar
2008-01-17 21:22             ` Ingo Molnar
2008-01-17 21:31             ` Siddha, Suresh B
2008-01-17 21:38               ` H. Peter Anvin
2008-01-24 20:22                 ` Eric W. Biederman
2008-01-24 21:36                   ` H. Peter Anvin
2008-01-17 21:42               ` Ingo Molnar
2008-01-17 22:06                 ` Andreas Herrmann3
2008-01-17 22:05                   ` H. Peter Anvin
2008-01-17 22:15                   ` Ingo Molnar
2008-01-17 22:52                     ` Andreas Herrmann3
2008-01-17 23:04                       ` Venki Pallipadi
2008-01-17 23:24                         ` Andreas Herrmann3
2008-01-17 23:42                           ` Pallipadi, Venkatesh
2008-01-18 16:10                         ` Andreas Herrmann3
2008-01-18 17:13                           ` Pallipadi, Venkatesh
2008-01-18 17:33                             ` Balbir Singh
2008-01-18  4:25               ` Andi Kleen
2008-01-17 21:42             ` Andreas Herrmann3
2008-01-17 22:13               ` Ingo Molnar
2008-01-17 22:16               ` Andreas Herrmann3
2008-01-17 22:26               ` Andreas Herrmann3
2008-01-17 22:35                 ` Ingo Molnar
2008-01-17 23:06                   ` Andreas Herrmann3

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=20080116024112.059516000@intel.com \
    --to=venkatesh.pallipadi@intel.com \
    --cc=airlied@skynet.ie \
    --cc=ak@muc.de \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@infradead.org \
    --cc=davej@redhat.com \
    --cc=davem@davemloft.net \
    --cc=ebiederm@xmission.com \
    --cc=gregkh@suse.de \
    --cc=hpa@zytor.com \
    --cc=jesse.barnes@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rdreier@cisco.com \
    --cc=suresh.b.siddha@intel.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.