* Resuming VM on network requests
@ 2025-11-24 8:52 Jan Kiszka
0 siblings, 0 replies; only message in thread
From: Jan Kiszka @ 2025-11-24 8:52 UTC (permalink / raw)
To: qemu-devel
Hi all,
via a quick hack, I realized a power-saving optimization for a VM that
serves sporadic network requests:
diff --git a/net/slirp.c b/net/slirp.c
index 120eef6122..f6b0ddc846 100644
--- a/net/slirp.c
+++ b/net/slirp.c
@@ -40,6 +40,7 @@
#include "qemu/sockets.h"
#include <libslirp.h>
#include "chardev/char-fe.h"
+#include "system/runstate.h"
#include "system/system.h"
#include "qemu/cutils.h"
#include "qapi/error.h"
@@ -120,6 +121,8 @@ static ssize_t net_slirp_send_packet(const void *pkt, size_t pkt_len,
uint8_t min_pkt[ETH_ZLEN];
size_t min_pktsz = sizeof(min_pkt);
+ qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER, NULL);
+
if (net_peer_needs_padding(&s->nc)) {
if (eth_pad_short_frame(min_pkt, &min_pktsz, pkt, pkt_len)) {
pkt = min_pkt;
This plus suspend-to-ram inside the VM after some idle time gives a
nice workload reduction for the host. But it is a hack, just working too
well to make we wonder if there could be a way to get this modeled also
without a patch.
Do I rather have to write a proxy service that hooks into the traffic
targeting the VM and performs the wakeup via QMP? Or is there a chance
to get something similar to serial [1] also into the network path?
Ideas would be welcome.
TIA!
Jan
[1] https://gitlab.com/qemu-project/qemu/-/commit/9826fd597df59a8bac7beafd192e4baad790c31a
--
Siemens AG, Foundational Technologies
Linux Expert Center
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2025-11-24 8:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-24 8:52 Resuming VM on network requests Jan Kiszka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).