Hello,
Please forgive my little knowledge about qemu internals.
Some time ago I had an idea that might improve usage of qemu user mode
(I believe) and I would like to get your thoughts about it.
Context: qemu-user is used by more and more people to run containers
(e.g. docker) based on a different CPU architecture (e.g. the OS of a
raspberry pi). With linux kernel module "binfmt_misc", the emulation is
handled transparently by qemu. Usually, a shell session will be run
first, and then many subprocesses. And of course, each of these
processes is actually a qemu process running in "user-mode". For
example, if one types "make" to compile some code, there will be a "qemu
make" process, then probably 10 or more "qemu gcc" processes, etc. Since
all of these are different qemu processes, they do not share any
knowledge, so each time a new one is spawn, it has to translate the
binary code of libc, ld-linux, any other library it uses, its own binary
code, etc. When it ends, all this work is lost, and new processes will
have to reprocess a big part of the very same code over and over again.
So the idea is: what if we could share the cache of code already
translated between all those processes?
There would be sereral ways to achieve this:
* use a shared memory area for the cache, and locking mechanisms.
* have a (maybe optional) daemon that would manage the cache of all
processes.
* python-like model: the first time a binary or library is translated,
save this translated code in a cache file next to the original file,
with different extension.
Please let me know what you think about it, if something similar has
already been studied, or if I miss something obvious.
Thanks
Etienne
--
Etienne Dublé
CNRS / LIG - Bâtiment IMAG
700 avenue Centrale - 38401 St Martin d'Hères
Bureau 426 - Tel 0457421431