Received: from eggs.gnu.org ([208.118.235.92]:59772) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SSqgd-00081e-Of for qemu-devel@nongnu.org; Fri, 11 May 2012 10:19:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SSqgP-0006JC-Ln for qemu-devel@nongnu.org; Fri, 11 May 2012 10:19:15 -0400 Received: from nat28.tlf.novell.com ([130.57.49.28]:43119) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SSqgP-0006IX-Bh for qemu-devel@nongnu.org; Fri, 11 May 2012 10:19:01 -0400 Message-Id: <4FAD3C0802000078000830D8@nat28.tlf.novell.com> Date: Fri, 11 May 2012 15:19:20 +0100 From: "Jan Beulich" References: <4FACD9940200007800082F0D@nat28.tlf.novell.com> In-Reply-To: <4FACD9940200007800082F0D@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Subject: Re: [Qemu-devel] [Xen-devel] [PATCH] qemu/xendisk: set maximum number of grants to be used List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: xen-devel , qemu-devel@nongnu.org Cc: Olaf Hering , Stefano Stabellini >>> On 11.05.12 at 09:19, "Jan Beulich" wrote: > Legacy (non-pvops) gntdev drivers may require this to be done when the > number of grants intended to be used simultaneously exceeds a certain > driver specific default limit. >=20 > Signed-off-by: Jan Beulich >=20 > --- a/hw/xen_disk.c > +++ b/hw/xen_disk.c > @@ -536,6 +536,10 @@ static void blk_alloc(struct XenDevice * > if (xen_mode !=3D XEN_EMULATE) { > batch_maps =3D 1; > } > + if (xc_gnttab_set_max_grants(xendev->gnttabdev, > + max_requests * BLKIF_MAX_SEGMENTS_PER_REQUEST + 1) < 0) In more extensive testing it appears that very rarely this value is still too low: xen be: qdisk-768: can't map 11 grant refs (Cannot allocate memory, 342 = maps) 342 + 11 =3D 353 > 352 =3D 32 * 11 Could someone help out here? I first thought this might be due to use_aio being non-zero, but ioreq_start() doesn't permit more than max_requests struct ioreqs-s to be around. Additionally, shouldn't the driver be smarter and gracefully handle grant mapping failures (as the per-domain map track table in the hypervisor is a finite resource)? Jan > + xen_be_printf(xendev, 0, "xc_gnttab_set_max_grants failed: = %s\n", > + strerror(errno)); > } > =20 > static int blk_init(struct XenDevice *xendev)