All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"QEMU Developers" <qemu-devel@nongnu.org>,
	"Eric Auger" <eric.auger@redhat.com>
Subject: Re: [Qemu-devel] [PULL 18/18] qapi: move RTC_CHANGE to the target schema
Date: Fri, 24 Sep 2021 15:35:52 +0200	[thread overview]
Message-ID: <87sfxup03r.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <CAFEAcA8mMzzgKyDbUUTh+W0r=5C0_HJv+7MMZ3Rdx-E2vcsRZA@mail.gmail.com> (Peter Maydell's message of "Fri, 24 Sep 2021 13:39:29 +0100")

Peter Maydell <peter.maydell@linaro.org> writes:

> On Fri, 24 Sept 2021 at 13:21, Markus Armbruster <armbru@redhat.com> wrote:
>> ... this isn't really *target*-specific, it's *device*-specific: some
>> devices implement the event, some don't.
>>
>> Ideally, we'd just fix that.
>
> Would you want to tell the far end "this machine simply does
> not have an RTC device at all (because the hardware it's emulating
> doesn't have one) and so you won't get RTC_CHANGE events" ?

Well, RTC_CHANGE is "Emitted when the guest changes the RTC time."  If
the guest doesn't *have* an RTC...

> A good first step for getting more devices to implement the
> RTC_CHANGE support would be if there was any documentation on how
> to do it. The JSON schema says the offset should be "offset between
> base RTC clock (as specified by -rtc base), and new RTC clock value",
> but there aren't any hints (either there or elsewhere) as to how a
> device is supposed to determine that value, and there's no
> documentation of what the behaviour or intent is of the
> qemu_timedate_diff() function that the existing implementations
> use to calculate the offset.

RTC_CHANGE is from the bad old times, I'm afraid:

    commit 80cd34787fc0fc31b1a341c7b8d8e729c1b6ea58
    Author: Luiz Capitulino <lcapitulino@redhat.com>
    Date:   Thu Feb 25 12:11:44 2010 -0300

        QMP: Introduce RTC_CHANGE event

        Emitted whenever the RTC time changes.

        Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
        Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

No hint at why or how to use it.

I figure this is the matching libvirt commit:

    commit 32e6ac9c2601e19715d18f743cf805a3466d3385
    Author: Daniel P. Berrangé <berrange@redhat.com>
    Date:   Thu Mar 18 18:28:15 2010 +0000

        Add support for an explicit  RTC change event

        This introduces a new event type

           VIR_DOMAIN_EVENT_ID_RTC_CHANGE

        This event includes the new UTC offset measured in seconds.
        Thus there is a new callback definition for this event type

         typedef void (*virConnectDomainEventRTCChangeCallback)(virConnectPtr conn,
                                                                virDomainPtr dom,
                                                                long long utcoffset,
                                                                void *opaque);

        If the guest XML configuration for the <clock> is set to
        offset='variable', then the XML will automatically be
        updated with the new UTC offset value. This ensures that
        during migration/save/restore the new offset is preserved.

        * daemon/remote.c: Dispatch RTC change events to client
        * examples/domain-events/events-c/event-test.c: Watch for
          RTC change events
        * include/libvirt/libvirt.h.in: Define new RTC change event ID
          and callback signature
        * src/conf/domain_event.c, src/conf/domain_event.h,
          src/libvirt_private.syms: Extend API to handle RTC change events
        * src/qemu/qemu_driver.c: Connect to the QEMU monitor event
          for RTC changes and emit a libvirt RTC change event
        * src/remote/remote_driver.c: Receive and dispatch RTC change
          events to application
        * src/remote/remote_protocol.x: Wire protocol definition for
          RTC change events
        * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
          src/qemu/qemu_monitor_json.c: Watch for RTC_CHANGE event
          from QEMU monitor

Suggests it might be needed for migration.

How today's libvirt uses RTC_CHANGE would be good to know.  I don't have
the time to ferret it out myself.  Daniel, do you know?  If not, who
else might?

> Side note: probably the JSON schema should document the units
> for 'offset'. Code inspection suggests it wants seconds.

Doc bug, patch would be lovely.

> Side side note: the JSON event doesn't seem to contemplate
> the possibility that a machine might have more than one RTC...

Right.  It clearly needs an additional member @qom-path identifying the
RTC device.



  reply	other threads:[~2021-09-24 13:38 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-18 14:05 [Qemu-devel] [PULL 00/18] QAPI patches for 2019-02-18 Markus Armbruster
2019-02-18 14:05 ` [Qemu-devel] [PULL 01/18] qapi: Belatedly document modular code generation Markus Armbruster
2019-02-18 14:05 ` [Qemu-devel] [PULL 02/18] qapi: Fix up documentation for recent commit a95291007b2 Markus Armbruster
2019-02-18 14:05 ` [Qemu-devel] [PULL 03/18] qapi: Clean up modular built-in code generation a bit Markus Armbruster
2019-02-18 14:05 ` [Qemu-devel] [PULL 04/18] qapi: Prepare for system modules other than 'builtin' Markus Armbruster
2019-02-18 14:05 ` [Qemu-devel] [PULL 05/18] qapi: Generate QAPIEvent stuff into separate files Markus Armbruster
2019-02-18 14:05 ` [Qemu-devel] [PULL 06/18] build-sys: move qmp-introspect per target Markus Armbruster
2019-02-18 14:05 ` [Qemu-devel] [PULL 07/18] build: Deal with all of QAPI's .o in qapi/Makefile.objs Markus Armbruster
2019-02-18 14:05 ` [Qemu-devel] [PULL 08/18] qapi: New module target.json Markus Armbruster
2019-02-18 14:05 ` [Qemu-devel] [PULL 09/18] qapi: make rtc-reset-reinjection and SEV depend on TARGET_I386 Markus Armbruster
2019-02-18 14:05 ` [Qemu-devel] [PULL 10/18] qapi: make s390 commands depend on TARGET_S390X Markus Armbruster
2019-02-18 14:06 ` [Qemu-devel] [PULL 11/18] target.json: add a note about query-cpu* not being s390x-specific Markus Armbruster
2019-02-18 14:06 ` [Qemu-devel] [PULL 12/18] qapi: make query-gic-capabilities depend on TARGET_ARM Markus Armbruster
2019-02-18 14:06 ` [Qemu-devel] [PULL 13/18] qapi: make query-cpu-model-expansion depend on s390 or x86 Markus Armbruster
2019-02-18 14:06 ` [Qemu-devel] [PULL 14/18] qapi: make query-cpu-definitions depend on specific targets Markus Armbruster
2019-02-18 14:06 ` [Qemu-devel] [PULL 15/18] qapi: remove qmp_unregister_command() Markus Armbruster
2019-02-18 14:06 ` [Qemu-devel] [PULL 16/18] Revert "qapi-events: add 'if' condition to implicit event enum" Markus Armbruster
2019-02-18 14:06 ` [Qemu-devel] [PULL 17/18] qmp: Deprecate query-events in favor of query-qmp-schema Markus Armbruster
2019-02-18 14:06 ` [Qemu-devel] [PULL 18/18] qapi: move RTC_CHANGE to the target schema Markus Armbruster
2021-09-23 13:14   ` Peter Maydell
2021-09-23 13:37     ` Paolo Bonzini
2021-09-24 12:21     ` Markus Armbruster
2021-09-24 12:28       ` Marc-André Lureau
2021-09-24 12:40         ` Peter Maydell
2021-09-24 12:39       ` Peter Maydell
2021-09-24 13:35         ` Markus Armbruster [this message]
2021-09-24 14:42           ` Daniel P. Berrangé
2021-09-24 15:02             ` Peter Maydell
2021-09-25  7:39               ` Markus Armbruster
2019-02-18 16:19 ` [Qemu-devel] [PULL 00/18] QAPI patches for 2019-02-18 Peter Maydell

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=87sfxup03r.fsf@dusky.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=eric.auger@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=peter.maydell@linaro.org \
    --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 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.