[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 060/113] vl: extract various command line desugaring snippets to a
From: |
Paolo Bonzini |
Subject: |
[PULL 060/113] vl: extract various command line desugaring snippets to a new function |
Date: |
Wed, 2 Dec 2020 03:07:56 -0500 |
Keep the machine initialization sequence free of miscellaneous command
line parsing actions.
The only difference is that preallocation will always be done with one
thread if -smp is not provided; previously it was using mc->default_cpus,
which is almost always 1 anyway.
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
softmmu/vl.c | 40 ++++++++++++++++++++++------------------
1 file changed, 22 insertions(+), 18 deletions(-)
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 98994e10fa..85b23d51be 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -126,6 +126,7 @@ static const char *boot_once;
static const char *incoming;
static const char *loadvm;
enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB;
+static int mem_prealloc; /* force preallocation of physical target memory */
int display_opengl;
const char* keyboard_layout = NULL;
static ram_addr_t ram_size;
@@ -158,7 +159,7 @@ int fd_bootchk = 1;
static int no_reboot;
int no_shutdown = 0;
int graphic_rotate = 0;
-const char *watchdog;
+static const char *watchdog;
QEMUOptionRom option_rom[MAX_OPTION_ROMS];
int nb_option_roms;
int old_param = 0;
@@ -2914,6 +2915,25 @@ static void qemu_validate_options(void)
#endif
}
+static void qemu_process_sugar_options(void)
+{
+ if (mem_prealloc) {
+ char *val;
+
+ val = g_strdup_printf("%d",
+ (uint32_t)
qemu_opt_get_number(qemu_find_opts_singleton("smp-opts"), "cpus", 1));
+ object_register_sugar_prop("memory-backend", "prealloc-threads", val);
+ g_free(val);
+ object_register_sugar_prop("memory-backend", "prealloc", "on");
+ }
+
+ if (watchdog) {
+ int i = select_watchdog(watchdog);
+ if (i > 0)
+ exit (i == 1 ? 1 : 0);
+ }
+}
+
static void qemu_process_early_options(void)
{
char **dirs;
@@ -3175,7 +3195,6 @@ static void qemu_machine_creation_done(void)
void qemu_init(int argc, char **argv, char **envp)
{
- int i;
int snapshot = 0;
QemuOpts *opts, *machine_opts;
QemuOpts *icount_opts = NULL, *accel_opts = NULL;
@@ -3194,7 +3213,6 @@ void qemu_init(int argc, char **argv, char **envp)
bool have_custom_ram_size;
BlockdevOptionsQueue bdo_queue = QSIMPLEQ_HEAD_INITIALIZER(bdo_queue);
QemuPluginList plugin_list = QTAILQ_HEAD_INITIALIZER(plugin_list);
- int mem_prealloc = 0; /* force preallocation of physical target memory */
qemu_add_opts(&qemu_drive_opts);
qemu_add_drive_opts(&qemu_legacy_drive_opts);
@@ -4106,6 +4124,7 @@ void qemu_init(int argc, char **argv, char **envp)
loc_set_none();
qemu_validate_options();
+ qemu_process_sugar_options();
/*
* These options affect everything else and should be processed
@@ -4159,15 +4178,6 @@ void qemu_init(int argc, char **argv, char **envp)
machine_smp_parse(current_machine,
qemu_opts_find(qemu_find_opts("smp-opts"), NULL), &error_fatal);
- if (mem_prealloc) {
- char *val;
-
- val = g_strdup_printf("%d", current_machine->smp.cpus);
- object_register_sugar_prop("memory-backend", "prealloc-threads", val);
- g_free(val);
- object_register_sugar_prop("memory-backend", "prealloc", "on");
- }
-
/*
* Get the default machine options from the machine if it is not already
* specified either by the configuration file or by the command line.
@@ -4426,12 +4436,6 @@ void qemu_init(int argc, char **argv, char **envp)
select_vgahw(machine_class, vga_model);
}
- if (watchdog) {
- i = select_watchdog(watchdog);
- if (i > 0)
- exit (i == 1 ? 1 : 0);
- }
-
/* This checkpoint is required by replay to separate prior clock
reading from the other reads, because timer polling functions query
clock values from the log. */
--
2.26.2
- [PULL 080/113] vl: clean up -boot variables, (continued)
- [PULL 080/113] vl: clean up -boot variables, Paolo Bonzini, 2020/12/02
- [PULL 074/113] vl: start VM via qmp_cont, Paolo Bonzini, 2020/12/02
- [PULL 084/113] kernel-doc: add support for ____cacheline_aligned_in_smp attribute, Paolo Bonzini, 2020/12/02
- [PULL 086/113] scripts: kernel-doc: proper handle @foo->bar(), Paolo Bonzini, 2020/12/02
- [PULL 088/113] scripts: kernel-doc: accept blank lines on parameter description, Paolo Bonzini, 2020/12/02
- [PULL 090/113] scripts/kernel-doc: parse __ETHTOOL_DECLARE_LINK_MODE_MASK, Paolo Bonzini, 2020/12/02
- [PULL 087/113] scripts: kernel-doc: accept negation like !@var, Paolo Bonzini, 2020/12/02
- [PULL 069/113] vl: separate qemu_apply_machine_options, Paolo Bonzini, 2020/12/02
- [PULL 051/113] treewide: do not use short-form boolean options, Paolo Bonzini, 2020/12/02
- [PULL 056/113] vl: extract qemu_init_subsystems, Paolo Bonzini, 2020/12/02
- [PULL 060/113] vl: extract various command line desugaring snippets to a new function,
Paolo Bonzini <=
- [PULL 061/113] qemu-option: restrict qemu_opts_set to merge-lists QemuOpts, Paolo Bonzini, 2020/12/02
- [PULL 067/113] vl: separate qemu_create_late_backends, Paolo Bonzini, 2020/12/02
- [PULL 072/113] vl: move -global check earlier, Paolo Bonzini, 2020/12/02
- [PULL 073/113] migration, vl: start migration via qmp_migrate_incoming, Paolo Bonzini, 2020/12/02
- [PULL 068/113] vl: separate qemu_create_machine, Paolo Bonzini, 2020/12/02
- [PULL 079/113] vl: remove serial_max_hds, Paolo Bonzini, 2020/12/02
- [PULL 075/113] hmp: introduce cmd_available, Paolo Bonzini, 2020/12/02
- [PULL 077/113] vl: extract machine done notifiers, Paolo Bonzini, 2020/12/02
- [PULL 094/113] kernel-doc: add support for ____cacheline_aligned attribute, Paolo Bonzini, 2020/12/02
- [PULL 096/113] Revert "scripts/kerneldoc: For Sphinx 3 use c:macro for macros with arguments", Paolo Bonzini, 2020/12/02