[libvirt] [PATCH v5] Add functions for handling exponential backoff loops.
Peter Krempa
pkrempa at redhat.com
Fri Apr 15 14:59:03 UTC 2016
On Fri, Apr 15, 2016 at 16:45:07 +0200, Michal Privoznik wrote:
> On 15.04.2016 13:53, Richard W.M. Jones wrote:
> > In a few places in libvirt we busy-wait for events, for example qemu
> > creating a monitor socket. This is problematic because:
> >
> > - We need to choose a sufficiently small polling period so that
> > libvirt doesn't add unnecessary delays.
> >
> > - We need to choose a sufficiently large polling period so that
> > the effect of busy-waiting doesn't affect the system.
> >
> > The solution to this conflict is to use an exponential backoff.
> >
> > This patch adds two functions to hide the details, and modifies a few
> > places where we currently busy-wait.
> > ---
> > src/fdstream.c | 10 +++---
> > src/libvirt_private.syms | 2 ++
> > src/qemu/qemu_agent.c | 9 +++---
> > src/qemu/qemu_monitor.c | 10 +++---
> > src/util/virtime.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++
> > src/util/virtime.h | 11 +++++++
> > 6 files changed, 111 insertions(+), 12 deletions(-)
>
> ACK. Sorry for making you send v5 to such simple patch.
GCC 5.3.0 doesn't like this very much:
qemu/qemu_agent.c:238:8: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized]
if (ret != 0) {
qemu/qemu_monitor.c:369:8: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized]
if (ret != 0) {
The static analyzer considers the possibility that the while loop will
never execute, which would be possible in a very strange lockup of the
host.
Please initialize ret to -1 before pushing in those two functions.
Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160415/97989b5f/attachment-0001.sig>
More information about the libvir-list
mailing list