Received: from eggs.gnu.org ([2001:4830:134:3::10]:33030) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bocd8-0008CQ-Iw for qemu-devel@nongnu.org; Mon, 26 Sep 2016 16:36:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bocd2-0008RF-3W for qemu-devel@nongnu.org; Mon, 26 Sep 2016 16:36:02 -0400 References: <1474893981-5302-1-git-send-email-vsementsov@virtuozzo.com> From: Eric Blake Message-ID: <8ab152f7-fa76-13c8-a9d6-7f8a4689bfe9@redhat.com> Date: Mon, 26 Sep 2016 15:35:42 -0500 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="rl7B1e0klSUHNDVmQTaxOS8HPjAntBS7P" Subject: Re: [Qemu-devel] [PATCH] proto: add 'shift' extension. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , Vladimir Sementsov-Ogievskiy , qemu-devel@nongnu.org, qemu-block@nongnu.org, nbd-general@lists.sourceforge.net Cc: alex@alex.org.uk, kwolf@redhat.com, stefanha@redhat.com, w@uter.be, den@virtuozzo.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --rl7B1e0klSUHNDVmQTaxOS8HPjAntBS7P From: Eric Blake To: Paolo Bonzini , Vladimir Sementsov-Ogievskiy , qemu-devel@nongnu.org, qemu-block@nongnu.org, nbd-general@lists.sourceforge.net Cc: alex@alex.org.uk, kwolf@redhat.com, stefanha@redhat.com, w@uter.be, den@virtuozzo.com Message-ID: <8ab152f7-fa76-13c8-a9d6-7f8a4689bfe9@redhat.com> Subject: Re: [PATCH] proto: add 'shift' extension. References: <1474893981-5302-1-git-send-email-vsementsov@virtuozzo.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/26/2016 07:51 AM, Paolo Bonzini wrote: >> +- bit 3, `NBD_CMD_FLAG_SHIFT`; This flag is valid for `NBD_CMD_TRIM` = and >> + `NBD_CMD_WRITE_ZEROES`. If this flag is set the server shifts reque= st >> + *length* and *offset* left by N bits, where N is defined by `NBD_OP= T_SHIFT` >> + option or is assumed to be 16 bits by default if `NBD_OPT_SHIFT` op= tion is >> + not specified. If after shift `(offset + length)` exceeds disk size= , length >> + should be reduced to `( - offset)`. However, `(offset + = length)` >> + must not exceed disk size by more than `(1 << N) - 1`. >> =20 >> #### Request types >> =20 >> >=20 > This is very ad hoc. Can we instead have a block size common to all > commands? Block devices in practice have one, in fact that's why > they're called block devices... The INFO extensions are supposed to be a way for the server to communicate block sizes to the guest (note, it is one-way communication; the guest does NOT get to pick an arbitrary size, but relies on the server reporting it) - but I don't know if that sizing information is useful enough for the task at hand. As it was, the INFO extension had a proposal idea a while back about advertising a different size for TRIM and WRITE_ZEROES than what is preferred for WRITE and READ, so having a single size that works for shifted commands that operate on blocks instead of bytes may not even be feasible if there is no single block size to settle on. But having a universal command flag that says "this command requests offset and length in units of blocks instead of bytes", where blocks is an up-front sizing settled on during handshake via INFO extension, and NOT something that the client can change at-will during a live session, may be useful. Or it may be the source of arithmetic overflow exploits in poor implementations, or of denial-of-service with used with a READ or WRITE to send more than 2G of data in a single command. In other words, I don't yet see a compelling use case for being able to request shifted sizes. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --rl7B1e0klSUHNDVmQTaxOS8HPjAntBS7P Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJX6YaeAAoJEKeha0olJ0Nqr6QH/iZ9cDNdgMHj5VmpbCSH7YTL 6l69VnisRu9GYo+2TCjCl0l6KR5rRPE3ChF0nvdY7NMSkF8TcA3Z2gmcH0ooQRRE c60YY1/gOnaFewZ28ZMcm/Oo7GwCkV7589tWsQ7/BOd+RT6UWVAQUWiD0NIpI8z+ E2t+kwJCw9Bv385QBKJ2rn15JDKlSVKtt6H4ZpFffIBHZ3vCvzJhFFEUjpbypAoa xGuetfnIWl7krN8SHggXWBqmVq44aTxHYVrfuHtKsjwZZZ/aCuLyyZpnyQYTWvkN s7yDDj4i/hKQbTKLaaeFpDpVUtRluS6GkjY0bRgM+kU5Sy6HIiGWXPCWpKxUW8Y= =BRfq -----END PGP SIGNATURE----- --rl7B1e0klSUHNDVmQTaxOS8HPjAntBS7P--