On 10/10/21 21:10, Adam Lackorzynski wrote:
Use DMA transfers in the multiboot loader to copy
data.

This significantly lowers QEMU's startup latency by
a factor of about 40, for example, going from 30sec
to 0.8sec when loading modules of 120MB in size.
This change has been used successfully for some time.

Signed-off-by: Marcus Hähnel<marcus.haeh...@kernkonzept.com>
Signed-off-by: Adam Lackorzynski<a...@l4re.org>
---
  pc-bios/multiboot.bin         | Bin 1024 -> 1536 bytes
  pc-bios/optionrom/multiboot.S |  10 ++---
  pc-bios/optionrom/optionrom.h |  77 ++++++++++++++++++++++++++++++++++
  3 files changed, 82 insertions(+), 5 deletions(-)

This would break migration to QEMU 2.4 and earlier - which is in fact why linuxboot has a completely different option ROM when DMA is in use.

On my system (a relatively recent laptop) I get 15-20 MiB per second, which is slow but not as slow as what you got. Out of curiosity, can you test what you get with the following kernel patch?

diff --git a/arch/x86/kvm/kvm_emulate.h b/arch/x86/kvm/kvm_emulate.h
index 798508e8b6f5..5853ae93bcb2 100644
--- a/arch/x86/kvm/kvm_emulate.h
+++ b/arch/x86/kvm/kvm_emulate.h
@@ -272,7 +272,7 @@ struct fetch_cache {
 };

 struct read_cache {
-       u8 data[1024];
+       u8 data[4096];
        unsigned long pos;
        unsigned long end;
 };


Paolo


Reply via email to