On Sun, May 11, 2025 at 03:08:24PM +0900, Akihiko Odaki wrote: > rp_pong_acks tells if it has ever received one pong. QemuEvent is > better suited for this usage because it represents a boolean rather > than integer and will not decrement with the wait operation. > > pause_event can utilize qemu_event_reset() to discard events. > > Signed-off-by: Akihiko Odaki <akihiko.od...@daynix.com> > --- > migration/migration.h | 6 +++--- > migration/migration.c | 29 +++++++++++++---------------- > 2 files changed, 16 insertions(+), 19 deletions(-) > > diff --git a/migration/migration.h b/migration/migration.h > index d53f7cad84d8..11dba5f4da77 100644 > --- a/migration/migration.h > +++ b/migration/migration.h > @@ -342,11 +342,11 @@ struct MigrationState { > */ > QemuSemaphore rp_sem; > /* > - * We post to this when we got one PONG from dest. So far it's an > + * We set this when we got one PONG from dest. So far it's an > * easy way to know the main channel has successfully established > * on dest QEMU. > */ > - QemuSemaphore rp_pong_acks; > + QemuEvent rp_pong_acks;
If to do the switch then it needs a rename too because "acks" imply a non-boolean. For this one, when introduced it was indeed kept in mind that it might at some point be useful to count for more than one. For the other one, it is definitely an improvement to use QemuEvent especially on the tricky reset.. How about keeping rp_pong_acks as-is, and keep the patch for replacing pause_sem? Thanks, -- Peter Xu