From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55622) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c7N8v-0000JJ-Ly for qemu-devel@nongnu.org; Thu, 17 Nov 2016 08:54:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c7N8u-0001Ec-S2 for qemu-devel@nongnu.org; Thu, 17 Nov 2016 08:54:21 -0500 Date: Thu, 17 Nov 2016 14:54:09 +0100 From: Olaf Hering Message-ID: <20161117135409.GA31152@aepfle.de> References: <1459513321-3776-1-git-send-email-olaf@aepfle.de> <56FEAD92.5010802@redhat.com> <20160401174953.GD22458@aepfle.de> <7bcb7f33-5fb1-20d8-e92f-3b913b54e53b@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <7bcb7f33-5fb1-20d8-e92f-3b913b54e53b@redhat.com> Subject: Re: [Qemu-devel] [Qemu-block] [PATCH] block: split large discard requests from block frontend List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org, Kevin Wolf , Stefan Hajnoczi On Fri, May 06, Max Reitz wrote: > On 01.04.2016 19:49, Olaf Hering wrote: > > On Fri, Apr 01, Max Reitz wrote: > >=20 > >> In any case, do you have a test case where a guest was able to submit a > >> request that led to the overflow error you described in the commit mes= sage? > >=20 > > mkfs -t ext4 /dev/sdb1 in a xen guest with qcow2 as backing device. > > When I added discard support to libxl I worked with raw images, so I did > > not notice this. Not sure why it happens to work in kvm guests. I assume > > the frontend driver just works around the qemu bug by limiting its > > request size. >=20 > Sorry for not having replied in so long. >=20 > I know next to nothing about Xen, but I'm very much inclined to think > the Xen block driver (hw/block/xen_disk.c) is at fault here. The > blkif_request_discard structure it uses for accepting discard requests > apparently has a uint64_t nr_sectors field. Thanks for the pointer. Looking at current master, BLKIF_OP_DISCARD is indeed broken. The values passed from the guest are u64 and get stashed into signed values. I will add a loop to repeatedly call blk_aio_pdiscard with small chunks of BDRV_REQUEST_MAX_SECTORS. We quickly checked other users of blk_aio_pdiscard and it appears they are not affected because they notify the guest abuilt the limits. Olaf