This breaks qemu-io test for me. #0 0x000003ff98f3e2d4 in raise () at /lib64/libc.so.6 #1 0x000003ff98f239a8 in abort () at /lib64/libc.so.6 #2 0x000003ff98f3632e in __assert_fail_base () at /lib64/libc.so.6 #3 0x000003ff98f363ac in () at /lib64/libc.so.6 #4 0x000000000108301a in qemu_balloon_inhibit (state=state@entry=false) at /home/cborntra/REPOS/qemu/balloon.c:56 #5 0x00000000012026f2 in postcopy_ram_incoming_cleanup (mis=mis@entry=0x163bc5c0) at /home/cborntra/REPOS/qemu/migration/postcopy-ram.c:542 #6 0x00000000011eed5e in process_incoming_migration_co (opaque=<optimized out>) at /home/cborntra/REPOS/qemu/migration/migration.c:407 #7 0x0000000001374000 in coroutine_trampoline (i0=<optimized out>, i1=<optimized out>) at /home/cborntra/REPOS/qemu/util/coroutine-ucontext.c:116 #8 0x000003ff98f53c02 in __makecontext_ret () at /lib64/libc.so.6
Cant see right now whats wrong. On 08/17/2018 07:08 PM, Alex Williamson wrote: > A simple true/false internal state does not allow multiple users. Fix > this within the existing interface by converting to a counter, so long > as the counter is elevated, ballooning is inhibited. > > Reviewed-by: David Hildenbrand <da...@redhat.com> > Reviewed-by: Peter Xu <pet...@redhat.com> > Reviewed-by: Cornelia Huck <coh...@redhat.com> > Signed-off-by: Alex Williamson <alex.william...@redhat.com> > --- > balloon.c | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/balloon.c b/balloon.c > index 6bf0a9681377..931987983858 100644 > --- a/balloon.c > +++ b/balloon.c > @@ -26,6 +26,7 @@ > > #include "qemu/osdep.h" > #include "qemu-common.h" > +#include "qemu/atomic.h" > #include "exec/cpu-common.h" > #include "sysemu/kvm.h" > #include "sysemu/balloon.h" > @@ -37,16 +38,22 @@ > static QEMUBalloonEvent *balloon_event_fn; > static QEMUBalloonStatus *balloon_stat_fn; > static void *balloon_opaque; > -static bool balloon_inhibited; > +static int balloon_inhibit_count; > > bool qemu_balloon_is_inhibited(void) > { > - return balloon_inhibited; > + return atomic_read(&balloon_inhibit_count) > 0; > } > > void qemu_balloon_inhibit(bool state) > { > - balloon_inhibited = state; > + if (state) { > + atomic_inc(&balloon_inhibit_count); > + } else { > + atomic_dec(&balloon_inhibit_count); > + } > + > + assert(atomic_read(&balloon_inhibit_count) >= 0); > } > > static bool have_balloon(Error **errp) > >