trent.t...@gmail.com writes: > Does anyone have profiles on how much time QEMU spends in translating > instructions. QEMU does not have a baseline interpreter nor does it > translate on trace-granularity. so i imagine QEMU must spend quite a bit > of time translating instructions.
Not as much as you'd think. The translation stage isn't very complex and blocks only get translated once (modulo exceptions and self modifying code). If you run perf on your task you should see most of the time is spent in the generated code - if not please send the test case to the list. I suspect the more useful statistic would be getting a break down of the translation blocks and seeing which ones are the most heavily used and examining if QEMU has done as good a job as it can of translating them. > Is it possible for QEMU to obviate some of the translations by attaching a > signature (e.g. a hash) with every translated basic block and try to reuse > translated basic block based on the signature as much as possible ? Reuses > can be a result of rerunning programs or same libraries statically linked > to programs. Your right a translation cache *could* save some translation time, especially if you end up translating the same program over and over again. Having said that you might find the cost of computing the checksum obviates any speed-up from skipping the translation. After all QEMU only needs to look at each subject instruction once normally. Using QEMU linux-user for cross building would be the obvious pain point. However as the usual use case is building for embedded platforms most users are just happy to fully utilise their 80-core build machines in preference to having a farm of slow embedded processors. > This could end up saving some translation time. I think you would need to do some performance analysis and come up with some numbers before you made that assumption. Cheers, -- Alex Bennée QEMU/KVM Hacker for Linaro