On Thu, Mar 07, 2013 at 02:09:50PM +0100, Peter Krempa wrote: > Qemu's implementation of virtio RNG supports rate limiting of the > entropy used. This patch exposes the option to tune this functionality. > > This patch is based on qemu commit 904d6f588063fb5ad2b61998acdf1e73fb4 > > The rate limiting is exported in the XML as: > <devices> > ... > <rng model='virtio'> > <rate period='1234'>4321</rate> I find it wierd that we're mixing use of attributes with text content here. I'd expect one style, or the other eg <rate period="1234" bytes="4321"/> or <rate> <period>1234</period> <bytes>5432</bytes> </rate> I prefer the style using attributes myself. > diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h > index 2509193..e19b5c0 100644 > --- a/src/conf/domain_conf.h > +++ b/src/conf/domain_conf.h > @@ -1721,6 +1721,8 @@ enum virDomainRNGBackend { > struct _virDomainRNGDef { > int model; > int backend; > + unsigned int rate; /* bits per period */ Why are we using bits instead of bytes ? Do we really need to be able to control this rate with a granularity of bits? It seems overkill to me > diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c > index 201fac1..c0f8dd2 100644 > --- a/src/qemu/qemu_command.c > +++ b/src/qemu/qemu_command.c > @@ -4255,6 +4255,15 @@ qemuBuildRNGDeviceArgs(virCommandPtr cmd, > > virBufferAsprintf(&buf, "virtio-rng-pci,rng=%s", dev->info.alias); > > + if (dev->rate > 0) { > + /* qemu uses bytes */ > + virBufferAsprintf(&buf, ",max-bytes=%u", dev->rate / 8); I expect we need to use VIR_DIV_UP here ? Though we can avoid it if we just store bytes ourselves. Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list