All of lore.kernel.org
 help / color / mirror / Atom feed
From: Suresh Siddha <suresh.b.siddha@intel.com>
To: mingo@elte.hu, hpa@zytor.com, tglx@linutronix.de
Cc: venkatesh.pallipadi@intel.com, linux-kernel@vger.kernel.org
Subject: [patch] x86, pat: fix free_memtype() for legacy 1MB range
Date: Wed, 14 Jan 2009 10:48:34 -0800	[thread overview]
Message-ID: <20090114184834.GC1290@linux-os.sc.intel.com> (raw)

commit 0e95c190cf1b4adbf1fc67decff3f2bb20158ba8 in tip tree
is n't complete, as we left out adding similar logic to free_memtype().

Appended is the delta patch against tip.

thanks,
suresh
---

[patch] x86, pat: fix free_memtype() for legacy 1MB range

Starting this commit:

>	commit 0e95c190cf1b4adbf1fc67decff3f2bb20158ba8
>	Author: Suresh Siddha <suresh.b.siddha@intel.com>
>	Date:   Fri Jan 9 14:35:20 2009 -0800
>
>	    x86, pat: fix reserve_memtype() for legacy 1MB range

Attribute requests with in this 1MB region are tracked in reserve_memtype()
using linear linked list (and don't bother if the range is RAM or non-RAM or
mixed).

free_memtype() also needs to follow similar logic.

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

diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index ec8cd49..3be3990 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -446,11 +446,19 @@ int free_memtype(u64 start, u64 end)
 	if (is_ISA_range(start, end - 1))
 		return 0;
 
-	is_range_ram = pagerange_is_ram(start, end);
-	if (is_range_ram == 1)
-		return free_ram_pages_type(start, end);
-	else if (is_range_ram < 0)
-		return -EINVAL;
+	/*
+	 * For legacy reasons, some parts of the physical address range in the
+	 * legacy 1MB region is treated as non-RAM (even when listed as RAM in
+	 * the e820 tables).  So we will track the memory attributes of this
+	 * legacy 1MB region using the linear memtype_list always.
+	 */
+	if (end >= ISA_END_ADDRESS) {
+		is_range_ram = pagerange_is_ram(start, end);
+		if (is_range_ram == 1)
+			return free_ram_pages_type(start, end);
+		else if (is_range_ram < 0)
+			return -EINVAL;
+	}
 
 	spin_lock(&memtype_lock);
 	list_for_each_entry(entry, &memtype_list, nd) {

             reply	other threads:[~2009-01-14 18:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-14 18:48 Suresh Siddha [this message]
2009-01-14 19:16 ` [patch] x86, pat: fix free_memtype() for legacy 1MB range Ingo Molnar

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=20090114184834.GC1290@linux-os.sc.intel.com \
    --to=suresh.b.siddha@intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=venkatesh.pallipadi@intel.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 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.