From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56494) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWTeD-0000BB-5r for qemu-devel@nongnu.org; Tue, 23 Sep 2014 13:13:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XWTe8-00085Q-1F for qemu-devel@nongnu.org; Tue, 23 Sep 2014 13:13:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:14643) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWTe7-00084O-Py for qemu-devel@nongnu.org; Tue, 23 Sep 2014 13:12:59 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s8NHCrCj005105 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 23 Sep 2014 13:12:53 -0400 Message-ID: <5421AA14.9060709@redhat.com> Date: Tue, 23 Sep 2014 11:12:52 -0600 From: Eric Blake MIME-Version: 1.0 References: <1411466956-19801-1-git-send-email-stefanha@redhat.com> In-Reply-To: <1411466956-19801-1-git-send-email-stefanha@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="F22OXH9xtLgCdPXeS9MrjL9SstTJuTVWp" Subject: Re: [Qemu-devel] [PATCH v2] docs: add blkdebug block driver documentation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Kevin Wolf , Paolo Bonzini , John Snow , Max Reitz This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --F22OXH9xtLgCdPXeS9MrjL9SstTJuTVWp Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/23/2014 04:09 AM, Stefan Hajnoczi wrote: > The blkdebug block driver is undocumented. Documenting it is worthwhil= e > since it offers powerful error injection features that are used by > qemu-iotests test cases. >=20 > This document will make it easier for people to learn about and use > blkdebug. >=20 > Signed-off-by: Stefan Hajnoczi > --- > v2: > * Added GPL v2 or later license and Red Hat copyright [Eric] > * Expanded ini rules file explanation [Paolo] > * Added note that errno values depend on the host [Eric] >=20 > docs/blkdebug.txt | 155 ++++++++++++++++++++++++++++++++++++++++++++++= ++++++++ > 1 file changed, 155 insertions(+) > create mode 100644 docs/blkdebug.txt >=20 > +Rules support the following attributes: > + > + event - which type of operation to match (e.g. read_aio, write_aio, > + flush_to_os, flush_to_disk). See the "Events" section for > + information on events. TAB vs space damage? > + > + state - (optional) the engine must be in this state number in order = for this > + rule to match. See the "State transitions" section for information= > + on states. and again? > + > + errno - the numeric errno value to return when a request matches thi= s rule. > + The errno values depend on the host since the numeric values= are not > + standarized in the POSIX specification. > + > + sector - (optional) a sector number that the request must overlap in= order to > + match this rule > + > + once - (optional, default "off") only execute this action on the fir= st > + matching request > + > + immediately - (optional, default "off") return a NULL BlockDriverAIO= CB > + pointer and fail without an errno instead. This exercises the > + code path where BlockDriverAIOCB fails and the caller's > + BlockDriverCompletionFunc is not invoked. again? > + > +Events > +------ > +Block drivers provide information about the type of I/O request they a= re about > +to make so rules can match specific types of requests. For example, t= he qcow2 > +block driver tells blkdebug when it accesses the L1 table so rules can= match > +only L1 table accesses and not other metadata or guest data requests. > + > +The core events are: > + > + read_aio - guest data read > + > + write_aio - guest data write > + > + flush_to_os - write out unwritten block driver state (e.g. cached me= tadata) > + > + flush_to_disk - flush the host block device's disk cache > + > +See block/blkdebug.c:event_names[] for the list of available events. = You may s/available events/additional available events/ ? > +need to grep block driver source code to understand the meaning of spe= cific > +events. > + > +State transitions > +----------------- > +There are cases where more power is needed to match a particular I/O r= equest in > +a longer sequence of requests. For example: > + > + write_aio > + flush_to_disk > + write_aio > + > +How do we match the 2nd write_aio but not the first? This is where st= ate > +transitions come in. > + > +The error injection engine has an integer called the "state" that alwa= ys starts > +initialized to 1. Rules can be conditional on the state and they can > +transition to a new state. Is the current state of the engine in a running guest introspectible, such as through 'query-block'? > + > +For example, to match the 2nd write_aio: > + > + [set-state] > + event =3D "write_aio" > + state =3D "1" > + new_state =3D "2" > + > + [inject-error] > + event =3D "write_aio" > + state =3D "2" > + errno =3D "5" > + > +The first write_aio request matches the set-state rule and transitions= from > +state 0 to state 1. Once state 1 has been entered, the set-state rule= no > +longer matches since it required state 0. But the inject-error rule n= ow state 0/1 or state 1/2 ? > +matches the next write_aio request and injects EIO (5). > + > +State transition rules support the following attributes: > + > + event - which type of operation to match (e.g. read_aio, write_aio, > + flush_to_os, flush_to_disk). See the "Events" section for > + information on events. More tab damage? > + > + state - (optional) the engine must be in this state number in order = for this > + rule to match > + > + new_state - transition to this state number > + > +Suspend and resume > +------------------ > +Exercising code paths in block drivers may require specific ordering a= mongst > +concurrent requests. The "breakpoint" feature allows requests to be h= alted on > +a blkdebug event and resumed later. This makes it possible to achieve= > +deterministic ordering when multiple requests are in flight. > + > +Breakpoints on blkdebug events are associated with a user-defined "tag= " string. > +This tag serves as an identifier by which the request can be resumed a= t a later > +point. > + > +See the qemu-io(1) break, resume, remove_break, and wait_break command= s for > +details. >=20 Looking closer. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --F22OXH9xtLgCdPXeS9MrjL9SstTJuTVWp Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg iQEcBAEBCAAGBQJUIaoUAAoJEKeha0olJ0NqpXUH/06U/4HQehMHFgsv7yu5npO1 hBUiEcEfJujPvFx+qiVCAqEb12vp15QzwtpiXc9/U/iplnpfz321uWJx9WQJAUB2 UPlYWQbc+p7+3akhCSuVEwcKRbs8zLGnhPpKaQCMSqPyeJj0wrehxtr+a+iyeKO+ 4AukKD0EdF4Sw2PRmzjUJwzL4Inaq0XF7Ov0HwjVeVAwxup1jIra6oQN0k9056eS ZXmxVdhUTif1ioA/lsJRiYse4PfH5oJhy4SAJ8PY6f7PjGaBDgW6O4tAuGxL+ThI NxHf2Ybh0SN12QQSirQu6QHkXwcbuj6JcSgp9N/53wWEguCmYmdEOoPbrHpZ8YE= =YRJl -----END PGP SIGNATURE----- --F22OXH9xtLgCdPXeS9MrjL9SstTJuTVWp--