From: Wei Liu Subject: Re: [PATCH v2 1/8] tmem: Don't crash/hang/leak hypervisor when using shared pools within an guest. Date: Thu, 27 Aug 2015 12:21:32 +0100 Message-ID: <20150827112132.GG22586@zion.uk.xensource.com> References: <1440673323-6648-1-git-send-email-konrad.wilk@oracle.com> <1440673323-6648-2-git-send-email-konrad.wilk@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZUvFS-0005xL-Kt for xen-devel@lists.xenproject.org; Thu, 27 Aug 2015 11:21:38 +0000 Content-Disposition: inline In-Reply-To: <1440673323-6648-2-git-send-email-konrad.wilk@oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Konrad Rzeszutek Wilk Cc: xen-devel@lists.xenproject.org, wei.liu2@citrix.com, jbeulich@suse.com, andrew.cooper3@citrix.com List-Id: xen-devel@lists.xenproject.org On Thu, Aug 27, 2015 at 07:01:56AM -0400, Konrad Rzeszutek Wilk wrote: [...] > Signed-off-by: Konrad Rzeszutek Wilk > --- > xen/common/tmem.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/xen/common/tmem.c b/xen/common/tmem.c > index f2dc26e..572944e 100644 > --- a/xen/common/tmem.c > +++ b/xen/common/tmem.c > @@ -1037,6 +1037,9 @@ static int shared_pool_join(struct tmem_pool *pool, struct client *new_client) > tmem_client_info("adding new %s %d to shared pool owned by %s %d\n", > tmem_client_str, new_client->cli_id, tmem_client_str, > pool->client->cli_id); > + else if (pool->shared_count) Coding style. > + tmem_client_info("inter-guest sharing of shared pool %s by client %d\n", > + tmem_client_str, pool->client->cli_id); > ++pool->shared_count; > return 0; > } > @@ -1056,7 +1059,10 @@ static void shared_pool_reassign(struct tmem_pool *pool) > } > old_client->pools[pool->pool_id] = NULL; > sl = list_entry(pool->share_list.next, struct share_list, share_list); > - ASSERT(sl->client != old_client); > + /* > + * The sl->client can be old_client if there are multiple shared pools > + * within an guest. > + */ > pool->client = new_client = sl->client; > for (poolid = 0; poolid < MAX_POOLS_PER_DOMAIN; poolid++) > if (new_client->pools[poolid] == pool) > @@ -1982,6 +1988,8 @@ static int do_tmem_new_pool(domid_t this_cli_id, > { > INIT_LIST_HEAD(&pool->share_list); > pool->shared_count = 0; > + if (shared_pool_join(pool, client)) Coding style. > + goto fail; > global_shared_pools[first_unused_s_poolid] = pool; > } > } > -- > 2.1.0