qemu xen-console, limit buffering
PATCH 1/1 qemu xen-console, limit buffering
Running this script from within a PV guest without having an xm console attached can use all dom0 memory.
while [ 1 ]; do ls -lR /usr > /dev/xvc0; done
Start of script: (1% mem usage)
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 10281 root 15 0 76536 14m 2448 S 2 1.0
0:00.61 qemu-dm
Couple minutes later: (17% mem usage)
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
10281 root 16 0 291m 231m 2448 R 15 17.0
0:16.34 qemu-dm
Much later: (72.8% mem usage)
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
10281 root 15 0 1052m 989m 2448 S 10 72.8
1:13.25 qemu-dm
Attached patch sets dom->buffer.max_capacity to xend configured limit.
Please apply to xen-unstable tip.
tools/ioemu/hw/xen_console.c +6 -2
@@ -160,16 +160,18 @@ int xs_gather(struct xs_handle *xs, consstatic int domain_create_ring (struct domain *dom) { -int err, remote_port, ring_ref, rc; +int err, remote_port, ring_ref, limit, rc; err =xs_gather (dom->xsh, dom->serialpath,"ring-ref" ,"%u" , &ring_ref,"port" ,"%i" , &remote_port, +"limit" ,"%i" , &limit,NULL );if (err) { err =xs_gather (dom->xsh, dom->conspath,"ring-ref" ,"%u" , &ring_ref,"port" ,"%i" , &remote_port, +"limit" ,"%i" , &limit,NULL );if (err) {fprintf (stderr,"Console: failed to find ring-ref/port yet\n" );
@@ -178,7 +180,9 @@ static int domain_create_ring(struct dom dom->use_consolepath =1 ; }else dom->use_consolepath =0 ; -fprintf (stderr,"Console: got ring-ref %d port %d\n" , ring_ref, remote_port); + dom->buffer.max_capacity = limit; +fprintf (stderr,"Console: got ring-ref %d port %d limit %d\n" , + ring_ref, remote_port, limit);if ((ring_ref == dom->ring_ref) && (remote_port == dom->remote_port)) goto out;
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel