From: jonathan.austin@arm.com (Jonathan Austin)
To: linux-arm-kernel@lists.infradead.org
Subject: Discontiguous memory and cacheflush
Date: Mon, 13 Aug 2012 15:42:52 +0100 [thread overview]
Message-ID: <5029126C.5000202@arm.com> (raw)
In-Reply-To: <1613427331.1190769.1344577949008.JavaMail.root@mozilla.com>
Hi Martin,
On 10/08/12 06:52, Martin Rosenberg wrote:
> A couple of days ago, I started a project to coalesce calls to
> cachefush in mozilla's JIT. After working out most of the bugs that
> I could find, there were still some lingering failures, which I
> believe finally tracked down to do_cache_op, where it looks like only
> the first contiguous region of virtual memory is consulted. I don't
> actually know about any of the functions that are being called, nor
> exactly what the datastructures represent, but if my understanding of
> the code is correct, then it is at odds with the documentation that
> is available (namely, man cacheflush(2)). Is there something I've
> overlooked, any suggested workarounds? Thanks --Marty
>
On my system the cacheflush(2) documentation suggests it is MIPS only:
"This Linux-specific system call is only available on MIPS based
systems. It should not be used in programs intended to be portable."
As you've established by looking at the code, on ARM we intentionally
attempt to flush only the part of the given range that occurs inside the
vma containing 'start'.
When flushing some huge range that spans multiple vmas, there might be
junk in the middle that it doesn't make sense to flush (eg devices), so
a fix that guarantees to flush an entire range isn't trivial and there
need to be some decisions about how to handle nonsensical requests. If
it is *really* necessary to flush large ranges like this it would be
good to understand why.
That said, now that it is possible to return errors from the cache
flushing syscalls[1] we should probably at least consider returning
something to report that the range had been truncated. There'd need to
be some thought given to how to represent errors where the range is
truncated *and* the flush_cache_user_range() function returns an error,
as well as a justification of why reporting truncation is
useful/necessary: For example the gcc builtin function:
void __builtin___clear_cache (char *begin, char *end) )
has no return value to propagate error data[2], so it is unlikely that
much of userspace could take advantage of the return codes. There's some
historical discussion of this issue at [3]
Hope that helps,
Jonny
[1]
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-April/096299.html
which was committed as c5102f593550 - ARM: 7408/1: cacheflush: return
error to userspace when flushing syscall fails)
[2] http://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
[3]
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-April/094869.html
next prev parent reply other threads:[~2012-08-13 14:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <447177957.1189939.1344577602635.JavaMail.root@mozilla.com>
2012-08-10 5:52 ` Discontiguous memory and cacheflush Martin Rosenberg
2012-08-13 14:42 ` Jonathan Austin [this message]
2012-08-13 16:00 ` Russell King - ARM Linux
2012-08-15 22:08 ` Martin Rosenberg
2012-08-16 8:27 ` Dave Martin
2012-08-16 9:19 ` Russell King - ARM Linux
2012-08-16 9:43 ` Dave Martin
2012-08-17 15:53 ` Jonathan Austin
2012-08-17 21:03 ` Russell King - ARM Linux
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=5029126C.5000202@arm.com \
--to=jonathan.austin@arm.com \
--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).