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

On 10/08/2015 17:26, fred.kon...@greensocs.com 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