Received: from eggs.gnu.org ([2001:4830:134:3::10]:33682) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLwX2-0007gn-1Q for qemu-devel@nongnu.org; Thu, 12 Feb 2015 11:22:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YLwWy-0000cy-0j for qemu-devel@nongnu.org; Thu, 12 Feb 2015 11:22:23 -0500 Received: from e33.co.us.ibm.com ([32.97.110.151]:45851) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLwWx-0000cF-P0 for qemu-devel@nongnu.org; Thu, 12 Feb 2015 11:22:19 -0500 Received: from /spool/local by e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 12 Feb 2015 09:22:16 -0700 Received: from b03cxnp08025.gho.boulder.ibm.com (b03cxnp08025.gho.boulder.ibm.com [9.17.130.17]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id 698193E40041 for ; Thu, 12 Feb 2015 09:22:14 -0700 (MST) Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t1CGMGGk24248440 for ; Thu, 12 Feb 2015 09:22:16 -0700 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t1CGLnxd003924 for ; Thu, 12 Feb 2015 09:21:49 -0700 From: Matthew Rosato Date: Thu, 12 Feb 2015 11:21:31 -0500 Message-Id: <1423758091-26462-1-git-send-email-mjrosato@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH] memory: Fix double unref of flatview List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, famz@redhat.com, borntraeger@de.ibm.com Since 374f2981d1 "memory: protect current_map by RCU", address_space_update_topology unrefs the old_flatview twice, once by call_rcu and once by direct call. This patch removes the direct call in favor of the call_rcu. Fixes at least one assertion failure seen in s390, where a ref count for a memory region attempts to go negative during hot-unplug of guest memory. Signed-off-by: Matthew Rosato --- memory.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/memory.c b/memory.c index 130152c..d08abe5 100644 --- a/memory.c +++ b/memory.c @@ -755,7 +755,6 @@ static void address_space_update_topology(AddressSpace *as) /* Writes are protected by the BQL. */ atomic_rcu_set(&as->current_map, new_view); - call_rcu(old_view, flatview_unref, rcu); /* Note that all the old MemoryRegions are still alive up to this * point. This relieves most MemoryListeners from the need to @@ -763,7 +762,7 @@ static void address_space_update_topology(AddressSpace *as) * outside the iothread mutex, in which case precise reference * counting is necessary. */ - flatview_unref(old_view); + call_rcu(old_view, flatview_unref, rcu); address_space_update_ioeventfds(as); } -- 1.7.9.5