From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44017) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOsbM-00033I-6d for qemu-devel@nongnu.org; Tue, 02 Sep 2014 14:14:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XOsbG-0005Fq-65 for qemu-devel@nongnu.org; Tue, 02 Sep 2014 14:14:44 -0400 Received: from mx-v6.kamp.de ([2a02:248:0:51::16]:44443 helo=mx01.kamp.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOsbC-0005FP-IS for qemu-devel@nongnu.org; Tue, 02 Sep 2014 14:14:38 -0400 Message-ID: <540608FA.4060602@kamp.de> Date: Tue, 02 Sep 2014 20:14:18 +0200 From: Peter Lieven MIME-Version: 1.0 References: <1401889659-24035-1-git-send-email-pl@kamp.de> <53903469.8070902@msgid.tls.msk.ru> <539FDCAD.5060006@kamp.de> <53A02351.8060900@redhat.com> <53A02867.7090400@kamp.de> <53A02AA6.2060006@redhat.com> <54048EE8.3040305@kamp.de> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] block/iscsi: use 16 byte CDBs only when necessary List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: ronnie sahlberg Cc: Kevin Wolf , Paolo Bonzini , Michael Tokarev , qemu-devel , Stefan Hajnoczi Am 02.09.2014 um 17:28 schrieb ronnie sahlberg: > That is one big request. I assume the device reports "no limit" in > the VPD page so we can not state it is the guest/application going > beyond the allowed limit? Yes, my storage reports no limit, but afaik there is no way to tell the guest the limit at least with virtio-blk. Or can we? If so we should define a sane limit in case the storage reports no limits. It can't be our goal to allow the guest to issue a request in orders of gigabytes. Which is possible. The xferlen in the iSCSI PDU is 32bit so we have an actual limit of 2^32 - 1. > > > I am not entirely sure what meaning the target assigns to Protocol > Error means here. > It could be that ~100M is way higher than MaxBurstLength ? What is > the MaxBurstLength that was reported by the server during login > negotiation? > If so, we should make libiscsi check the maxburstlength and fail the > request early. We would still fail the I/O so it will not really solve > anything much > but at least we should not send the request to the server. The "problem" is that we switched to read/write10. In this case we can write 65535 sectors max. The procotol error refers to the xferlen not matching the block count in the SCSI CDB in the payload. > > Best would probably be to take the smallest of a non-zero > Block-Limits.max_transfer_length and iscsi-MaxBurstLength/block-size > and pass this back to the guest in the emulated Block-Limits-VPD. > At least then you have tried to tell the guest "never do SCSI I/O > bigger than this". I would vote for the biggest number of sectors fitting in uint16_t. Which is 32768. This is 16 MB with 512 byte sectors. We have already used this for write zeroes and discard in case there is no limit specified. > > I.e. even if the target reports BlockLimits.MaxTransferLength == 0 == > no limit to QEMU, QEMU should probably take the iscsi transport limit > into account and pass this to the guest > by setting the emulated BlockLimits page it passes to scale to the > maximum that MaxBurstLength allows. > > > Then if BTRFS or SG_IO in the guest ignores the BlockLimits it is > clearly a guest problem. > > (A different interpretation for ProtocolError could be the mismatch > between the iscsi expected data transfer length and the scsi transfer > length, but that should result in residuals, not protocol error.) > > > > Hypothetically there could be targets that support really huge > MaxBurstLengths > 32MB. For those you probably want to switch to > WRITE16 when the SCSI transfer length goes > 0xffff. > > - if (iscsilun->use_16_for_rw) { > + if (iscsilun->use_16_for_rw || num_sectors > 0xffff) { I already proposed this, but I think Michael voted that this would cause unpredictable and hard to debug behaviour for qemu. [PATCH] block/iscsi: use 16 byte CDBs also for big requests https://lists.nongnu.org/archive/html/qemu-devel/2014-06/msg03628.html But maybe we have to do this if we cannot report the max transfer length for virtio-blk or IDE. I will check what open-iscsi or Linux does. Peter