From: steve.capper@linaro.org (Steve Capper)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] arm: cacheflush: Fix user split-caching logic
Date: Fri, 13 Dec 2013 12:06:31 +0000 [thread overview]
Message-ID: <1386936391-30493-3-git-send-email-steve.capper@linaro.org> (raw)
In-Reply-To: <1386936391-30493-1-git-send-email-steve.capper@linaro.org>
The user split-caching logic in __do_cache_op divides the area to be
flushed into interruptable chunks of size PAGE_SIZE. Unfortunately,
there is no check to see whether or not the range to be flushed is
smaller than the chunk size.
This can result cache flushes for larger ranges than intended,
which can result in the flush failing with a -EFAULT. I've observed
slowdown and failure with the icache-hygiene test from libhugetlbfs.
This patch fixes the problem by replacing chunk with the minimum of
PAGE_SIZE or (end - start), thus we do not overflush.
Signed-off-by: Steve Capper <steve.capper@linaro.org>
---
arch/arm/kernel/traps.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 8fcda14..5d3c455 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -503,7 +503,7 @@ static inline int
__do_cache_op(unsigned long start, unsigned long end)
{
int ret;
- unsigned long chunk = PAGE_SIZE;
+ unsigned long chunk = min(end - start, PAGE_SIZE);
do {
if (signal_pending(current)) {
--
1.8.1.4
next prev parent reply other threads:[~2013-12-13 12:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-13 12:06 [PATCH 0/2] Cache flush fixes Steve Capper
2013-12-13 12:06 ` [PATCH 1/2] arm: mm: fix dcache flush logic for compound high pages Steve Capper
2013-12-13 16:38 ` Will Deacon
2013-12-16 15:07 ` Steve Capper
2013-12-13 12:06 ` Steve Capper [this message]
2013-12-13 12:41 ` [PATCH 2/2] arm: cacheflush: Fix user split-caching logic Steve Capper
2013-12-13 12:51 ` Steve Capper
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=1386936391-30493-3-git-send-email-steve.capper@linaro.org \
--to=steve.capper@linaro.org \
--cc=linux-arm-kernel@lists.infradead.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).