From: Vincent Chen <vincentc@andestech.com>
To: <linux-kernel@vger.kernel.org>, <green.hu@gmail.com>,
<greentime@andestech.com>, <arnd@arndb.de>
Cc: <deanbo422@gmail.com>, <vincentc@andestech.com>
Subject: [PATCH 2/3] nds32: Flush the cache of the page at vmaddr instead of kaddr in flush_anon_page
Date: Tue, 15 May 2018 16:46:02 +0800 [thread overview]
Message-ID: <1526373963-12417-3-git-send-email-vincentc@andestech.com> (raw)
In-Reply-To: <1526373963-12417-1-git-send-email-vincentc@andestech.com>
According to Documentation/cachetlb.txt, the cache of the page at vmaddr
shall be flushed in flush_anon_page instead of the cache of the page at
page_address(page).
Signed-off-by: Vincent Chen <vincentc@andestech.com>
---
arch/nds32/mm/cacheflush.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/arch/nds32/mm/cacheflush.c b/arch/nds32/mm/cacheflush.c
index 288cf10..acfdb45 100644
--- a/arch/nds32/mm/cacheflush.c
+++ b/arch/nds32/mm/cacheflush.c
@@ -254,7 +254,7 @@ void copy_from_user_page(struct vm_area_struct *vma, struct page *page,
void flush_anon_page(struct vm_area_struct *vma,
struct page *page, unsigned long vaddr)
{
- unsigned long flags;
+ unsigned long kaddr, flags, ktmp;
if (!PageAnon(page))
return;
@@ -264,7 +264,12 @@ void flush_anon_page(struct vm_area_struct *vma,
local_irq_save(flags);
if (vma->vm_flags & VM_EXEC)
cpu_icache_inval_page(vaddr & PAGE_MASK);
- cpu_dcache_wbinval_page((unsigned long)page_address(page));
+ kaddr = (unsigned long)page_address(page);
+ if (aliasing(vaddr, kaddr)) {
+ ktmp = kremap0(vaddr, page_to_phys(page));
+ cpu_dcache_wbinval_page(ktmp);
+ kunmap01(ktmp);
+ }
local_irq_restore(flags);
}
--
1.7.1
next prev parent reply other threads:[~2018-05-15 8:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-15 8:46 [PATCH 0/3]nds32: Correct the cache operation for catch aliasing case Vincent Chen
2018-05-15 8:46 ` [PATCH 1/3] nds32: Correct flush_dcache_page function Vincent Chen
2018-05-15 8:46 ` Vincent Chen [this message]
2018-05-15 8:46 ` [PATCH 3/3] nds32: Disable local irq before calling cpu_dcache_wb_page in copy_user_highpage Vincent Chen
2018-05-17 6:58 ` [PATCH 0/3]nds32: Correct the cache operation for catch aliasing case Greentime Hu
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=1526373963-12417-3-git-send-email-vincentc@andestech.com \
--to=vincentc@andestech.com \
--cc=arnd@arndb.de \
--cc=deanbo422@gmail.com \
--cc=green.hu@gmail.com \
--cc=greentime@andestech.com \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).