All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH v2 00/14] job: replace AioContext lock with job_mutex
@ 2021-11-04 14:53 Emanuele Giuseppe Esposito
  2021-11-04 14:53 ` [RFC PATCH v2 01/14] job.c: make job_lock/unlock public Emanuele Giuseppe Esposito
                   ` (13 more replies)
  0 siblings, 14 replies; 34+ messages in thread
From: Emanuele Giuseppe Esposito @ 2021-11-04 14:53 UTC (permalink / raw)
  To: qemu-block
  Cc: Kevin Wolf, Fam Zheng, Vladimir Sementsov-Ogievskiy,
	Wen Congyang, Xie Changlong, Emanuele Giuseppe Esposito,
	Markus Armbruster, qemu-devel, Hanna Reitz, Stefan Hajnoczi,
	Paolo Bonzini, John Snow

In this series, we want to remove the AioContext lock and instead
use the already existent job_mutex to protect the job structures
and list. This is part of the work to get rid of AioContext lock
usage in favour of smaller granularity locks.

In order to simplify reviewer's job, job lock/unlock functions and
macros are added as empty prototypes (nop) in patch 1.
They are converted to use the actual job mutex only in the last
patch, 14. In this way we can freely create locking sections
without worrying about deadlocks with the aiocontext lock.

Patch 2 defines what fields in the job structure need protection,
and patches 3-4 categorize respectively locked and unlocked
functions in the job API.

Patch 5-9 are in preparation to the job locks, they try to reduce
the aiocontext critical sections and other minor fixes.

Patch 10-13 introduces the (nop) job lock into the job API and
its users, following the comments and categorizations done in
patch 2-3-4.

Patch 14 makes the prototypes in patch 1 use the job_mutex and
removes all aiocontext lock at the same time.

Tested this series by running unit tests, qemu-iotests and qtests
(x86_64).

This serie is based on my previous series "block layer: split
block APIs in global state and I/O".

Based-on: <20211025101735.2060852-1-eesposit@redhat.com>
---
RFC v2:
* use JOB_LOCK_GUARD and WITH_JOB_LOCK_GUARD
* mu(u)ltiple typos in commit messages
* job API split patches are sent separately in another series
* use of empty job_{lock/unlock} and JOB_LOCK_GUARD/WITH_JOB_LOCK_GUARD
  to avoid deadlocks and simplify the reviewer job

Emanuele Giuseppe Esposito (14):
  job.c: make job_lock/unlock public
  job.h: categorize fields in struct Job
  job.h: define locked functions
  job.h: define unlocked functions
  block/mirror.c: use of job helpers in drivers to avoid TOC/TOU
  job.c: make job_event_* functions static
  job.c: move inner aiocontext lock in callbacks
  aio-wait.h: introduce AIO_WAIT_WHILE_UNLOCKED
  jobs: remove aiocontext locks since the functions are under BQL
  jobs: protect jobs with job_lock/unlock
  block_job_query: remove atomic read
  jobs: use job locks and helpers also in the unit tests
  jobs: add job lock in find_* functions
  job.c: enable job lock/unlock and remove Aiocontext locks

 include/block/aio-wait.h         |  15 +-
 include/qemu/job.h               | 171 ++++++++++---
 block.c                          |   6 +
 block/mirror.c                   |   8 +-
 block/replication.c              |   6 +
 blockdev.c                       |  88 +++----
 blockjob.c                       |  62 +++--
 job-qmp.c                        |  54 ++--
 job.c                            | 410 ++++++++++++++++++++++---------
 monitor/qmp-cmds.c               |   2 +
 qemu-img.c                       |   8 +-
 tests/unit/test-bdrv-drain.c     |  44 ++--
 tests/unit/test-block-iothread.c |   6 +-
 tests/unit/test-blockjob-txn.c   |  10 +
 tests/unit/test-blockjob.c       |  68 ++---
 15 files changed, 628 insertions(+), 330 deletions(-)

-- 
2.27.0



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

end of thread, other threads:[~2021-12-23 15:01 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-04 14:53 [RFC PATCH v2 00/14] job: replace AioContext lock with job_mutex Emanuele Giuseppe Esposito
2021-11-04 14:53 ` [RFC PATCH v2 01/14] job.c: make job_lock/unlock public Emanuele Giuseppe Esposito
2021-12-16 16:18   ` Stefan Hajnoczi
2021-11-04 14:53 ` [RFC PATCH v2 02/14] job.h: categorize fields in struct Job Emanuele Giuseppe Esposito
2021-12-16 16:21   ` Stefan Hajnoczi
2021-12-21 14:23     ` Emanuele Giuseppe Esposito
2021-11-04 14:53 ` [RFC PATCH v2 03/14] job.h: define locked functions Emanuele Giuseppe Esposito
2021-12-16 16:48   ` Stefan Hajnoczi
2021-12-16 17:11     ` Vladimir Sementsov-Ogievskiy
2021-12-20 10:15       ` Emanuele Giuseppe Esposito
2021-11-04 14:53 ` [RFC PATCH v2 04/14] job.h: define unlocked functions Emanuele Giuseppe Esposito
2021-12-16 16:51   ` Stefan Hajnoczi
2021-11-04 14:53 ` [RFC PATCH v2 05/14] block/mirror.c: use of job helpers in drivers to avoid TOC/TOU Emanuele Giuseppe Esposito
2021-12-18 11:53   ` Vladimir Sementsov-Ogievskiy
2021-12-20 10:34     ` Emanuele Giuseppe Esposito
2021-12-20 10:47       ` Vladimir Sementsov-Ogievskiy
2021-12-23 11:37         ` Emanuele Giuseppe Esposito
2021-11-04 14:53 ` [RFC PATCH v2 06/14] job.c: make job_event_* functions static Emanuele Giuseppe Esposito
2021-12-16 16:54   ` Stefan Hajnoczi
2021-11-04 14:53 ` [RFC PATCH v2 07/14] job.c: move inner aiocontext lock in callbacks Emanuele Giuseppe Esposito
2021-11-04 14:53 ` [RFC PATCH v2 08/14] aio-wait.h: introduce AIO_WAIT_WHILE_UNLOCKED Emanuele Giuseppe Esposito
2021-11-04 14:53 ` [RFC PATCH v2 09/14] jobs: remove aiocontext locks since the functions are under BQL Emanuele Giuseppe Esposito
2021-11-04 14:53 ` [RFC PATCH v2 10/14] jobs: protect jobs with job_lock/unlock Emanuele Giuseppe Esposito
2021-12-18 11:57   ` Vladimir Sementsov-Ogievskiy
2021-11-04 14:53 ` [RFC PATCH v2 11/14] block_job_query: remove atomic read Emanuele Giuseppe Esposito
2021-12-18 12:07   ` Vladimir Sementsov-Ogievskiy
2021-12-23 11:37     ` Emanuele Giuseppe Esposito
2021-11-04 14:53 ` [RFC PATCH v2 12/14] jobs: use job locks and helpers also in the unit tests Emanuele Giuseppe Esposito
2021-11-04 14:53 ` [RFC PATCH v2 13/14] jobs: add job lock in find_* functions Emanuele Giuseppe Esposito
2021-12-18 12:11   ` Vladimir Sementsov-Ogievskiy
2021-12-18 12:22     ` Vladimir Sementsov-Ogievskiy
2021-11-04 14:53 ` [RFC PATCH v2 14/14] job.c: enable job lock/unlock and remove Aiocontext locks Emanuele Giuseppe Esposito
2021-12-18 12:24   ` Vladimir Sementsov-Ogievskiy
2021-12-23 14:59     ` Emanuele Giuseppe Esposito

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.