Received: from eggs.gnu.org ([2001:4830:134:3::10]:44989) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c8DRm-0002WX-IE for qemu-devel@nongnu.org; Sat, 19 Nov 2016 16:45:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c8DRl-0007Ib-HW for qemu-devel@nongnu.org; Sat, 19 Nov 2016 16:45:18 -0500 References: <1479413642-22463-1-git-send-email-eblake@redhat.com> <1479413642-22463-10-git-send-email-eblake@redhat.com> <9ab3c7b9-c0bb-ab17-b535-07a4a81a043c@redhat.com> <9ca698aa-4127-a326-ffe7-e4ca3a8c03dd@redhat.com> From: Max Reitz Message-ID: <1f666161-437a-b397-478b-c116a298132e@redhat.com> Date: Sat, 19 Nov 2016 22:45:05 +0100 MIME-Version: 1.0 In-Reply-To: <9ca698aa-4127-a326-ffe7-e4ca3a8c03dd@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="LskmVrg5QCx26GfDw0aBj18SdpSS9rwMM" Subject: Re: [Qemu-devel] [PATCH v2 9/9] tests: Add coverage for recent block geometry fixes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake , qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, kwolf@redhat.com, pbonzini@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --LskmVrg5QCx26GfDw0aBj18SdpSS9rwMM From: Max Reitz To: Eric Blake , qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, kwolf@redhat.com, pbonzini@redhat.com Message-ID: <1f666161-437a-b397-478b-c116a298132e@redhat.com> Subject: Re: [PATCH v2 9/9] tests: Add coverage for recent block geometry fixes References: <1479413642-22463-1-git-send-email-eblake@redhat.com> <1479413642-22463-10-git-send-email-eblake@redhat.com> <9ab3c7b9-c0bb-ab17-b535-07a4a81a043c@redhat.com> <9ca698aa-4127-a326-ffe7-e4ca3a8c03dd@redhat.com> In-Reply-To: <9ca698aa-4127-a326-ffe7-e4ca3a8c03dd@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 18.11.2016 02:28, Eric Blake wrote: > On 11/17/2016 05:42 PM, Max Reitz wrote: >> On 17.11.2016 21:14, Eric Blake wrote: >>> Use blkdebug's new geometry constraints to emulate setups that >>> have caused recent regression fixes: write zeroes asserting >>> when running through a loopback block device with max-transfer >>> smaller than cluster size, and discard rounding away requests >>> that were not aligned to power-of-two boundaries. Also, add >>> coverage that the block layer is honoring max transfer limits. >>> >>> For now, a single iotest performs all actions, with the idea >>> that we can add future blkdebug constraint test cases in the >>> same file; but it can be split into multiple iotests if we find >>> reason to run one portion of the test in more setups than what >>> are possible in the other. >>> >=20 >> >>> +# Dell Equallogic iSCSI device is unusual with its 15M page size >>> +echo >>> +echo "=3D=3D non-power-of-2 write zeroes =3D=3D" >>> + >>> +limits=3Dopt-write-zero=3D15M,max-write-zero=3D15M,opt-discard=3D15M= ,max-discard=3D15M >>> +$QEMU_IO -c "open -o $options,$limits blkdebug::$TEST_IMG" \ >>> + -c "write -z 32M 32M" | _filter_qemu_io >>> + >>> +echo >>> +echo "=3D=3D non-power-of-2 discard =3D=3D" >>> + >>> +limits=3Dopt-write-zero=3D15M,max-write-zero=3D15M,opt-discard=3D15M= ,max-discard=3D15M >>> +$QEMU_IO -c "open -o $options,$limits blkdebug::$TEST_IMG" \ >>> + -c "discard 80000000 30M" | _filter_qemu_io >> >> Question: What does this test has to do with iscsi? >> >> The first case just tests that we fall back to writing the head and ta= il >> as full zeroes when the driver returns -ENOTSUP. >=20 > The first one isn't all that interesting, so much as making sure we > don't regress. I couldn't make it fail, pre-patch. The real test is th= e > second one... >=20 >> >> The second test, as far as I can see, just gives some discard request = to >> blkdebug (split up into head, mid and tail), which blkdebug just passe= s >> on (because 80000000 is a multiple of 512). qcow2 then discards part o= f >> that and drops the head and tail of the request it receives (but head >> and tail are now calculated based on qcow2's 64k limit). >=20 > Thanks to the opt-discard=3D15M, the blkdebug layer is forcing the bloc= k > layer to break it into head/middle/tail on 15M boundaries, but throwing= > away the head and tail without giving blkdebug a chance, so it only > zeroed 90-105M. Then, with the block layer fixed to pass the head on > through anyways, but without patch 2/9, the qcow2 code was seeing that > the start offset was not cluster-aligned ($TEST_IMG has 1M clusters), > and with patch 4/9 that was making qcow2 return -ENOTSUP, and still > ignoring everything up to 90M. It took all of 2, 4, and 5 before the > discard finally affected the range 77M-90M (since 80000000 is just > before 77M). OK, thank you for the explanation, but again, I don't know how that is related to the iscsi case. It's a good test and you should keep it but you should probably change the comment about the iSCSI device because as far as I can see, this has nothing to do with it. In said iSCSI case, the block driver limiting the alignment wouldn't be the format block driver or blkdebug, but the protocol driver (i.e. iscsi). As I said in my reply to patch 5, though, I don't think that your series changes behavior in that case. Old behavior: The block layer cuts off head and tail from the discard request before sending it to the iscsi driver. That driver then asserts that the request is aligned and proceeds. New behavior: The block layer sends head and tail separately from the rest. The iscsi driver discards head and tail, though, because they are not aligned, and thus again only sends the aligned part of the request to the device. > Maybe I should tweak the number to not be a multiple of 512, to doubly > make sure that the double-alignment code in io.c 5/9 is doing the right= > job (I didn't even check that 80000000 is indeed a multiple of 512). I was a bit surprised myself. :-) > You're right that it doesn't tickle iscsi code, so much as tickling the= > block layer code that was previously throwing away the unaligned > portions rather than passing them on through anyways. The test was > inspired because of the iscsi regression, but I was able to rework it > into something that reproducibly failed even without iscsi in the mix, > until the block layer was fixed. But if that means cleaning up the > comment on respin, I'm fine with that. Yes, that would be very much fine with me. Max --LskmVrg5QCx26GfDw0aBj18SdpSS9rwMM Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEvBAEBCAAZBQJYMMfhEhxtcmVpdHpAcmVkaGF0LmNvbQAKCRD0B9sAYdXPQL43 CACEmNVbzx5SjEbxs/SbSy+mAjEQCH8zEJOhhacdYOIwaK1iSqBQ2Y7syF1tyOs4 k80FDvJ8vEUmUdKoetrh3PhrJXWzyKCC6HnwnXgC6TjziA0Ur8kUs3eRoLilIDzr bhUHjWycg6/tsNxMyE1J7bm/aVJ7ZFJbJYCYoZSHNY2idt4w7tj0O86sjxkcBkTR iAj7Vlbj41NGLEhIdgs1SS/hUb3GgnzFkTlN/BQIzBlicdE7SH0GDdVH8EUhuDMf X2etbEz387dgH3eOh3gA/Il4OzDy923Ysowu/RgPZ12rwv3ZN1DUrUM+YdGjwvQh F9Z93OcThQgjL5Hdt5MAnZEI =cvjf -----END PGP SIGNATURE----- --LskmVrg5QCx26GfDw0aBj18SdpSS9rwMM--