[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v5 01/20] job.c: make job_mutex and job_lock/unlock() public
From: |
Stefan Hajnoczi |
Subject: |
Re: [PATCH v5 01/20] job.c: make job_mutex and job_lock/unlock() public |
Date: |
Thu, 10 Feb 2022 15:38:18 +0000 |
On Tue, Feb 08, 2022 at 09:34:54AM -0500, Emanuele Giuseppe Esposito wrote:
> job mutex will be used to protect the job struct elements and list,
> replacing AioContext locks.
>
> Right now use a shared lock for all jobs, in order to keep things
> simple. Once the AioContext lock is gone, we can introduce per-job
> locks.
>
> To simplify the switch from aiocontext to job lock, introduce
> *nop* lock/unlock functions and macros.
> We want to always call job_lock/unlock outside the AioContext locks,
> and not vice-versa, otherwise we might get a deadlock. This is not
> straightforward to do, and that's why we start with nop functions.
> Once everything is protected by job_lock/unlock, we can change the nop into
> an actual mutex and remove the aiocontext lock.
>
> Since job_mutex is already being used, add static
> real_job_{lock/unlock} for the existing usage.
>
> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
> ---
> include/qemu/job.h | 24 ++++++++++++++++++++++++
> job.c | 35 +++++++++++++++++++++++------------
> 2 files changed, 47 insertions(+), 12 deletions(-)
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
signature.asc
Description: PGP signature
- [PATCH v5 00/20] job: replace AioContext lock with job_mutex, Emanuele Giuseppe Esposito, 2022/02/08
- [PATCH v5 01/20] job.c: make job_mutex and job_lock/unlock() public, Emanuele Giuseppe Esposito, 2022/02/08
- Re: [PATCH v5 01/20] job.c: make job_mutex and job_lock/unlock() public,
Stefan Hajnoczi <=
- [PATCH v5 09/20] jobs: add job lock in find_* functions, Emanuele Giuseppe Esposito, 2022/02/08
- [PATCH v5 03/20] job.c: API functions not used outside should be static, Emanuele Giuseppe Esposito, 2022/02/08
- [PATCH v5 04/20] job.c: move inner aiocontext lock in callbacks, Emanuele Giuseppe Esposito, 2022/02/08
- [PATCH v5 02/20] job.h: categorize fields in struct Job, Emanuele Giuseppe Esposito, 2022/02/08