From: "venkatesh.pallipadi@intel.com" <venkatesh.pallipadi@intel.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
venkatesh.pallipadi@intel.com, suresh.b.siddha@intel.com,
tglx@linutronix.de, mingo@elte.hu
Subject: [tip:x86/pat] x86, PAT: Change order of cpa and free in set_memory_wb
Date: Fri, 10 Apr 2009 12:34:09 GMT [thread overview]
Message-ID: <tip-a5593e0b329a14dea41ea173380dbf1533de2bd2@git.kernel.org> (raw)
In-Reply-To: <20090409212708.512280000@intel.com>
Commit-ID: a5593e0b329a14dea41ea173380dbf1533de2bd2
Gitweb: http://git.kernel.org/tip/a5593e0b329a14dea41ea173380dbf1533de2bd2
Author: venkatesh.pallipadi@intel.com <venkatesh.pallipadi@intel.com>
AuthorDate: Thu, 9 Apr 2009 14:26:48 -0700
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 10 Apr 2009 13:55:46 +0200
x86, PAT: Change order of cpa and free in set_memory_wb
To be free of aliasing due to races, set_memory_* interfaces should
follow ordering of reserving, changing memtype to UC/WC, changing
memtype back to WB followed by free.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
LKML-Reference: <20090409212708.512280000@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
arch/x86/mm/pageattr.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index d71e1b6..d487eaa 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -1021,15 +1021,19 @@ int _set_memory_wb(unsigned long addr, int numpages)
int set_memory_wb(unsigned long addr, int numpages)
{
+ int ret = _set_memory_wb(addr, numpages);
free_memtype(__pa(addr), __pa(addr) + numpages * PAGE_SIZE);
-
- return _set_memory_wb(addr, numpages);
+ return ret;
}
EXPORT_SYMBOL(set_memory_wb);
int set_memory_array_wb(unsigned long *addr, int addrinarray)
{
int i;
+ int ret;
+
+ ret = change_page_attr_clear(addr, addrinarray,
+ __pgprot(_PAGE_CACHE_MASK), 1);
for (i = 0; i < addrinarray; i++) {
unsigned long start = __pa(addr[i]);
@@ -1042,8 +1046,7 @@ int set_memory_array_wb(unsigned long *addr, int addrinarray)
}
free_memtype(start, end);
}
- return change_page_attr_clear(addr, addrinarray,
- __pgprot(_PAGE_CACHE_MASK), 1);
+ return ret;
}
EXPORT_SYMBOL(set_memory_array_wb);
next prev parent reply other threads:[~2009-04-10 12:35 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-09 21:26 [patch 0/6] x86, PAT, CPA: Cleanups and minor bug fixes venkatesh.pallipadi
2009-04-09 21:26 ` [patch 1/6] x86, CPA: Change idmap attribute before ioremap attribute setup venkatesh.pallipadi
2009-04-10 12:33 ` [tip:x86/pat] " Suresh Siddha
2009-04-09 21:26 ` [patch 2/6] x86, PAT: Change order of cpa and free in set_memory_wb venkatesh.pallipadi
2009-04-10 12:34 ` venkatesh.pallipadi [this message]
2009-04-09 21:26 ` [patch 3/6] x86, PAT: Handle faults cleanly in set_memory_ APIs venkatesh.pallipadi
2009-04-10 12:34 ` [tip:x86/pat] " venkatesh.pallipadi
2009-04-09 21:26 ` [patch 4/6] x86, PAT: Changing memtype to WC ensuring no WB alias venkatesh.pallipadi
2009-04-10 12:34 ` [tip:x86/pat] " venkatesh.pallipadi
2009-04-09 21:26 ` [patch 5/6] x86, PAT: Consolidate code in pat_x_mtrr_type() and reserve_memtype() venkatesh.pallipadi
2009-04-10 12:34 ` [tip:x86/pat] " Suresh Siddha
2009-04-09 21:26 ` [patch 6/6] x86, PAT: Remove duplicate memtype reserve in devmem mmap venkatesh.pallipadi
2009-04-10 12:34 ` [tip:x86/pat] " Suresh Siddha
2009-04-10 11:53 ` [patch 0/6] x86, PAT, CPA: Cleanups and minor bug fixes Ingo Molnar
2009-04-10 17:31 ` Pallipadi, Venkatesh
2009-04-10 20:41 ` Eric Anholt
2009-04-11 7:00 ` Ingo Molnar
2009-04-13 20:11 ` Eric Anholt
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=tip-a5593e0b329a14dea41ea173380dbf1533de2bd2@git.kernel.org \
--to=venkatesh.pallipadi@intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=suresh.b.siddha@intel.com \
--cc=tglx@linutronix.de \
/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