Skip to content
Snippets Groups Projects
  1. May 30, 2018
    • Igor Mammedov's avatar
      qmp: add set-numa-node command · f3be6781
      Igor Mammedov authored
      
      Command is allowed to run only in preconfig stage and
      will allow to configure numa mapping for CPUs depending
      on possible CPUs layout (query-hotpluggable-cpus) for
      given machine instance.
      
      Example of configuration session:
      $QEMU -smp 2 --preconfig ...
      
      QMP:
      -> {'execute': 'query-hotpluggable-cpus' }
      <- {'return': [
             {'props': {'core-id': 0, 'thread-id': 0, 'socket-id': 1}, ... },
             {'props': {'core-id': 0, 'thread-id': 0, 'socket-id': 0}, ... }
         ]}
      
      -> {'execute': 'set-numa-node', 'arguments': { 'type': 'node', 'nodeid': 0 } }
      <- {'return': {}}
      -> {'execute': 'set-numa-node', 'arguments': { 'type': 'cpu',
             'node-id': 0, 'core-id': 0, 'thread-id': 0, 'socket-id': 1, }
         }
      <- {'return': {}}
      
      -> {'execute': 'set-numa-node', 'arguments': { 'type': 'node', 'nodeid': 1 } }
      -> {'execute': 'set-numa-node', 'arguments': { 'type': 'cpu',
             'node-id': 1, 'core-id': 0, 'thread-id': 0, 'socket-id': 0 }
         }
      <- {'return': {}}
      
      -> {'execute': 'query-hotpluggable-cpus' }
      <- {'return': [
             {'props': {'core-id': 0, 'thread-id': 0, 'node-id': 0, 'socket-id': 1}, ... },
             {'props': {'core-id': 0, 'thread-id': 0, 'node-id': 1, 'socket-id': 0}, ... }
         ]}
      
      Signed-off-by: default avatarIgor Mammedov <imammedo@redhat.com>
      Message-Id: <1525423069-61903-11-git-send-email-imammedo@redhat.com>
      Reviewed-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      [ehabkost: Changed "since 2.13" to "since 3.0"]
      Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      f3be6781
    • Igor Mammedov's avatar
      qmp: permit query-hotpluggable-cpus in preconfig state · 899eaab4
      Igor Mammedov authored
      
      it will allow mgmt to query possible CPUs, which depends on
      used machine(version)/-smp options, without restarting
      QEMU and use results to configure numa mapping or adding
      CPUs with device_add* later.
      
      PS:
      *) device_add is not allowed to run at preconfig in this series
         but later it could be dealt with by injecting -device
         in preconfig state and letting existing -device handling
         to actually plug devices
      
      Signed-off-by: default avatarIgor Mammedov <imammedo@redhat.com>
      Message-Id: <1525423069-61903-10-git-send-email-imammedo@redhat.com>
      Reviewed-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      899eaab4
    • Igor Mammedov's avatar
      tests: extend qmp test with preconfig checks · fb1e58f7
      Igor Mammedov authored
      
      Add permission checks for commands at 'preconfig' stage.
      
      Signed-off-by: default avatarIgor Mammedov <imammedo@redhat.com>
      Message-Id: <1526556524-267991-1-git-send-email-imammedo@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      fb1e58f7
    • Igor Mammedov's avatar
      cli: add --preconfig option · 047f7038
      Igor Mammedov authored
      
      This option allows pausing QEMU in the new RUN_STATE_PRECONFIG state,
      allowing the configuration of QEMU from QMP before the machine jumps
      into board initialization code of machine_run_board_init()
      
      The intent is to allow management to query machine state and additionally
      configure it using previous query results within one QEMU instance
      (i.e. eliminate the need to start QEMU twice, 1st to query board specific
      parameters and 2nd for actual VM start using query results for
      additional parameters).
      
      The new option complements -S option and could be used with or without
      it. The difference is that -S pauses QEMU when the machine is completely
      initialized with all devices wired up and ready to execute guest code
      (QEMU needs only to unpause VCPUs to let guest execute its code),
      while the "preconfig" option pauses QEMU early before board specific init
      callback (machine_run_board_init) is executed and allows the configuration
      of machine parameters which will be used by board init code.
      
      When early introspection/configuration is done, command 'exit-preconfig'
      should be used to exit RUN_STATE_PRECONFIG and transition to the next
      requested state (i.e. if -S is used then QEMU will pause the second
      time when board/device initialization is completed or start guest
      execution if -S isn't provided on CLI)
      
      PS:
      Initially 'preconfig' is planned to be used for configuring numa
      topology depending on board specified possible cpus layout.
      
      Signed-off-by: default avatarIgor Mammedov <imammedo@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <1526059483-42847-1-git-send-email-imammedo@redhat.com>
      [ehabkost: Changed "since 2.13" to "since 3.0"]
      Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      047f7038
    • Igor Mammedov's avatar
      tests: qapi-schema tests for allow-preconfig · 7b13f2c2
      Igor Mammedov authored
      
      use new allow-preconfig parameter in tests and make sure that
      the QAPISchema can parse allow-preconfig correctly
      
      Signed-off-by: default avatarIgor Mammedov <imammedo@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <1526058959-41425-1-git-send-email-imammedo@redhat.com>
      Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      7b13f2c2
    • Igor Mammedov's avatar
      qapi: introduce new cmd option "allow-preconfig" · d6fe3d02
      Igor Mammedov authored
      
      New option will be used to allow commands, which are prepared/need
      to run, during preconfig state. Other commands that should be able
      to run in preconfig state, should be amended to not expect machine
      in initialized state or deal with it.
      
      For compatibility reasons, commands that don't use new flag
      'allow-preconfig' explicitly are not permitted to run in
      preconfig state but allowed in all other states like they used
      to be.
      
      Within this patch allow following commands in preconfig state:
         qmp_capabilities
         query-qmp-schema
         query-commands
         query-command-line-options
         query-status
         exit-preconfig
      to allow qmp connection, basic introspection and moving to the next
      state.
      
      PS:
      set-numa-node and query-hotpluggable-cpus will be enabled later in
      a separate patches.
      
      Signed-off-by: default avatarIgor Mammedov <imammedo@redhat.com>
      Message-Id: <1526057503-39287-1-git-send-email-imammedo@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      [ehabkost: Changed "since 2.13" to "since 3.0"]
      Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      d6fe3d02
    • Igor Mammedov's avatar
      hmp: disable monitor in preconfig state · 71dc578e
      Igor Mammedov authored
      
      Ban it for now, if someone would need it to work early,
      one would have to implement checks if HMP command is valid
      at preconfig state.
      
      Signed-off-by: default avatarIgor Mammedov <imammedo@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Message-Id: <1525423069-61903-5-git-send-email-imammedo@redhat.com>
      Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      71dc578e
    • Igor Mammedov's avatar
      qapi: introduce preconfig runstate · 8a36283e
      Igor Mammedov authored
      
      New preconfig runstate will be used in follow up patches
      related to introducing --preconfig CLI option and is
      intended to replace prelaunch runstate from QEMU start
      up to machine_init callback.
      
      Signed-off-by: default avatarIgor Mammedov <imammedo@redhat.com>
      Message-Id: <1525423069-61903-4-git-send-email-imammedo@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      [ehabkost: Changed "since 2.13" to "since 3.0"]
      Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      8a36283e
    • Igor Mammedov's avatar
      numa: split out NumaOptions parsing into set_numa_options() · 3319b4ef
      Igor Mammedov authored
      
      it will allow to reuse set_numa_options() for parsing
      configuration commands received via QMP interface
      
      Signed-off-by: default avatarIgor Mammedov <imammedo@redhat.com>
      Message-Id: <1525423069-61903-3-git-send-email-imammedo@redhat.com>
      Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      3319b4ef
    • Igor Mammedov's avatar
      numa: postpone options post-processing till machine_run_board_init() · 7a3099fc
      Igor Mammedov authored
      
      in preparation for numa options to being handled via QMP before
      machine_run_board_init(), move final numa configuration checks
      and processing to machine_run_board_init() so it could take into
      account both CLI (via parse_numa_opts()) and QMP input
      
      Signed-off-by: default avatarIgor Mammedov <imammedo@redhat.com>
      Reviewed-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      Message-Id: <1525423069-61903-2-git-send-email-imammedo@redhat.com>
      Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      7a3099fc
    • Igor Mammedov's avatar
      numa: clarify error message when node index is out of range in -numa dist, ... · 74f38e96
      Igor Mammedov authored
      
      When using following CLI:
        -numa dist,src=128,dst=1,val=20
      user gets a rather confusing error message:
         "Invalid node 128, max possible could be 128"
      
      Where 128 is number of nodes that QEMU supports (MAX_NODES),
      while src/dst is an index up to that limit, so it should be
      MAX_NODES - 1 in error message.
      Make error message to explicitly state valid range for node
      index to be more clear.
      
      Signed-off-by: default avatarIgor Mammedov <imammedo@redhat.com>
      Message-Id: <1526483174-169008-1-git-send-email-imammedo@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
      74f38e96
  2. May 29, 2018
Loading