All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/15] block: Simplify drain
@ 2022-11-18 17:40 Kevin Wolf
  2022-11-18 17:40 ` [PATCH v2 01/15] qed: Don't yield in bdrv_qed_co_drain_begin() Kevin Wolf
                   ` (16 more replies)
  0 siblings, 17 replies; 31+ messages in thread
From: Kevin Wolf @ 2022-11-18 17:40 UTC (permalink / raw)
  To: qemu-block
  Cc: kwolf, eesposit, stefanha, hreitz, pbonzini, vsementsov, qemu-devel

I'm aware that exactly nobody has been looking forward to a series with
this title, but it has to be. The way drain works means that we need to
poll in bdrv_replace_child_noperm() and that makes things rather messy
with Emanuele's multiqueue work because you must not poll while you hold
the graph lock.

The other reason why it has to be is that drain is way too complex and
there are too many different cases. Some simplification like this will
hopefully make it considerably more maintainable. The diffstat probably
tells something, too.

There are roughly speaking three parts in this series:

1. Make BlockDriver.bdrv_drained_begin/end() non-coroutine_fn again,
   which allows us to not poll on bdrv_drained_end() any more.

2. Remove subtree drains. They are a considerable complication in the
   whole drain machinery (in particular, they require polling in the
   BdrvChildClass.attach/detach() callbacks that are called during
   bdrv_replace_child_noperm()) and none of their users actually has a
   good reason to use them.

3. Finally get rid of polling in bdrv_replace_child_noperm() by
   requiring that the child is already drained by the caller and calling
   callbacks only once and not again for every nested drain section.

If necessary, a prefix of this series can be merged that covers only the
first or the first two parts and it would still make sense.

v2:
- Rebased on master
- Patch 3: Removed left over _co parts in function names
- Patch 4: Updated function comments to reflect that we're not polling
  any more
- Patch 6 (new): Fix inconsistent AioContext locking for reopen code
- Patch 9 (was 8): Added comment to clarify when polling is allowed
  and the graph may change again
- Patch 11 (was 10):
  * Reworded some comments and the commit message.
  * Dropped a now unnecessary assertion that was dropped only in a later
    patch in v1 of the series.
  * Changed 'int parent_quiesce_counter' into 'bool quiesced_parent'
- Patch 12 (was 11): Don't remove ignore_bds_parents from
  bdrv_drain_poll(), it is actually still a valid optimisation there
  that makes polling O(n) instead of O(n²)
- Patch 13 (new): Instead of only removing assert(!qemu_in_coroutine())
  like in v1 of the series, drop out of coroutine context in
  bdrv_do_drained_begin_quiesce() just to be sure that we'll never get
  coroutine surprises in drain code.
- Patch 14 (was 12): More and reworded comments to make things hopefully
  a bit clearer

Kevin Wolf (15):
  qed: Don't yield in bdrv_qed_co_drain_begin()
  test-bdrv-drain: Don't yield in .bdrv_co_drained_begin/end()
  block: Revert .bdrv_drained_begin/end to non-coroutine_fn
  block: Remove drained_end_counter
  block: Inline bdrv_drain_invoke()
  block: Fix locking for bdrv_reopen_queue_child()
  block: Drain invidual nodes during reopen
  block: Don't use subtree drains in bdrv_drop_intermediate()
  stream: Replace subtree drain with a single node drain
  block: Remove subtree drains
  block: Call drain callbacks only once
  block: Remove ignore_bds_parents parameter from drain_begin/end.
  block: Drop out of coroutine in bdrv_do_drained_begin_quiesce()
  block: Don't poll in bdrv_replace_child_noperm()
  block: Remove poll parameter from bdrv_parent_drained_begin_single()

 include/block/block-global-state.h |   3 +
 include/block/block-io.h           |  58 ++---
 include/block/block_int-common.h   |  25 +-
 include/block/block_int-io.h       |  12 -
 block.c                            | 185 ++++++++++-----
 block/block-backend.c              |   4 +-
 block/io.c                         | 290 +++++------------------
 block/qed.c                        |  26 +-
 block/replication.c                |   6 -
 block/stream.c                     |  26 +-
 block/throttle.c                   |   8 +-
 blockdev.c                         |  13 -
 blockjob.c                         |   2 +-
 tests/unit/test-bdrv-drain.c       | 369 +++++++----------------------
 14 files changed, 340 insertions(+), 687 deletions(-)

-- 
2.38.1



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

end of thread, other threads:[~2022-12-12 17:31 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-18 17:40 [PATCH v2 00/15] block: Simplify drain Kevin Wolf
2022-11-18 17:40 ` [PATCH v2 01/15] qed: Don't yield in bdrv_qed_co_drain_begin() Kevin Wolf
2022-11-18 17:40 ` [PATCH v2 02/15] test-bdrv-drain: Don't yield in .bdrv_co_drained_begin/end() Kevin Wolf
2022-11-18 17:40 ` [PATCH v2 03/15] block: Revert .bdrv_drained_begin/end to non-coroutine_fn Kevin Wolf
2022-11-18 17:40 ` [PATCH v2 04/15] block: Remove drained_end_counter Kevin Wolf
2022-11-18 17:41 ` [PATCH v2 05/15] block: Inline bdrv_drain_invoke() Kevin Wolf
2022-11-18 17:41 ` [PATCH v2 06/15] block: Fix locking for bdrv_reopen_queue_child() Kevin Wolf
2022-11-25 12:56   ` Vladimir Sementsov-Ogievskiy
2022-11-18 17:41 ` [PATCH v2 07/15] block: Drain invidual nodes during reopen Kevin Wolf
2022-11-25 13:10   ` Vladimir Sementsov-Ogievskiy
2022-11-18 17:41 ` [PATCH v2 08/15] block: Don't use subtree drains in bdrv_drop_intermediate() Kevin Wolf
2022-11-18 17:41 ` [PATCH v2 09/15] stream: Replace subtree drain with a single node drain Kevin Wolf
2022-11-18 17:41 ` [PATCH v2 10/15] block: Remove subtree drains Kevin Wolf
2022-11-18 17:41 ` [PATCH v2 11/15] block: Call drain callbacks only once Kevin Wolf
2022-11-25 14:59   ` Vladimir Sementsov-Ogievskiy
2022-11-28 12:37     ` Kevin Wolf
2022-11-18 17:41 ` [PATCH v2 12/15] block: Remove ignore_bds_parents parameter from drain_begin/end Kevin Wolf
2022-11-25 15:05   ` Vladimir Sementsov-Ogievskiy
2022-11-18 17:41 ` [PATCH v2 13/15] block: Drop out of coroutine in bdrv_do_drained_begin_quiesce() Kevin Wolf
2022-11-25 15:13   ` Vladimir Sementsov-Ogievskiy
2022-11-18 17:41 ` [PATCH v2 14/15] block: Don't poll in bdrv_replace_child_noperm() Kevin Wolf
2022-11-25 16:07   ` Vladimir Sementsov-Ogievskiy
2022-11-28 12:59     ` Kevin Wolf
2022-12-09 16:53   ` Paolo Bonzini
2022-12-12  9:09     ` Paolo Bonzini
2022-12-12 15:57     ` Kevin Wolf
2022-12-12 17:31       ` Paolo Bonzini
2022-11-18 17:41 ` [PATCH v2 15/15] block: Remove poll parameter from bdrv_parent_drained_begin_single() Kevin Wolf
2022-11-25 16:08   ` Vladimir Sementsov-Ogievskiy
2022-11-24 18:26 ` [PATCH v2 00/15] block: Simplify drain Hanna Reitz
2022-11-28 13:00 ` Kevin Wolf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.