From: Markus Armbruster <armbru@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Cc: Markus Armbruster <armbru@redhat.com>,
qemu-block@nongnu.org, qemu-devel@nongnu.org,
eblake@redhat.com, dave@treblig.org, eduardo@habkost.net,
berrange@redhat.com, pbonzini@redhat.com, hreitz@redhat.com,
kwolf@redhat.com, raphael.norwitz@nutanix.com, mst@redhat.com,
yc-core@yandex-team.ru, den-plotnikov@yandex-team.ru,
daniil.tatianin@yandex.ru
Subject: Re: [PATCH 4/4] qapi: introduce CONFIG_READ event
Date: Wed, 18 Oct 2023 08:47:48 +0200 [thread overview]
Message-ID: <877cnkzasr.fsf@pond.sub.org> (raw)
In-Reply-To: <ae494c44-1bd6-435e-8bd8-0ec2ba9ceaa6@yandex-team.ru> (Vladimir Sementsov-Ogievskiy's message of "Tue, 17 Oct 2023 18:44:03 +0300")
Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> writes:
> On 17.10.23 18:00, Markus Armbruster wrote:
>> Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> writes:
>>
>>> Send a new event when guest reads virtio-pci config after
>>> virtio_notify_config() call.
>>>
>>> That's useful to check that guest fetched modified config, for example
>>> after resizing disk backend.
>>>
>>> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
[...]
>>> diff --git a/qapi/qdev.json b/qapi/qdev.json
>>> index 2468f8bddf..37a8785b81 100644
>>> --- a/qapi/qdev.json
>>> +++ b/qapi/qdev.json
>>> @@ -329,3 +329,25 @@
>>> # Since: 8.2
>>> ##
>>> { 'command': 'x-device-sync-config', 'data': {'id': 'str'} }
>>> +
>>> +##
>>> +# @X_CONFIG_READ:
>>> +#
>>> +# Emitted whenever guest reads virtio device config after config change.
>>> +#
>>> +# @device: device name
>>> +#
>>> +# @path: device path
>>> +#
>>> +# Since: 5.0.1-24
>>> +#
>>> +# Example:
>>> +#
>>> +# <- { "event": "X_CONFIG_READ",
>>> +# "data": { "device": "virtio-net-pci-0",
>>> +# "path": "/machine/peripheral/virtio-net-pci-0" },
>>> +# "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
>>> +#
>>> +##
>>> +{ 'event': 'X_CONFIG_READ',
>>> + 'data': { '*device': 'str', 'path': 'str' } }
>>
>> The commit message talks about event CONFIG_READ, but you actually name
>> it x-device-sync-config.
>
> will fix
>
>> I figure you use x- to signify "unstable". Please use feature flag
>> 'unstable' for that. See docs/devel/qapi-code-gen.rst section
>> "Features", in particular "Special features", and also the note on x- in
>> section "Naming rules and reserved names".
>
> OK, will do.
>
> Hmm, it say
>
> Names beginning with ``x-`` used to signify "experimental". This
> convention has been replaced by special feature "unstable".
>
> "replaced".. So, I should use "unstable" flag without "x-" prefix? Can't find an example. Seems "unstable" always used together with "x-".
True.
The "x-" prefix originated with qdev properties. First use might be
commit f0c07c7c7b4. The convention wasn't documented then, but QOM/qdev
properties have always been a documentation wasteland. It then spread
to other places, and eventually to the QAPI schema. Where we try pretty
hard to document things properly. We documented the "x-" prefix in
commit e790e666518:
Any name (command, event, type, field, or enum value) beginning with
"x-" is marked experimental, and may be withdrawn or changed
incompatibly in a future release.
Minor pain point: when things grow up from experimental to stable, we
have to rename.
The convention didn't stop us from naming non-experimental things x-FOO,
e.g. QOM property "x-origin" in commit 6105683da35. Made it to the QAPI
schema in commit 8825587b53c. Point is: the prefix isn't a reliable
marker for "unstable".
Since I needed a reliable marker for my "set policy for unstable
interfaces" feature (see CLI option -compat), I created special feature
flag "unstable", and dropped the "x-" convention for the QAPI schema.
Renaming existing "x-" names felt like pointless churn, so I didn't.
I'm not objecting to new names starting with "x-". Nor am I objecting
to feature 'unstable' on names that don't start with "x-".
I guess "x-" remains just fine for things we don't intend to make stable
at some point. The "x-" can remind humans "this is unstable" better
than a feature flag can (for machines, it's the other way round).
For things we do intend (hope?) to make stable, I wouldn't bother with
the "x-".
Clearer now?
> Also, nothing said about events. Is using "X_" wrong idea? Should it be x-SOME_EVENT instead?
Since this is the first unstable event, there is no precedent. Let's
use no prefix, and move on.
>> The name CONFIG_READ feels overly generic for something that makes sense
>> only with virtio devices.
>
> Hmm, right.. I think, we can say same thing about DEVICE_UNPLUG_GUEST_ERROR.
That one came to be as a generalization of existing MEM_UNPLUG_ERROR and
a concrete need to signal CPU unplug errors. Demonstrates "unplug guest
errors" can happen for different kinds of devices. So we went with a
generic event we can use for all of them.
This doesn't seem to be the case for this patch's event. Thoughts?
> So, what about DEVICE_GUEST_READ_CONFIG ?
>
>>
>>> diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c
>>> index b485375049..d0f022e925 100644
>>> --- a/softmmu/qdev-monitor.c
>>> +++ b/softmmu/qdev-monitor.c
>>> @@ -1252,3 +1252,8 @@ void qdev_hotplug_device_on_event(DeviceState *dev)
>>> dev->device_on_event_sent = true;
>>> qapi_event_send_x_device_on(dev->id, dev->canonical_path);
>>> }
>>> +
>>> +void qdev_config_read_event(DeviceState *dev)
>>> +{
>>> + qapi_event_send_x_config_read(dev->id, dev->canonical_path);
>>> +}
>>
next prev parent reply other threads:[~2023-10-18 6:49 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-06 20:20 [PATCH 0/4] vhost-user-blk: live resize additional APIs Vladimir Sementsov-Ogievskiy
2023-10-06 20:20 ` [PATCH 1/4] vhost-user-blk: simplify and fix vhost_user_blk_handle_config_change Vladimir Sementsov-Ogievskiy
2023-10-23 9:31 ` Raphael Norwitz
2023-10-06 20:20 ` [PATCH 2/4] qapi: introduce device-sync-config Vladimir Sementsov-Ogievskiy
2023-10-17 14:57 ` Markus Armbruster
2023-10-17 15:32 ` Vladimir Sementsov-Ogievskiy
2023-10-18 6:08 ` Markus Armbruster
2023-10-06 20:20 ` [PATCH 3/4] qapi: device-sync-config: check runstate Vladimir Sementsov-Ogievskiy
2023-10-06 20:20 ` [PATCH 4/4] qapi: introduce CONFIG_READ event Vladimir Sementsov-Ogievskiy
2023-10-17 15:00 ` Markus Armbruster
2023-10-17 15:44 ` Vladimir Sementsov-Ogievskiy
2023-10-18 6:47 ` Markus Armbruster [this message]
2023-10-18 8:51 ` Vladimir Sementsov-Ogievskiy
2023-10-18 10:36 ` Markus Armbruster
2023-10-18 10:51 ` Michael S. Tsirkin
2023-10-18 10:59 ` Daniel P. Berrangé
2023-10-18 12:02 ` Markus Armbruster
2023-10-18 12:07 ` Daniel P. Berrangé
2023-10-18 14:33 ` Dr. David Alan Gilbert
2023-10-19 7:05 ` Markus Armbruster
2023-10-19 7:10 ` Markus Armbruster
2023-10-18 12:39 ` Vladimir Sementsov-Ogievskiy
2023-10-19 7:01 ` Markus Armbruster
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=877cnkzasr.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=daniil.tatianin@yandex.ru \
--cc=dave@treblig.org \
--cc=den-plotnikov@yandex-team.ru \
--cc=eblake@redhat.com \
--cc=eduardo@habkost.net \
--cc=hreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=raphael.norwitz@nutanix.com \
--cc=vsementsov@yandex-team.ru \
--cc=yc-core@yandex-team.ru \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.