Skip to contentSkip to conversation

kvm tools: Use '-c' for '--cpus', not '--console'

PATCH In review Pekka Enberg 3 participants 5 messages May 11, 2011 – May 12, 2011 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 kvm tools: Use '-c' for '--cpus', not '--console'

This patch changes the '-c' command line option to specify the number of CPUs because it's used more often than console switching.

Cc Asias He <[email protected]>
Cc Avi Kivity <[email protected]>
Cc Cyrill Gorcunov <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Prasad Joshi <[email protected]>
Cc Sasha Levin <[email protected]>
---
 tools/kvm/kvm-run.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
tools/kvm/kvm-run.c +2 -2
index 829b33f..9b5176f 100644
@@ -97,10 +97,10 @@ static int img_name_parser(const struct option *opt, const char *arg, int unset)
 
 static const struct option options[] = {
 	OPT_GROUP("Basic options:"),
-	OPT_INTEGER('\0', "cpus", &nrcpus, "Number of CPUs"),
+	OPT_INTEGER('c', "cpus", &nrcpus, "Number of CPUs"),
 	OPT_U64('m', "mem", &ram_size, "Virtual machine memory size in MiB."),
 	OPT_CALLBACK('i', "image", NULL, "image", "Disk image", img_name_parser),
-	OPT_STRING('c', "console", &console, "serial or virtio",
+	OPT_STRING('\0', "console", &console, "serial or virtio",
 			"Console to use"),
 	OPT_BOOLEAN('\0', "virtio-rng", &virtio_rng,
 			"Enable virtio Random Number Generator"),
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH 2/2 kvm tools: Print out important command line options at startup

It's important to know what the guest configuration looks like when debugging issues so print out important command line options at startup:

  $ ./kvm run -k ../../arch/x86/boot/bzImage -m 512
    # kvm run -k ../../arch/x86/boot/bzImage -m 512 -c 1
Cc Asias He <[email protected]>
Cc Avi Kivity <[email protected]>
Cc Cyrill Gorcunov <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Prasad Joshi <[email protected]>
Cc Sasha Levin <[email protected]>
---
 tools/kvm/kvm-run.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
tools/kvm/kvm-run.c +2 -0
index 9b5176f..5b56779 100644
@@ -476,6 +476,8 @@ int kvm_cmd_run(int argc, const char **argv, const char *prefix)
 	}
 	free(hi);
 
+	printf("  # kvm run -k %s -m %Lu -c %d\n", kernel_filename, ram_size / 1023 / 1024, nrcpus);
+
 	if (!kvm__load_kernel(kvm, kernel_filename, initrd_filename,
 				real_cmdline))
 		die("unable to load kernel %s", kernel_filename);
Signature · 1 line
1.7.0.4
#2 lore raw
In reply to Pekka Enberg
Quoted 2 lines · Pekka Enberg

This patch changes the '-c' command line option to specify the number of CPUs because it's used more often than console switching.

I'd like to tune the command line option further.

1)
Change

    -i, --image <image>   Disk image
to
    -d, --disk  <disk>	  Disk image

2)
Change
-r, --initrd <initrd>
Initial RAM disk image
to
-i, --initrd <initrd>
Initial RAM disk image
3)
Change

    -d, --kvm-dev <kvm-dev>
                          KVM device file
    -s, --single-step     Enable single stepping
    -g, --ioport-debug    Enable ioport debugging

to
--kvm-dev <kvm-dev>
KVM device file
--single-step Enable single stepping
--ioport-debug Enable ioport debugging
.

So we can have

	-c --cpus
	-m --mem
	-d --disk
	-k --kernel
	-i --initrd

which is more consistent and easy to remember.

Signature · 2 lines
Best Regards,
Asias He
#3 lore raw
Quoted 11 lines · Asias He
Quoted 2 lines · Pekka Enberg

This patch changes the '-c' command line option to specify the number of CPUs because it's used more often than console switching.

I'd like to tune the command line option further.

1)
Change

    -i, --image <image>   Disk image
to
    -d, --disk  <disk>	  Disk image

Agreed.

Quoted 7 lines

2)
Change
-r, --initrd <initrd>
Initial RAM disk image
to
-i, --initrd <initrd>
Initial RAM disk image

Agreed.

Quoted 11 lines

3)
Change

    -d, --kvm-dev <kvm-dev>
                          KVM device file
    -s, --single-step     Enable single stepping
    -g, --ioport-debug    Enable ioport debugging

to
--kvm-dev <kvm-dev>
KVM device file
--single-step Enable single stepping
--ioport-debug Enable ioport debugging

Yeah, it would be nice to free up -d, -s, -g.

The debug options should probably be concentrated under a --debug option anyway, to allow things like:

--debug single-step,ioport

Even if the debug options are kept they should be streamlined along the same pattern:

Quoted 2 lines

--debug-single-step Enable single stepping
--debug-ioport Enable ioport debugging

But having a --debug option that recognizes all the debug flags would be nicer.

It would also allow future enhancements to group debug features, like:

  --debug all                # turn on everything and the kitchen sink for early hangs
  --debug all,-single-step   # turn on everything except single-step debugging
  --debug nonverbose         # turn on all non-noisy debug options we have

Maybe even:

--debug memcheck

... could run kvm under valgrind automatically - that way we can hide any secondary tool complexities from the user and turn those tools into simple debug options :-)

etc.

Quoted 7 lines

So we can have

	-c --cpus
	-m --mem
	-d --disk
	-k --kernel
	-i --initrd

which is more consistent and easy to remember.

Very nice plans!

The sooner we do this the fewer people will have to change their scripts and practices.

Thanks,

Ingo

#4 lore raw
Quoted 60 lines · Ingo Molnar
Quoted 11 lines · Asias He
Quoted 2 lines · Pekka Enberg

This patch changes the '-c' command line option to specify the number of CPUs because it's used more often than console switching.

I'd like to tune the command line option further.

1)
Change

    -i, --image <image>   Disk image
to
    -d, --disk  <disk>	  Disk image

Agreed.

Quoted 7 lines

2)
Change
-r, --initrd <initrd>
Initial RAM disk image
to
-i, --initrd <initrd>
Initial RAM disk image

Agreed.

Quoted 11 lines

3)
Change

    -d, --kvm-dev <kvm-dev>
                          KVM device file
    -s, --single-step     Enable single stepping
    -g, --ioport-debug    Enable ioport debugging

to
--kvm-dev <kvm-dev>
KVM device file
--single-step Enable single stepping
--ioport-debug Enable ioport debugging

Yeah, it would be nice to free up -d, -s, -g.

The debug options should probably be concentrated under a --debug option anyway, to allow things like:

--debug single-step,ioport

Even if the debug options are kept they should be streamlined along the same pattern:

Quoted 2 lines

--debug-single-step Enable single stepping
--debug-ioport Enable ioport debugging

But having a --debug option that recognizes all the debug flags would be nicer.

It would also allow future enhancements to group debug features, like:

  --debug all                # turn on everything and the kitchen sink for early hangs
  --debug all,-single-step   # turn on everything except single-step debugging
  --debug nonverbose         # turn on all non-noisy debug options we have
Quoted 7 lines

Maybe even:

--debug memcheck

... could run kvm under valgrind automatically - that way we can hide any secondary tool complexities from the user and turn those tools into simple debug options :-)

Great idea.

Quoted 11 lines

etc.

Quoted 7 lines

So we can have

	-c --cpus
	-m --mem
	-d --disk
	-k --kernel
	-i --initrd

which is more consistent and easy to remember.

Quoted 4 lines

Very nice plans!

The sooner we do this the fewer people will have to change their scripts and practices.

Sure! I will cook a patch.

Signature · 2 lines
Best Regards,
Asias He