All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Mirela Grujic <mirela.grujic@greensocs.com>, qemu-devel@nongnu.org
Cc: damien.hedde@greensocs.com, edgar.iglesias@xilinx.com,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	mark.burton@greensocs.com
Subject: Re: [RFC PATCH 7/9] qdev-monitor: Restructure and fix the check for command availability
Date: Thu, 13 May 2021 19:43:23 +0200	[thread overview]
Message-ID: <f8d01067-b0ab-afb6-2e54-b7e8c8a9b0e8@redhat.com> (raw)
In-Reply-To: <20210513082549.114275-8-mirela.grujic@greensocs.com>

On 13/05/21 10:25, Mirela Grujic wrote:
> The existing code had to be restructured to make room for adding
> checks that are specific to the machine phases.
> 
> The fix is related to the way that commands with the 'allow-preconfig'
> option are treated.
> 
> Commands labelled with the 'allow-preconfig' option were meant to be allowed
> during the 'preconfig' state, i.e. before the machine is initialized.
> The equivalent of 'preconfig' state (after its removal) is machine init
> phase MACHINE_INIT_PHASE_ACCEL_CREATED. Therefore, commands with
> 'allow-preconfig' option should be allowed to run while the machine is
> in MACHINE_INIT_PHASE_ACCEL_CREATED phase.
> Before this patch, those commands were allowed to run if the machine is
> not ready, which includes three more phases besides the accel-created
> phase. Since there were no means to enter other phases via QMP, the
> implementation was fine. However, with the introduction of
> 'next-machine-phase' and 'advance-machine-phase' commands, one could
> enter machine 'initialized' phase and still have available 'preconfig'
> commands, which is incorrect.
> 
> This patch makes available 'allow-preconfig' commands only when they're
> needed - before the machine is initialized, in the accel-created phase.
> To enable a command after the machine gets initialized and before it
> becomes ready, one should use 'allow-init-config' option that will be
> introduced in the following patch.

There aren't many commands that are valid only for the accel created or 
machine initialized phase.  I think adding allow-init-config is more 
churn than keeping only allow-preconfig, and calling phase_check in the 
individual commands.  (Or even better, in the internal APIs that they 
call, so that QMP is completely oblivious to phases and just gets the 
Error* back).

In other words, allow-preconfig is there because there are many commands 
that are allowed only after the machine-ready phase, but anything in the 
middle can be handled just fine from C code.

Paolo



  reply	other threads:[~2021-05-13 17:48 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-13  8:25 [RFC PATCH 0/9] Initial support for machine creation via QMP Mirela Grujic
2021-05-13  8:25 ` [RFC PATCH 1/9] vl: Allow finer control in advancing machine through phases Mirela Grujic
2021-05-13  8:25 ` [RFC PATCH 2/9] replace machine phase_check with machine_is_initialized/ready calls Mirela Grujic
2021-05-13 17:46   ` Paolo Bonzini
2021-05-14 13:13     ` Mirela Grujic
2021-05-14 21:14       ` Paolo Bonzini
2021-06-07 16:03         ` Eric Blake
2021-05-13  8:25 ` [RFC PATCH 3/9] rename MachineInitPhase enumeration constants Mirela Grujic
2021-05-13  8:25 ` [RFC PATCH 4/9] qapi: Implement 'query-machine-phase' command Mirela Grujic
2021-05-13 17:44   ` Paolo Bonzini
2021-05-19 15:43     ` Daniel P. Berrangé
2021-05-13  8:25 ` [RFC PATCH 5/9] qapi: Implement 'next-machine-phase' command Mirela Grujic
2021-06-04 14:25   ` Eric Blake
2021-06-05 14:40     ` Paolo Bonzini
2021-05-13  8:25 ` [RFC PATCH 6/9] qapi: Implement 'advance-machine-phase' command Mirela Grujic
2021-05-19 15:37   ` Kevin Wolf
2021-05-13  8:25 ` [RFC PATCH 7/9] qdev-monitor: Restructure and fix the check for command availability Mirela Grujic
2021-05-13 17:43   ` Paolo Bonzini [this message]
2021-05-14 13:00     ` Mirela Grujic
2021-05-13  8:25 ` [RFC PATCH 8/9] qapi: Introduce 'allow-init-config' option Mirela Grujic
2021-05-13  8:25 ` [RFC PATCH 9/9] qapi: Allow some commands to be executed in machine 'initialized' phase Mirela Grujic
2021-05-13 17:52 ` [RFC PATCH 0/9] Initial support for machine creation via QMP Paolo Bonzini
2021-05-14 12:48   ` Mirela Grujic
2021-05-14 16:00     ` Paolo Bonzini
2021-05-14 16:20       ` Daniel P. Berrangé
2021-05-14 18:32         ` Paolo Bonzini
2021-05-24 17:20           ` Igor Mammedov
2021-05-24 19:05             ` Igor Mammedov
2021-05-21 11:32   ` Markus Armbruster
2021-05-21 17:02     ` Paolo Bonzini
2021-05-21 14:06   ` Mirela Grujic
2021-05-21 16:57     ` Paolo Bonzini
2021-05-24 18:27       ` Igor Mammedov

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=f8d01067-b0ab-afb6-2e54-b7e8c8a9b0e8@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=berrange@redhat.com \
    --cc=damien.hedde@greensocs.com \
    --cc=edgar.iglesias@xilinx.com \
    --cc=ehabkost@redhat.com \
    --cc=mark.burton@greensocs.com \
    --cc=mirela.grujic@greensocs.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 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.