This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: mlock in cache
- From: Christos <xristos dot tsop at gmail dot com>
- To: Oleg Endo <oleg dot endo at t-online dot de>
- Cc: GCC-help <gcc-help at gcc dot gnu dot org>
- Date: Fri, 02 Aug 2013 20:01:14 +0100
- Subject: Re: mlock in cache
- References: <51FBBE65 dot 2000406 at gmail dot com> <51FBC1DE dot 3000501 at redhat dot com> <51FBCA48 dot 20106 at gmail dot com> <51FBCE48 dot 6080402 at redhat dot com> <51FBD281 dot 2040803 at gmail dot com> <51FBD309 dot 7000204 at redhat dot com> <51FBD595 dot 4020703 at gmail dot com> <CANjXV6-jOeCusNT3iZjNbGKdy0+B=TUwjmgJuBoUfpaUZRMCXQ at mail dot gmail dot com> <51FBE511 dot 7030505 at gmail dot com> <1375467264 dot 3952 dot 16 dot camel at yam-132-YW-E178-FTW>
On 08/02/2013 07:14 PM, Oleg Endo wrote:
I'd say the available options depend on the processor architecture.
Maybe it's better in your case to look at different architectures and
not at the types of built-ins GCC has or doesn't have.
Definitely, this should be the core conclusion of the thread.
For example, the
SH4 CPU has some cache control instructions (not all of them are
available through GCC built-in functions):
movca.l - Reserves a cache line by marking it as valid for the specified
address. Does not synchronize it with memory if it is dirty.
ocbp - Write back and invalidate operand cache line
ocbwb - Write back cache line but do not invalidate it
pref - Prefetch cache line (no operation if it is already in the cache)
Very interesting, thanks for the info.
In addition to that, memory accesses can either go through the cache or
bypass the cache (there are special bits in the address for that when
accessing memory without MMU, or settings in MMU pages).
With these low level things something like what you described above
could be constructed, but probably it will be difficult to do so in a
multi tasking environment.
Why do you say so? I ask you because my main interest is a
multiprocessing/multicore system.
I can't see why you can't do that if you work at a very low level, like
the one you mentioned, as I said previously.
If GCC doesn't have a built-in function
ready for the particular special instruction it can be issued rather
easily with inline asm.
Well, I think I mentioned this aspect before and it really has to do
with finding the necessary asm directives.
Also, there's no guarantee that e.g.
__builtin_prefetch will actually emit a prefetch instruction.
Thanks a lot for that because it was another question of mine. Do you
know at which part of the official documentation this thing is mentioned?
Once again, thanks a lot for the assistance, it was rather helpful...!
--
Christos Tsopokis