From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51455) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVYhi-0006t3-Jk for qemu-devel@nongnu.org; Wed, 11 Mar 2015 00:57:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YVYhf-0002tW-Uj for qemu-devel@nongnu.org; Wed, 11 Mar 2015 00:57:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60401) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVYhf-0002tO-NE for qemu-devel@nongnu.org; Wed, 11 Mar 2015 00:57:07 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t2B4v5cs018811 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 11 Mar 2015 00:57:05 -0400 Date: Wed, 11 Mar 2015 12:57:01 +0800 From: Fam Zheng Message-ID: <20150311045701.GC1437@ad.nay.redhat.com> References: <1425973810-22831-1-git-send-email-famz@redhat.com> <1425973810-22831-2-git-send-email-famz@redhat.com> <54FED227.40100@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <54FED227.40100@redhat.com> Subject: Re: [Qemu-devel] [PATCH 1/2] exec: Convert bounce buffer to a set List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org On Tue, 03/10 12:14, Paolo Bonzini wrote: > > > On 10/03/2015 08:50, Fam Zheng wrote: > > + QLIST_ENTRY(BounceBuffer) next; > > Where is this used? Unused, I will remove this. > > > - if (buffer != bounce.buffer) { > > + BounceBuffer *bounce; > > + > > + bounce = bounce_buffer_find_and_remove(buffer); > > + if (!bounce) { > > I'm afraid that this adds a mutex lock/unlock pair and a hash table > lookup on a very hot path. One possibility is to add a check that the > hash table is not empty in bounce_buffer_find_and_remove. That can be > done outside the lock so it's fast. > > I'm also wondering if it's okay to let the guest do arbitrarily large > memory allocations (e.g. DMA from a huge unassigned memory area above > guest RAM); effectively you're disabling the "/* Avoid unbounded > allocations */" safety guard. This is a good point, it is dangerous to allow that. > > Is it hard to do this while keeping map_clients? We might need to keep map_client for above reason. I'll take another look into it. Fam