User:Paolo Bonzini/Machine init sequence: Difference between revisions
(Created page with "== Current machine init sequence == === Up to CHECKPOINT_INIT === * Runstate is RUN_STATE_PRECONFIG or RUN_STATE_INMIGRATE ** Xen looks at RUN_STATE_INMIGRATE to skip RAM init...") |
|||
Line 3: | Line 3: | ||
* Runstate is RUN_STATE_PRECONFIG or RUN_STATE_INMIGRATE | * Runstate is RUN_STATE_PRECONFIG or RUN_STATE_INMIGRATE | ||
** Xen looks at RUN_STATE_INMIGRATE to skip RAM initialization. | ** Xen looks at RUN_STATE_INMIGRATE to skip RAM initialization. | ||
* Options: -sandbox, -name, -add-fd | * Get machine_class | ||
* Set machine compat props | |||
* set_memory_options | |||
* Options: -pidfile, -sandbox, -name, -add-fd | |||
* current_machine is created | * current_machine is created | ||
* Options: -trace, -L | * Options: -trace, -L | ||
Line 34: | Line 37: | ||
* Create backends for -serial/-parallel/-debugcon | * Create backends for -serial/-parallel/-debugcon | ||
* get_default_vga_model, select_vgahw, select_watchdog | * get_default_vga_model, select_vgahw, select_watchdog | ||
=== After CHECKPOINT_INIT === | === After CHECKPOINT_INIT === | ||
* qdev_machine_init() | * qdev_machine_init() |
Revision as of 09:08, 21 October 2020
Current machine init sequence
Up to CHECKPOINT_INIT
- Runstate is RUN_STATE_PRECONFIG or RUN_STATE_INMIGRATE
- Xen looks at RUN_STATE_INMIGRATE to skip RAM initialization.
- Get machine_class
- Set machine compat props
- set_memory_options
- Options: -pidfile, -sandbox, -name, -add-fd
- current_machine is created
- Options: -trace, -L
- Options: -smp
- Options: -mem-prealloc (requires current_machine->smp.cpus, but could look at -smp cpus directly)
- Options: -plugin (requires -smp)
- Handle default devices
- Default device check (needs machine_class)
- A bunch of checks for -daemonize
- Add default devices to device_configs
- Create backends
- Create displays
- Create early objects
- Initialize SPICE
- Create chardevs
- Create fsdevs
- Create audiodevs
- Machine properties set
- Accelerators created and properties set
- migration_object_init
- Wants current_machine->enforce_config_section, but that part can be done later though
- Initialize qtest server (QOMify)
- Parse bootorder and -machine kernel_filename/initrd_filename/kernel_cmdline
- cpu_timers_init() (can be done earlier)
- Create default network (move with other device_configs operations)
- net_init_clients
- Create late objects
- blk_mig_init, ram_mig_init, dirty_bitmap_mig_init (move to migration_object_init())
- Create monitors (why so late?)
- Create backends for -serial/-parallel/-debugcon
- get_default_vga_model, select_vgahw, select_watchdog
After CHECKPOINT_INIT
- qdev_machine_init()
- Only creates /machine/peripheral and /machine/peripheral-anon
- Determine ram_size
- parse_numa_opts() -> set_numa_options()
- Preconfig monitor
- set_numa_options (same as -numa but more powerful)
RUN_STATE_PRELAUNCH
- machine_run_board_init(current_machine)
- On-board devices are created
- Requires accelerator to be initialized
- Devices cannot be realized before this point (buses don't exist)
- Start VM
- loadvm or incoming migration
- Otherwise, vm_start()
First attempt at cleaned up sequence
Early option parsing
- Runstate is RUN_STATE_PRECONFIG
- Options: -sandbox, -name, -add-fd, -trace, -L
Early initialization
- qdev_machine_init()
- migration_object_init()
- blk_mig_init, ram_mig_init, dirty_bitmap_mig_init
- cpu_timers_init()
- Set RUN_STATE_INMIGRATE if needed
Command-line processing part one
- Options: -mem-prealloc (look at -smp cpus directly)
- Find MachineClass
- Handle default devices
- Default device check (needs machine_class but not MS)
- A bunch of checks for -daemonize
- Add default devices to device_configs
- Create default network (move with other device_configs operations)
- Create backends
- Create displays
- Create early objects
- Initialize SPICE
- Create chardevs
- Create fsdevs
- Create audiodevs
- Initialize qtest server
Machine creation
- current_machine is created
- Options: -smp
- Options: -plugin (requires -smp)
- Machine properties set
- set current_migration->send_configuration as in migration_object_init
- Accelerators created and properties set
- Parse bootorder and -machine kernel_filename/initrd_filename/kernel_cmdline
- net_init_clients
- Determine ram_size
- parse_numa_opts() -> set_numa_options()
- Determine ram_size
Late creation
- Create late objects
- Create monitors
- Create backends for -serial/-parallel/-debugcon
- get_default_vga_model, select_vgahw, select_watchdog
- Preconfig monitor
RUN_STATE_PRELAUNCH
- CHECKPOINT_INIT
- machine_run_board_init(current_machine)
- On-board devices are created
- Requires accelerator to be initialized
- Devices cannot be realized before this point (buses don't exist)
- Start VM
- loadvm or incoming migration
- Otherwise, vm_start()