public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Remove application name decoration
@ 2008-07-17 20:47 Anthony Liguori
  2008-07-17 20:47 ` [PATCH 2/2] Add info kvm monitor command Anthony Liguori
  2008-07-19  7:54 ` [PATCH 1/2] Remove application name decoration Avi Kivity
  0 siblings, 2 replies; 3+ messages in thread
From: Anthony Liguori @ 2008-07-17 20:47 UTC (permalink / raw)
  To: kvm; +Cc: Avi Kivity, Anthony Liguori

Decorating the application name is not the best way to let users figure out
if KVM is enabled or not.  It's impossible for management applications to
figure out, inconsistent with other accelerators like kqemu, and clutters the
title bar.

We may experience a little user pain in the short term since we've told users to
look for it to determine if KVM is enabled or not but having a proper monitor
command is better in the long run.

I also think it will be hard to merge this into upstream QEMU whereas a monitor
command will be obvious to merge.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

diff --git a/qemu/console.h b/qemu/console.h
index c12898a..561ef51 100644
--- a/qemu/console.h
+++ b/qemu/console.h
@@ -180,6 +180,4 @@ const char *readline_get_history(unsigned int index);
 void readline_start(const char *prompt, int is_password,
                     ReadLineFunc *readline_func, void *opaque);
 
-void decorate_application_name(char *name, int max_len);
-
 #endif
diff --git a/qemu/sdl.c b/qemu/sdl.c
index 4b7229e..719e2bd 100644
--- a/qemu/sdl.c
+++ b/qemu/sdl.c
@@ -220,7 +220,7 @@ static void sdl_process_key(SDL_KeyboardEvent *ev)
 
 static void sdl_update_caption(void)
 {
-    char buf[1024], appname[20] = "QEMU";
+    char buf[1024];
     const char *status = "";
 
     if (!vm_running)
@@ -232,14 +232,12 @@ static void sdl_update_caption(void)
             status = " - Press Ctrl-Alt-Shift to exit grab";
     }
 
-    decorate_application_name(appname, sizeof appname);
-
     if (qemu_name)
-        snprintf(buf, sizeof(buf), "%s (%s)%s", appname, qemu_name, status);
+        snprintf(buf, sizeof(buf), "QEMU (%s)%s", qemu_name, status);
     else
-        snprintf(buf, sizeof(buf), "%s%s", appname, status);
+        snprintf(buf, sizeof(buf), "QEMU%s", status);
 
-    SDL_WM_SetCaption(buf, appname);
+    SDL_WM_SetCaption(buf, "QEMU");
 }
 
 static void sdl_hide_cursor(void)
diff --git a/qemu/vl.c b/qemu/vl.c
index 0bb4e5b..24e6971 100644
--- a/qemu/vl.c
+++ b/qemu/vl.c
@@ -268,17 +268,6 @@ static void main_loop_break(void)
 	qemu_kvm_notify_work();
 }
 
-void decorate_application_name(char *appname, int max_len)
-{
-    if (kvm_enabled())
-    {
-        int remain = max_len - strlen(appname) - 1;
-
-        if (remain > 0)
-            strncat(appname, "/KVM", remain);
-    }
-}
-
 /***********************************************************/
 /* x86 ISA bus support */
 
diff --git a/qemu/vnc.c b/qemu/vnc.c
index 7f10af6..31118ee 100644
--- a/qemu/vnc.c
+++ b/qemu/vnc.c
@@ -1270,7 +1270,6 @@ static int protocol_client_init(VncState *vs, uint8_t *data, size_t len)
     char pad[3] = { 0, 0, 0 };
     char buf[1024];
     int size;
-    char prog[30] = "QEMU";
 
     vs->width = vs->ds->width;
     vs->height = vs->ds->height;
@@ -1315,12 +1314,10 @@ static int protocol_client_init(VncState *vs, uint8_t *data, size_t len)
 
     vnc_write(vs, pad, 3);           /* padding */
 
-    decorate_application_name((char *)prog, sizeof prog);
-
     if (qemu_name)
-        size = snprintf(buf, sizeof(buf), "%s (%s)", prog, qemu_name);
+        size = snprintf(buf, sizeof(buf), "QEMU (%s)", qemu_name);
     else
-        size = snprintf(buf, sizeof(buf), "%s", prog);
+        size = snprintf(buf, sizeof(buf), "QEMU");
 
     vnc_write_u32(vs, size);
     vnc_write(vs, buf, size);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] Add info kvm monitor command
  2008-07-17 20:47 [PATCH 1/2] Remove application name decoration Anthony Liguori
@ 2008-07-17 20:47 ` Anthony Liguori
  2008-07-19  7:54 ` [PATCH 1/2] Remove application name decoration Avi Kivity
  1 sibling, 0 replies; 3+ messages in thread
From: Anthony Liguori @ 2008-07-17 20:47 UTC (permalink / raw)
  To: kvm; +Cc: Avi Kivity, Anthony Liguori

Add an 'info kvm' command to the monitor to be used to determine if KVM is
active.  It's very similar to the existing 'info kqemu' command.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

diff --git a/qemu/monitor.c b/qemu/monitor.c
index 46d5998..20dcca6 100644
--- a/qemu/monitor.c
+++ b/qemu/monitor.c
@@ -1272,6 +1272,19 @@ static void do_info_kqemu(void)
 #endif
 }
 
+static void do_info_kvm(void)
+{
+#ifdef USE_KVM
+    term_printf("kvm support: ");
+    if (kvm_enabled())
+	term_printf("enabled\n");
+    else
+	term_printf("disabled\n");
+#else
+    term_printf("kvm support: not compiled\n");
+#endif
+}
+
 #ifdef CONFIG_PROFILER
 
 int64_t kqemu_time;
@@ -1517,6 +1530,8 @@ static term_cmd_t info_cmds[] = {
       "", "show dynamic compiler info", },
     { "kqemu", "", do_info_kqemu,
       "", "show kqemu information", },
+    { "kvm", "", do_info_kvm,
+      "", "show kvm information", },
     { "usb", "", usb_info,
       "", "show guest USB devices", },
     { "usbhost", "", usb_host_info,

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] Remove application name decoration
  2008-07-17 20:47 [PATCH 1/2] Remove application name decoration Anthony Liguori
  2008-07-17 20:47 ` [PATCH 2/2] Add info kvm monitor command Anthony Liguori
@ 2008-07-19  7:54 ` Avi Kivity
  1 sibling, 0 replies; 3+ messages in thread
From: Avi Kivity @ 2008-07-19  7:54 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: kvm

Anthony Liguori wrote:
> Decorating the application name is not the best way to let users figure out
> if KVM is enabled or not.  It's impossible for management applications to
> figure out, inconsistent with other accelerators like kqemu, and clutters the
> title bar.
>
> We may experience a little user pain in the short term since we've told users to
> look for it to determine if KVM is enabled or not but having a proper monitor
> command is better in the long run.
>
> I also think it will be hard to merge this into upstream QEMU whereas a monitor
> command will be obvious to merge.
>   

Applied both patches, thanks.

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-07-19  7:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-17 20:47 [PATCH 1/2] Remove application name decoration Anthony Liguori
2008-07-17 20:47 ` [PATCH 2/2] Add info kvm monitor command Anthony Liguori
2008-07-19  7:54 ` [PATCH 1/2] Remove application name decoration Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox