| To: | Aurelien Jarno <aurelien@aurel32.net> |
|---|---|
| Subject: | Re: Syncing CPU caches from userland on MIPS |
| From: | David Daney <ddaney@caviumnetworks.com> |
| Date: | Tue, 24 Nov 2009 13:04:55 -0800 |
| Cc: | linux-mips@linux-mips.org, Arnaud Patard <arnaud.patard@rtp-net.org> |
| In-reply-to: | <20091124182841.GE17477@hall.aurel32.net> |
| Original-recipient: | rfc822;linux-mips@linux-mips.org |
| References: | <20091124182841.GE17477@hall.aurel32.net> |
| Sender: | linux-mips-bounce@linux-mips.org |
| User-agent: | Thunderbird 2.0.0.21 (X11/20090320) |
Aurelien Jarno wrote: Hi all, This question is not really kernel related, but still MIPS related, I hope you don't mind. Arnaud Patard and myself are trying to get qemu working on MIPS [1], which includes translating TCG code (internal representation) into MIPSinstructions, that are then executed. Most of the code works, but we have some strange behaviors that seems related to CPU caches.The code is written to a buffer, which is then executed. Before the execution, the caches are synced using the cacheflush syscall: | #include <sys/cachectl.h>| | | static inline void flush_icache_range(unsigned long start, unsigned long stop) Try inserting an 'asm volatile ("sync" ::: "memory");' here. If that fixes things, then we can assume that your cacheflush system call is buggy, and would need to add a sync. 3) cacheflush is called Sometimes the executed code correspond to the code written in 1), which means the branch is skipped.Does someone knows and/or has example code to correctly sync the CPU caches from userland on MIPS? http://gcc.gnu.org/viewcvs/trunk/libffi/src/mips/ffi.c Look at ffi_prep_closure_loc() around line 721.We also do a similar thing in the kernel in flush_cache_sigtramp(), but that is not really userland. David Daney |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Syncing CPU caches from userland on MIPS, Aurelien Jarno |
|---|---|
| Next by Date: | [PATCH 06/38] move iodev_remove to .devexit.text, Uwe Kleine-König |
| Previous by Thread: | Syncing CPU caches from userland on MIPS, Aurelien Jarno |
| Next by Thread: | Re: Syncing CPU caches from userland on MIPS, Aurelien Jarno |
| Indexes: | [Date] [Thread] [Top] [All Lists] |