qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] block: protect BlockBackend->queued_requests with a lock
@ 2023-03-07 21:04 Stefan Hajnoczi
  2023-03-07 21:04 ` [PATCH v2 1/3] block: make BlockBackend->quiesce_counter atomic Stefan Hajnoczi
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Stefan Hajnoczi @ 2023-03-07 21:04 UTC (permalink / raw)
  To: qemu-devel
  Cc: Hanna Reitz, Kevin Wolf, qemu-block, Emanuele Giuseppe Esposito,
	Paolo Bonzini, Stefan Hajnoczi

v2:
- Use qatomic_fetch_inc/dec() for readability in Patch 1 [Hanna]

QEMU block layer multi-queue support involves running I/O requests from
multiple threads. Shared state must be protected somehow to avoid thread-safety
issues.

The BlockBackend->queued_requests CoQueue is accessed without a lock and will
likely be corrupted when multiple threads queue requests at the same time.

This patch series make BlockBackend->queued_requests thread-safe.

Stefan Hajnoczi (3):
  block: make BlockBackend->quiesce_counter atomic
  block: make BlockBackend->disable_request_queuing atomic
  block: protect BlockBackend->queued_requests with a lock

 block/block-backend.c | 37 ++++++++++++++++++++++++++-----------
 1 file changed, 26 insertions(+), 11 deletions(-)

-- 
2.39.2



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-03-09 13:38 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-07 21:04 [PATCH v2 0/3] block: protect BlockBackend->queued_requests with a lock Stefan Hajnoczi
2023-03-07 21:04 ` [PATCH v2 1/3] block: make BlockBackend->quiesce_counter atomic Stefan Hajnoczi
2023-03-07 21:10   ` Philippe Mathieu-Daudé
2023-03-07 21:04 ` [PATCH v2 2/3] block: make BlockBackend->disable_request_queuing atomic Stefan Hajnoczi
2023-03-07 21:10   ` Philippe Mathieu-Daudé
2023-03-09  9:07   ` Paolo Bonzini
2023-03-09 12:31     ` Stefan Hajnoczi
2023-03-09 13:37       ` Paolo Bonzini
2023-03-09 11:18   ` Paolo Bonzini
2023-03-09 12:12     ` Stefan Hajnoczi
2023-03-07 21:04 ` [PATCH v2 3/3] block: protect BlockBackend->queued_requests with a lock Stefan Hajnoczi
2023-03-08  9:46 ` [PATCH v2 0/3] " Kevin Wolf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).