add --accel option
PATCH 1/1 add --accel option
Since libvirt dudes seem to prefer it, add a --accel option. For now, it only does the same as --enable-kvm, but it can easily be extended in the future. It also accepts "none" and "kqemu" options.
--- qemu-options.hx | 7 +++++++ vl.c | 26 +++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletions(-)
qemu-options.hx +7 -0
@@ -1429,6 +1429,13 @@ Enable KQEMU kernel module usage. KQEMU options are only available if KQEMU support is enabled when compiling. ETEXI +DEF("accel", HAS_ARG, QEMU_OPTION_accel, \ + "-accel name enable a given accelerator module\n") +STEXI +@item -accel @var{name} +Enable a given accelerator module, for instance, KVM. +ETEXI + #ifdef CONFIG_KVM DEF("enable-kvm", 0, QEMU_OPTION_enable_kvm, \ "-enable-kvm enable KVM full virtualization support\n")
vl.c +25 -1
@@ -3091,7 +3091,6 @@ static int ram_save_live(QEMUFile *f, int stage, void *opaque)while (ram_save_block (f) !=0 ) { bytes_transferred +=TARGET_PAGE_SIZE ; } -cpu_physical_memory_set_dirty_tracking (0 ); }qemu_put_be64 (f,RAM_SAVE_FLAG_EOS );
@@ -5431,6 +5430,31 @@ int main(int argc, char **argv, char **envp) kqemu_allowed =2 ;break ;#endif +case QEMU_OPTION_accel: + { +const char *kqemu_opt; +if (strstart (optarg,"kvm" ,NULL )) { + kvm_allowed =1 ; + kqemu_allowed =0 ; + } +if (strstart (optarg,"none" ,NULL )) { + kvm_allowed =0 ; + kqemu_allowed =0 ; + } + +if (strstart (optarg,"kqemu" , &kqemu_opt)) { + kvm_allowed =0 ; +if (*kqemu_opt ==',' &&strstart (kqemu_opt,",mode=kernel" ,NULL )) { + kqemu_allowed =2 ; + }else if (*kqemu_opt !=',' ||strstart (kqemu_opt,",mode=user" ,NULL )) { + kqemu_allowed =1 ; + }else { +fprintf (stderr,"invalid kqemu mode. use mode=user or mode=kernel\n" ); +exit (1 ); + } + } +break ; + }#ifdef CONFIG_KVM case QEMU_OPTION_enable_kvm: kvm_allowed =1 ;
Signature · 1 line
1.6.2.2
On Tue, Jul 28, 2009 at 10:48 PM, Glauber Costa<[email protected]> wrote:
[snip]
vl.c static int ram_save_live(QEMUFile *f, int stage, void *opaque) · line 3096
Quoted 8 lines
vl.c +0
-1@@ -3091,7 +3091,6 @@ static int ram_save_live(QEMUFile *f, int stage, void *opaque) while (ram_save_block(f) != 0) { bytes_transferred += TARGET_PAGE_SIZE; } - cpu_physical_memory_set_dirty_tracking(0); } qemu_put_be64(f, RAM_SAVE_FLAG_EOS);
This change shouldn't be part of the patch. Otherwise it looks ok.
Best regards,
Filip Navara
Quoted 3 lines · Glauber Costa
Since libvirt dudes seem to prefer it, add a --accel option. For now, it only does the same as --enable-kvm, but it can easily be extended in the future. It also accepts "none" and "kqemu" options.
The documentation should include which values are valid for the option. Guessing that the syntax is -accel kvm is probably possible, but for -accel kqemu,mode=kernel it's definitely hard.
Kevin
Quoted 8 lines · Kevin Wolf
Quoted 3 lines · Glauber Costa
Since libvirt dudes seem to prefer it, add a --accel option. For now, it only does the same as --enable-kvm, but it can easily be extended in the future. It also accepts "none" and "kqemu" options.
The documentation should include which values are valid for the option. Guessing that the syntax is -accel kvm is probably possible, but for -accel kqemu,mode=kernel it's definitely hard.
right now kqemu needs an extra argument.
But very soon kvm will need it too. Like for example controlling knobs like kvm-irqchip and kvm-pit. So maybe we want a standard way of passing arguments for all accels?
How about --accel foo,args=bar,bar,bar with the args part being optional ?
An exampel would be --accel kvm,args=userpit,userirqchip (assuming we want the default to be in the kernel)
Otherwise we're stuck with an evergrowing combination to support
Quoted 10 lines · Glauber Costa
Quoted 7 lines · Kevin Wolf
Quoted 3 lines · Glauber Costa
Since libvirt dudes seem to prefer it, add a --accel option. For now, it only does the same as --enable-kvm, but it can easily be extended in the future. It also accepts "none" and "kqemu" options.
The documentation should include which values are valid for the option. Guessing that the syntax is -accel kvm is probably possible, but for -accel kqemu,mode=kernel it's definitely hard.
right now kqemu needs an extra argument.
Quoted 8 lines
But very soon kvm will need it too. Like for example controlling knobs like kvm-irqchip and kvm-pit. So maybe we want a standard way of passing arguments for all accels?
How about --accel foo,args=bar,bar,bar with the args part being optional ?
An exampel would be --accel kvm,args=userpit,userirqchip (assuming we want the default to be in the kernel)
Why not the usual -accel kvm,userpit=on and so on? When having such parameters you probably should be using QemuOpts/qemu-option in the end anyway.
But actually I was just arguing that the parameters need to be documented, whatever they look like.
Kevin
Quoted 25 lines · Juan Quintela
Quoted 14 lines · Glauber Costa
Quoted 7 lines · Kevin Wolf
Quoted 3 lines · Glauber Costa
Since libvirt dudes seem to prefer it, add a --accel option. For now, it only does the same as --enable-kvm, but it can easily be extended in the future. It also accepts "none" and "kqemu" options.
The documentation should include which values are valid for the option. Guessing that the syntax is -accel kvm is probably possible, but for -accel kqemu,mode=kernel it's definitely hard.
right now kqemu needs an extra argument.
But very soon kvm will need it too. Like for example controlling knobs like kvm-irqchip and kvm-pit. So maybe we want a standard way of passing arguments for all accels?
Quoted 6 lines
How about --accel foo,args=bar,bar,bar with the args part being optional ?
An exampel would be --accel kvm,args=userpit,userirqchip (assuming we want the default to be in the kernel)
Otherwise we're stuck with an evergrowing combination to support
No, pleaseeee
"," shouldn't have two meanings in the same command line
Quoted 7 lines
--accel kvm,userpit,userirqchip
is ok
--accell kvm,userpit=on,userirqchip=off
also ok
QemuOpts supports both of these (and none of the versions below).
Kevin
Quoted 17 lines
--accell kvm,args=userpit,userirqchip
parses as
args=userpit
userirqchip
or
args=userpit,userirqchipIMHO, having lists inside lists is just insane, and if you want it, do it marking the list properly:
--accell kvm,args=[userpit,userirqchip]
or any other opening/closing pair.
Later, Juan.
Quoted 3 lines · Glauber Costa
Since libvirt dudes seem to prefer it, add a --accel option. For now, it only does the same as --enable-kvm, but it can easily be extended in the future. It also accepts "none" and "kqemu" options.
Having two options do the same thing seems wrong. IMO at least one of them should be deprecated and documented as a backward compatibility alias.
Paul
Quoted 9 lines · Paul Brook
Quoted 4 lines · Glauber Costa
Since libvirt dudes seem to prefer it, add a --accel option. For now, it only does the same as --enable-kvm, but it can easily be extended in the future. It also accepts "none" and "kqemu" options.
Having two options do the same thing seems wrong. IMO at least one of them should be deprecated and documented as a backward compatibility alias.
Yup. --enable-kvm/--enable-kqemu/--kernel-kqemu should all be deprecated and documented as such.
Signature · 3 lines
Regards, Anthony Liguori