qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 01/16] job.c: make job_mutex and job_lock/unlock() public


From: Paolo Bonzini
Subject: Re: [PATCH v3 01/16] job.c: make job_mutex and job_lock/unlock() public
Date: Wed, 19 Jan 2022 12:13:51 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0

On 1/19/22 10:56, Paolo Bonzini wrote:
On 1/5/22 15:01, 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.

Not even needed in my opinion, this is not a fast path.  But we'll see.

To simplify the switch from aiocontext to job lock, introduce
*nop* lock/unlock functions and macros. Once everything is protected
by jobs, we can add the mutex and remove the aiocontext.

Since job_mutex is already being used, add static
real_job_{lock/unlock}.

Out of curiosity, what breaks if the real job lock is used from the start?  (It probably should be mentioned in the commit message).


-static void job_lock(void)
+static void real_job_lock(void)
  {
      qemu_mutex_lock(&job_mutex);
  }
-static void job_unlock(void)
+static void real_job_unlock(void)
  {
      qemu_mutex_unlock(&job_mutex);
  }

Would it work to

#define job_lock real_job_lock
#define job_unlock real_job_unlock

instead of having to do the changes below?

Ignore all this, please.

Paolo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]