From: Eric Blake <eblake@redhat.com>
To: Michael Roth <mdroth@linux.vnet.ibm.com>
Cc: blauwirbel@gmail.com, aliguori@us.ibm.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 16/20] qidl: Add documentation
Date: Tue, 14 Aug 2012 13:01:09 -0600 [thread overview]
Message-ID: <502AA075.5010409@redhat.com> (raw)
In-Reply-To: <1344961646-21194-17-git-send-email-mdroth@linux.vnet.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 3720 bytes --]
On 08/14/2012 10:27 AM, Michael Roth wrote:
> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
> ---
> docs/qidl.txt | 343 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 343 insertions(+)
> create mode 100644 docs/qidl.txt
>
> +
> +For the rest, of the document, the following simple device will be used as an
s/rest,/rest/
> +
> +Do not include any function declarations in this header file as QIDL does not
> +understand function declarations.
Can QIDL be taught to ignore portions of a file, and stick function
declarations in those portions?
> +### Derived Fields
> +
> +If a field is set based on some other field in the device's structure, then its
> +value is derived. Since this is effectively duplicate state, we can avoid
> +sending it and then recompute it when we need to. Derived state requires a bit
> +more handling that immutable state.
s/that/than/
> +
> +In our *SerialDevice* example, our *int_pending* flag is really derived from
> +two pieces of state. It is set based on whether interrupts are enabled in the
> +*ier* register and whether there is *THRE* flag is not set in the *lsr*
s/there is/the/
> +register.
> +
> +To mark a field as derived, use the **derived** marker. To update our
> +example, we would do:
> +
> + QIDL_START(SerialDevice, state)
> + typedef struct SerialDevice {
> + SysBusDevice parent;
> +
> + uint8_t thr; // transmit holding register
> + uint8_t lsr; // line status register
> + uint8_t ier; // interrupt enable register
> +
> + int _derived int_pending; // whether we have a pending queued interrupt
> + CharDriverState *chr QIDL(immutable);
Why is it marked QIDL(immutable) but only _derived? Wouldn't
QIDL(derived) be more consistent?
> +### Broken State
> +
> +QEMU does migration with a lot of devices today. When applying this methodology
> +to these devices, one will quickly discover that there are a lot of fields that
> +are not being saved today that are not derived or immutable state.
> +
> +These are all bugs. It just so happens that these bugs are usually not very
> +serious. In many cases, they cause small functionality glitches that so far
> +have not created any problems.
> +
> +Consider our *SerialDevice* example. In QEMU's real *SerialState* device, the
> +*thr* register is not saved yet we have not marked it immutable or derived.
s/saved/saved,/
> +
> +The idea behind the broken marker is that we can convert a large number of
> +devices without breaking migration compatibility, and then institute a flag day
> +where we go through and remove broken markers en-mass.
s/en-mass/en masse/
> +
> +Below is an update of our example to reflect our real life serial device:
> +
> + QIDL_START(SerialDevice, state)
> + typedef struct SerialDevice {
> + SysBusDevice parent;
> +
> + uint8_t thr QIDL(broken); // transmit holding register
> + uint8_t lsr; // line status register
> + uint8_t ier; // interrupt enable register
> +
> + int _derived int_pending; // whether we have a pending queued interrupt
> + CharDriverState _immutable *chr;
Now you've changed the example; before it used QIDL(immutable).
> +Variable Sized, Fixed Capacity Arrays
> +-------------------------------------
> +
> +Sometimes it's desirable to have a variable sized array. QIDL currently supported
s/supported/supports/
--
Eric Blake eblake@redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 620 bytes --]
next prev parent reply other threads:[~2012-08-14 19:01 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-14 16:27 [Qemu-devel] Add infrastructure for supporting QIDL annotations Michael Roth
2012-08-14 16:27 ` [Qemu-devel] [PATCH 01/20] qapi: qapi-visit.py -> qapi_visit.py so we can import Michael Roth
2012-08-14 16:27 ` [Qemu-devel] [PATCH 02/20] qapi: qapi-types.py -> qapi_types.py Michael Roth
2012-08-14 16:27 ` [Qemu-devel] [PATCH 03/20] qapi: qapi-commands.py -> qapi_commands.py Michael Roth
2012-08-14 16:27 ` [Qemu-devel] [PATCH 04/20] qapi: qapi_visit.py, make code useable as module Michael Roth
2012-08-14 16:27 ` [Qemu-devel] [PATCH 05/20] qapi: qapi_visit.py, support arrays and complex qapi definitions Michael Roth
2012-08-14 16:27 ` [Qemu-devel] [PATCH 06/20] qapi: add visitor interfaces for C arrays Michael Roth
2012-08-14 16:27 ` [Qemu-devel] [PATCH 07/20] qapi: qapi_visit.py, support generating static functions Michael Roth
2012-08-14 16:27 ` [Qemu-devel] [PATCH 08/20] qapi: qapi_visit.py, support for visiting non-pointer/embedded structs Michael Roth
2012-08-14 16:27 ` [Qemu-devel] [PATCH 09/20] qapi: QmpOutputVisitor, implement array handling Michael Roth
2012-08-14 16:27 ` [Qemu-devel] [PATCH 10/20] qapi: QmpInputVisitor, " Michael Roth
2012-08-14 16:27 ` [Qemu-devel] [PATCH 11/20] qapi: qapi.py, make json parser more robust Michael Roth
2012-08-14 16:27 ` [Qemu-devel] [PATCH 12/20] qapi: add open-coded visitor for struct tm types Michael Roth
2012-08-14 16:27 ` [Qemu-devel] [PATCH 13/20] qom-fuse: workaround for truncated properties > 4096 Michael Roth
2012-08-14 16:27 ` [Qemu-devel] [PATCH 14/20] module additions for schema registration Michael Roth
2012-08-14 16:27 ` [Qemu-devel] [PATCH 15/20] qdev: move Property-related declarations to qdev-properties.h Michael Roth
2012-08-14 16:27 ` [Qemu-devel] [PATCH 16/20] qidl: Add documentation Michael Roth
2012-08-14 19:01 ` Eric Blake [this message]
2012-08-14 19:41 ` Peter Maydell
2012-08-14 22:15 ` Michael Roth
2012-08-14 22:20 ` Peter Maydell
2012-08-18 14:19 ` Blue Swirl
2012-08-14 16:27 ` [Qemu-devel] [PATCH 17/20] qidl: parser, initial import from qc.git Michael Roth
2012-08-14 16:27 ` [Qemu-devel] [PATCH 18/20] qidl: codegen, initial commit Michael Roth
2012-08-14 16:27 ` [Qemu-devel] [PATCH 19/20] qidl: qidl.h, definitions for qidl annotations Michael Roth
2012-08-14 16:27 ` [Qemu-devel] [PATCH 20/20] qidl: unit tests Michael Roth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=502AA075.5010409@redhat.com \
--to=eblake@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=blauwirbel@gmail.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).