Skip to content

RFC migration: Fix multifd qemu_mutex_destroy race

Fabiano Rosas qemu-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 RFC Latest4 patches 3 repliesIn review
  2. v1 RFC2 patches 14 repliesSuperseded

changes from the cover letter

- dropped the Error patch
- removed p->running
- joined the TLS thread

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4migration/multifd: Stop setting p->ioc before connectingmigration/multifd.c+1 -22 replies
2/4migration/multifd: Join the TLS threadmigration/multifd.c migration/multifd.h+10 -11 reply
3/4migration/multifd: Remove p->runningmigration/multifd.c migration/multifd.h+22 -270 replies
4/4migration/multifd: Move semaphore release into main threadmigration/migration.c migration/multifd.c+20 -170 replies

Reviews trailers per patch

1 of 4 patches has a Reviewed-by or Acked-by.

PatchPeter XuJuan Quintela
1/4R-b R-b
2/4
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [RFC PATCH v2 0/4] migration: Fix multifd qemu_mutex_destroy race

changes:
- dropped the Error patch
- removed p->running
- joined the TLS thread

v1:
https://lore.kernel.org/r/[email protected]

We're calling qemu_sem_post() in threads other than the multifd channel and the migration thread. This is vulnerable to a race with multifd_save_cleanup() which calls qemu_sem_destroy(). If we attempt to destroy the semaphore mutex with the lock taken, the code asserts.

We're hitting this in the current master and we've had reports of this in the past already:

[PATCH] migrate/multifd: fix coredump when the multifd thread cleanup
https://lore.kernel.org/r/[email protected]

Fabiano Rosas (4):
migration/multifd: Stop setting p->ioc before connecting migration/multifd: Join the TLS thread migration/multifd: Remove p->running migration/multifd: Move semaphore release into main thread

 migration/migration.c |  4 +-
 migration/multifd.c   | 87 +++++++++++++++++++++++--------------------
 migration/multifd.h   |  9 ++---
 3 files changed, 53 insertions(+), 47 deletions(-)
Signature · 1 line
2.35.3