[tip:tools/kvm] kvm tools: Add 'kvm debug' command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit-ID:  5b652ac6f9efbbb2f767578c5fcd121651e1f83d
Gitweb:     http://git.kernel.org/tip/5b652ac6f9efbbb2f767578c5fcd121651e1f83d
Author:     Pekka Enberg <penberg@xxxxxxxxxx>
AuthorDate: Thu, 2 Jun 2011 12:11:28 +0300
Committer:  Pekka Enberg <penberg@xxxxxxxxxx>
CommitDate: Thu, 2 Jun 2011 12:11:28 +0300

kvm tools: Add 'kvm debug' command

This patch adds a 'kvm debug' command that's currently an alias for

  kill -3 `pidof kvm`

which prints out debugging diagnostics for guests.

Suggested-by: Ingo Molnar <mingo@xxxxxxx>
Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx>
---
 tools/kvm/Makefile                |   41 +++++++++++++++++++------------------
 tools/kvm/include/kvm/kvm-debug.h |    6 +++++
 tools/kvm/kvm-cmd.c               |    8 ++++--
 tools/kvm/kvm-debug.c             |   11 ++++++++++
 4 files changed, 43 insertions(+), 23 deletions(-)

diff --git a/tools/kvm/Makefile b/tools/kvm/Makefile
index 8fa7ca8..a05a6b1 100644
--- a/tools/kvm/Makefile
+++ b/tools/kvm/Makefile
@@ -16,16 +16,17 @@ CSCOPE = cscope
 TAGS = ctags
 
 OBJS	+= cpuid.o
-OBJS	+= read-write.o
+OBJS	+= disk/core.o
+OBJS	+= hw/rtc.o
+OBJS	+= hw/serial.o
 OBJS	+= interrupt.o
 OBJS	+= ioport.o
-OBJS	+= kvm.o
 OBJS	+= kvm-cpu.o
+OBJS	+= kvm.o
 OBJS	+= main.o
 OBJS	+= mmio.o
 OBJS	+= pci.o
-OBJS	+= hw/rtc.o
-OBJS	+= hw/serial.o
+OBJS	+= read-write.o
 OBJS	+= term.o
 OBJS	+= util.o
 OBJS	+= virtio/blk.o
@@ -33,22 +34,22 @@ OBJS	+= virtio/console.o
 OBJS	+= virtio/core.o
 OBJS	+= virtio/net.o
 OBJS	+= virtio/rng.o
-OBJS    += util/parse-options.o
-OBJS    += util/strbuf.o
-OBJS    += kvm-help.o
-OBJS    += kvm-cmd.o
-OBJS    += kvm-run.o
-OBJS    += disk/qcow.o
-OBJS	+= disk/core.o
-OBJS    += disk/raw.o
-OBJS    += disk/blk.o
-OBJS    += mptable.o
-OBJS    += threadpool.o
-OBJS    += irq.o
-OBJS    += rbtree.o
-OBJS    += util/rbtree-interval.o
-OBJS    += virtio/9p.o
-OBJS    += ioeventfd.o
+OBJS	+= disk/blk.o
+OBJS	+= disk/qcow.o
+OBJS	+= disk/raw.o
+OBJS	+= ioeventfd.o
+OBJS	+= irq.o
+OBJS	+= kvm-cmd.o
+OBJS	+= kvm-debug.o
+OBJS	+= kvm-help.o
+OBJS	+= kvm-run.o
+OBJS	+= mptable.o
+OBJS	+= rbtree.o
+OBJS	+= threadpool.o
+OBJS	+= util/parse-options.o
+OBJS	+= util/rbtree-interval.o
+OBJS	+= util/strbuf.o
+OBJS	+= virtio/9p.o
 
 
 FLAGS_BFD=$(CFLAGS) -lbfd
diff --git a/tools/kvm/include/kvm/kvm-debug.h b/tools/kvm/include/kvm/kvm-debug.h
new file mode 100644
index 0000000..190cf31
--- /dev/null
+++ b/tools/kvm/include/kvm/kvm-debug.h
@@ -0,0 +1,6 @@
+#ifndef KVM__DEBUG_H
+#define KVM__DEBUG_H
+
+int kvm_cmd_debug(int argc, const char **argv, const char *prefix);
+
+#endif
diff --git a/tools/kvm/kvm-cmd.c b/tools/kvm/kvm-cmd.c
index e545d14..2ea51a5 100644
--- a/tools/kvm/kvm-cmd.c
+++ b/tools/kvm/kvm-cmd.c
@@ -5,11 +5,13 @@
 #include <assert.h>
 
 /* user defined header files */
-#include <kvm/kvm-cmd.h>
-#include <kvm/kvm-help.h>
-#include <kvm/kvm-run.h>
+#include "kvm/kvm-debug.h"
+#include "kvm/kvm-help.h"
+#include "kvm/kvm-cmd.h"
+#include "kvm/kvm-run.h"
 
 struct cmd_struct kvm_commands[] = {
+	{ "debug", kvm_cmd_debug, NULL,         0 },
 	{ "help",  kvm_cmd_help,  NULL,         0 },
 	{ "run",   kvm_cmd_run,   kvm_run_help, 0 },
 	{ NULL,    NULL,          NULL,         0 },
diff --git a/tools/kvm/kvm-debug.c b/tools/kvm/kvm-debug.c
new file mode 100644
index 0000000..58782dd
--- /dev/null
+++ b/tools/kvm/kvm-debug.c
@@ -0,0 +1,11 @@
+#include <stdio.h>
+#include <string.h>
+
+#include <kvm/util.h>
+#include <kvm/kvm-cmd.h>
+#include <kvm/kvm-debug.h>
+
+int kvm_cmd_debug(int argc, const char **argv, const char *prefix)
+{
+	return system("kill -3 $(pidof kvm)");
+}
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux