All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>,
	 pbonzini@redhat.com, qemu-devel@nongnu.org,
	 richard.henderson@linaro.org
Subject: Re: [PATCH v3 1/8] reset: allow registering handlers that aren't called by snapshot loading
Date: Mon, 24 Oct 2022 14:28:48 +0200	[thread overview]
Message-ID: <87sfjdqubj.fsf@pond.sub.org> (raw)
In-Reply-To: <CAFEAcA8jra50q_DvNTGG8Wi+eF+PEKPHnfLNBhUjG9muqiPe0A@mail.gmail.com> (Peter Maydell's message of "Mon, 24 Oct 2022 12:06:18 +0100")

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

> (Cc'ing Markus for a QMP related question.)
>
> On Fri, 14 Oct 2022 at 03:17, Jason A. Donenfeld <Jason@zx2c4.com> wrote:
>>
>> Snapshot loading only expects to call deterministic handlers, not
>> non-deterministic ones. So introduce a way of registering handlers that
>> won't be called when reseting for snapshots.
>>
>> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
>
>> diff --git a/migration/savevm.c b/migration/savevm.c
>> index 48e85c052c..a0cdb714f7 100644
>> --- a/migration/savevm.c
>> +++ b/migration/savevm.c
>> @@ -3058,7 +3058,7 @@ bool load_snapshot(const char *name, const char *vmstate,
>>          goto err_drain;
>>      }
>>
>> -    qemu_system_reset(SHUTDOWN_CAUSE_NONE);
>> +    qemu_system_reset(SHUTDOWN_CAUSE_SNAPSHOT_LOAD);
>>      mis->from_src_file = f;
>>
>>      if (!yank_register_instance(MIGRATION_YANK_INSTANCE, errp)) {
>> diff --git a/qapi/run-state.json b/qapi/run-state.json
>> index 9273ea6516..74ed0ac93c 100644
>> --- a/qapi/run-state.json
>> +++ b/qapi/run-state.json
>> @@ -86,12 +86,14 @@
>>  #                   ignores --no-reboot. This is useful for sanitizing
>>  #                   hypercalls on s390 that are used during kexec/kdump/boot
>>  #
>> +# @snapshot-load: A snapshot is being loaded by the record & replay subsystem.
>> +#
>>  ##
>>  { 'enum': 'ShutdownCause',
>>    # Beware, shutdown_caused_by_guest() depends on enumeration order
>>    'data': [ 'none', 'host-error', 'host-qmp-quit', 'host-qmp-system-reset',
>>              'host-signal', 'host-ui', 'guest-shutdown', 'guest-reset',
>> -            'guest-panic', 'subsystem-reset'] }
>> +            'guest-panic', 'subsystem-reset', 'snapshot-load'] }
>
> Markus: do we need to mark new enum values with some kind of "since n.n"
> version info ?

We do!  Commonly like

    # @snapshot-load: A snapshot is being loaded by the record & replay
    #                 subsystem (since 7.2)

>>  ##
>>  # @StatusInfo:
>> diff --git a/softmmu/runstate.c b/softmmu/runstate.c
>> index 1e68680b9d..03e1ee3a8a 100644
>> --- a/softmmu/runstate.c
>> +++ b/softmmu/runstate.c
>> @@ -441,9 +441,9 @@ void qemu_system_reset(ShutdownCause reason)
>>      cpu_synchronize_all_states();
>>
>>      if (mc && mc->reset) {
>> -        mc->reset(current_machine);
>> +        mc->reset(current_machine, reason);
>>      } else {
>> -        qemu_devices_reset();
>> +        qemu_devices_reset(reason);
>>      }
>>      if (reason && reason != SHUTDOWN_CAUSE_SUBSYSTEM_RESET) {
>>          qapi_event_send_reset(shutdown_caused_by_guest(reason), reason);
>
> This change means that resets on snapshot-load, which previously
> did not result in sending a QMP event, will now start to do so
> with this new ShutdownCause type. I don't think we want that
> change in behaviour.
>
> (Also, as per the 'Beware' comment in run-state.json, we will
> claim this to be a 'caused by guest' reset, which doesn't seem
> right. If we suppress the sending the event that is moot, though.)
>
> Markus: if we add a new value to the ShutdownCause enumeration,
> how annoying is it if we decide we don't want it later? I guess
> we can just leave it in the enum unused... (In this case we're
> using it for purely internal purposes and it won't ever actually
> wind up in any QMP events.)

Deleting enumeration values is a compatibility issue only if the value
is usable in QMP input.

"Purely internal" means it cannot occur in QMP output, and any attempt
to use it in input fails.  Aside: feels a bit fragile.

Having an enumeration type where some values are like this is mildly
ugly, because introspection still shows the value.

If we care about fragile or mildly ugly, we can mark such values with a
special feature flag, and have the QAPI generator keep them internal
(input, output, introspection).

Does this answer your question?



  parent reply	other threads:[~2022-10-24 12:35 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-14  2:16 [PATCH v3 0/8] rerandomize RNG seeds on reboot and handle record&replay Jason A. Donenfeld
2022-10-14  2:16 ` [PATCH v3 1/8] reset: allow registering handlers that aren't called by snapshot loading Jason A. Donenfeld
2022-10-24 11:06   ` Peter Maydell
2022-10-24 12:00     ` Jason A. Donenfeld
2022-10-24 12:28     ` Markus Armbruster [this message]
2022-10-24 12:39       ` Peter Maydell
2022-10-24 13:19         ` Markus Armbruster
2022-10-24 14:27           ` Peter Maydell
2022-10-24 17:39             ` Markus Armbruster
2022-10-25  0:56               ` Jason A. Donenfeld
2022-10-14  2:16 ` [PATCH v3 2/8] x86: do not re-randomize RNG seed on snapshot load Jason A. Donenfeld
2022-10-14  2:16 ` [PATCH v3 3/8] device-tree: add re-randomization helper function Jason A. Donenfeld
2022-10-14  2:16 ` [PATCH v3 4/8] arm: re-randomize rng-seed on reboot Jason A. Donenfeld
2022-10-14  2:16 ` [PATCH v3 5/8] riscv: " Jason A. Donenfeld
2022-10-14  2:16 ` [PATCH v3 6/8] openrisc: " Jason A. Donenfeld
2022-10-15 16:52   ` Stafford Horne
2022-10-14  2:16 ` [PATCH v3 7/8] rx: " Jason A. Donenfeld
2022-10-14  2:16 ` [PATCH v3 8/8] mips: " Jason A. Donenfeld
2022-10-20 17:38 ` [PATCH v3 0/8] rerandomize RNG seeds on reboot and handle record&replay Jason A. Donenfeld

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=87sfjdqubj.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=Jason@zx2c4.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.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.