Skip to content

migration/tls: Graceful shutdowns for main and postcopy channels

Peter Xu qemu-devel 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest2 patches 5 repliesIn review
  2. v23 patches 13 repliesSuperseded
  3. v13 patches 10 repliesSuperseded

Changes in v3 from the cover letter

- Patch 1
- Update qcrypto_tls_session_read() doc to reflect the new retval [Dan]
- Update commit message to explain the qatomic_read() change [Dan]
- Patch 2 (old)
- Dropped for now, more at the end

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2io/crypto: Move tls premature termination handling into QIO layercrypto/tlssession.c include/crypto/tlssession.h io/channel-tls.c+24 -140 replies
2/2migration: Make migration_has_failed() work even for CANCELLINGmigration/migration.c+2 -10 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchDaniel P. BerrangéJuraj MarcinFabiano Rosas
1/2R-b R-b R-b
2/2R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v3 thread

Cover letter [PATCH v3 0/2] migration/tls: Graceful shutdowns for main and postcopy channels

v3:
- Patch 1
- Update qcrypto_tls_session_read() doc to reflect the new retval [Dan]
- Update commit message to explain the qatomic_read() change [Dan]
- Patch 2 (old)
- Dropped for now, more at the end

This is v3 of the series.

Fabiano fixed graceful shutdowns for multifd channels previously:

https://lore.kernel.org/qemu-devel/[email protected]/

However we can still see an warning when running preempt unit test on TLS, even though migration functionality will not be affected:

QTEST_QEMU_BINARY=./qemu-system-x86_64 ./tests/qtest/migration-test --full -r /x86_64/migration/postcopy/preempt/tls/psk
...
qemu-kvm: Cannot read from TLS channel: The TLS connection was non-properly terminated.
...

It turns out this is because the crypto code only passes the ->shutdown field into the read function, however that value can change concurrently in another thread by a concurrent qio_channel_shutdown().

Patch 1 should fix this issue.

Patch 2 is something I found when looking at this problem, there's no known issues I am aware of with them, however I still think they're logically flawed, so I post them together here.

Please review, thanks.

============= ABOUT OLD PATCH 2 ===================

I dropped it for now to unblock almost patch 1, because patch 1 will fix a real warning that can be triggered for not only qtest but also normal tls postcopy migration.

While I was looking at temporary settings for multifd send iochannels to be blocking always, I found I cannot explain how migration_tls_channel_end() currently works, because it writes to the multifd iochannels while the channels should still be owned (and can be written at the same time?) by the sender threads. It sounds like a thread-safety issue, or is it not?

Peter Xu (2):
io/crypto: Move tls premature termination handling into QIO layer
migration: Make migration_has_failed() work even for CANCELLING

 include/crypto/tlssession.h | 10 +++-------
 crypto/tlssession.c         |  7 ++-----
 io/channel-tls.c            | 21 +++++++++++++++++++--
 migration/migration.c       |  3 ++-
 4 files changed, 26 insertions(+), 15 deletions(-)
Signature · 1 line
2.50.1