Merge tag 'iommu-updates-v4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/joro...
[deliverable/linux.git] / drivers / xen / balloon.c
index dc4305b407bf6756791ec9b31e7929c1fe5c3ca8..7c8a2cf16f58b440bd4a7f23053fd6dea199f810 100644 (file)
@@ -338,7 +338,16 @@ static enum bp_state reserve_additional_memory(void)
        }
 #endif
 
-       rc = add_memory_resource(nid, resource);
+       /*
+        * add_memory_resource() will call online_pages() which in its turn
+        * will call xen_online_page() callback causing deadlock if we don't
+        * release balloon_mutex here. Unlocking here is safe because the
+        * callers drop the mutex before trying again.
+        */
+       mutex_unlock(&balloon_mutex);
+       rc = add_memory_resource(nid, resource, memhp_auto_online);
+       mutex_lock(&balloon_mutex);
+
        if (rc) {
                pr_warn("Cannot add additional memory (%i)\n", rc);
                goto err;
This page took 0.023586 seconds and 5 git commands to generate.