qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC PATCH V7 01/19] cpus: protect queued_work_* with w


From: Frederic Konrad
Subject: Re: [Qemu-devel] [RFC PATCH V7 01/19] cpus: protect queued_work_* with work_mutex.
Date: Mon, 10 Aug 2015 18:04:19 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

On 10/08/2015 17:59, Paolo Bonzini wrote:

On 10/08/2015 17:26, address@hidden wrote:
+ qemu_mutex_lock(&cpu->work_mutex);
      while ((wi = cpu->queued_work_first)) {
          cpu->queued_work_first = wi->next;
+        qemu_mutex_unlock(&cpu->work_mutex);
          wi->func(wi->data);
+        qemu_mutex_lock(&cpu->work_mutex);
          wi->done = true;
This should be atomic_mb_set

Isn't that protected by the mutex? Or maybe it's used somewhere else?

          if (wi->free) {
              g_free(wi);
          }
      }
      cpu->queued_work_last = NULL;
... and I'm a bit afraid of leaving the state of the list inconsistent,
so I'd move this after the cpu->queued_work_first assignment.  Otherwise
the patch looks good, I'm queuing it for 2.5.

Paolo

+    qemu_mutex_unlock(&cpu->work_mutex);
+




reply via email to

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