From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LrYkD-0002DB-KS for qemu-devel@nongnu.org; Wed, 08 Apr 2009 10:27:13 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LrYk8-0002Ay-V2 for qemu-devel@nongnu.org; Wed, 08 Apr 2009 10:27:13 -0400 Received: from [199.232.76.173] (port=57890 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LrYk8-0002At-Kq for qemu-devel@nongnu.org; Wed, 08 Apr 2009 10:27:08 -0400 Received: from lizzard.sbs.de ([194.138.37.39]:17293) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LrYk8-00061s-4T for qemu-devel@nongnu.org; Wed, 08 Apr 2009 10:27:08 -0400 Message-ID: <49DCB438.2070803@siemens.com> Date: Wed, 08 Apr 2009 16:27:04 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <1239200204-4934-1-git-send-email-aliguori@us.ibm.com> In-Reply-To: <1239200204-4934-1-git-send-email-aliguori@us.ibm.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 1/3] Allow multiple monitor devices Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: libvir-list@redhat.com, qemu-devel@nongnu.org, Hollis Blanchard Anthony Liguori wrote: > Right now only one monitor device can be enabled at a time. In order to support I guess you are talking about -monitor provided instances here. There can already be multiple instances (multiplexed ones or the one provided via gdb). > asynchronous notification of events, I would like to introduce a 'wait' command > that waits for an event to occur. This implies that we need an additional > monitor session to allow commands to still be executed while waiting for an > asynchronous notification. Need to have a closer look at the actual patch later, but the description confuses me. 'wait' itself makes sense, though. Jan > > Signed-off-by: Anthony Liguori > > diff --git a/vl.c b/vl.c > index 4bd173f..f78cabb 100644 > --- a/vl.c > +++ b/vl.c > @@ -184,6 +184,9 @@ int main(int argc, char **argv) > /* Max number of bluetooth switches on the commandline. */ > #define MAX_BT_CMDLINE 10 > > +/* Maximum number of monitor devices */ > +#define MAX_MONITOR_DEVICES 10 > + > /* XXX: use a two level table to limit memory usage */ > #define MAX_IOPORTS 65536 > > @@ -4252,8 +4255,9 @@ int main(int argc, char **argv, char **envp) > int hda_index; > int optind; > const char *r, *optarg; > - CharDriverState *monitor_hd = NULL; > - const char *monitor_device; > + CharDriverState *monitor_hds[MAX_MONITOR_DEVICES]; > + const char *monitor_devices[MAX_MONITOR_DEVICES]; > + int monitor_device_index; > const char *serial_devices[MAX_SERIAL_PORTS]; > int serial_device_index; > const char *parallel_devices[MAX_PARALLEL_PORTS]; > @@ -4324,7 +4328,6 @@ int main(int argc, char **argv, char **envp) > kernel_cmdline = ""; > cyls = heads = secs = 0; > translation = BIOS_ATA_TRANSLATION_AUTO; > - monitor_device = "vc:80Cx24C"; > > serial_devices[0] = "vc:80Cx24C"; > for(i = 1; i < MAX_SERIAL_PORTS; i++) > @@ -4340,6 +4343,11 @@ int main(int argc, char **argv, char **envp) > virtio_consoles[i] = NULL; > virtio_console_index = 0; > > + monitor_devices[0] = "vc:80Cx24C"; > + for (i = 1; i < MAX_MONITOR_DEVICES; i++) > + monitor_devices[i] = NULL; > + monitor_device_index = 0; > + > usb_devices_index = 0; > > nb_net_clients = 0; > @@ -4723,7 +4731,12 @@ int main(int argc, char **argv, char **envp) > break; > } > case QEMU_OPTION_monitor: > - monitor_device = optarg; > + if (monitor_device_index >= MAX_MONITOR_DEVICES) { > + fprintf(stderr, "qemu: too many monitor devices\n"); > + exit(1); > + } > + monitor_devices[monitor_device_index] = optarg; > + monitor_device_index++; > break; > case QEMU_OPTION_serial: > if (serial_device_index >= MAX_SERIAL_PORTS) { > @@ -4974,8 +4987,8 @@ int main(int argc, char **argv, char **envp) > serial_devices[0] = "stdio"; > if (parallel_device_index == 0) > parallel_devices[0] = "null"; > - if (strncmp(monitor_device, "vc", 2) == 0) > - monitor_device = "stdio"; > + if (strncmp(monitor_devices[0], "vc", 2) == 0) > + monitor_devices[0] = "stdio"; > } > > #ifndef _WIN32 > @@ -5184,14 +5197,14 @@ int main(int argc, char **argv, char **envp) > #endif > > /* Maintain compatibility with multiple stdio monitors */ > - if (!strcmp(monitor_device,"stdio")) { > + if (!strcmp(monitor_devices[0],"stdio")) { > for (i = 0; i < MAX_SERIAL_PORTS; i++) { > const char *devname = serial_devices[i]; > if (devname && !strcmp(devname,"mon:stdio")) { > - monitor_device = NULL; > + monitor_devices[0] = NULL; > break; > } else if (devname && !strcmp(devname,"stdio")) { > - monitor_device = NULL; > + monitor_devices[0] = NULL; > serial_devices[i] = "mon:stdio"; > break; > } > @@ -5208,11 +5221,20 @@ int main(int argc, char **argv, char **envp) > } > } > > - if (monitor_device) { > - monitor_hd = qemu_chr_open("monitor", monitor_device, NULL); > - if (!monitor_hd) { > - fprintf(stderr, "qemu: could not open monitor device '%s'\n", monitor_device); > - exit(1); > + for (i = 0; i < MAX_MONITOR_DEVICES; i++) { > + const char *devname = monitor_devices[i]; > + if (devname && strcmp(devname, "none")) { > + char label[32]; > + if (i == 0) > + snprintf(label, sizeof(label), "monitor"); > + else > + snprintf(label, sizeof(label), "monitor%d", i); > + monitor_hds[i] = qemu_chr_open(label, devname, NULL); > + if (!monitor_hds[i]) { > + fprintf(stderr, "qemu: could not open monitor device '%s'\n", > + devname); > + exit(1); > + } > } > } > > @@ -5335,8 +5357,13 @@ int main(int argc, char **argv, char **envp) > text_consoles_set_display(display_state); > qemu_chr_initial_reset(); > > - if (monitor_device && monitor_hd) > - monitor_init(monitor_hd, MONITOR_USE_READLINE | MONITOR_IS_DEFAULT); > + for (i = 0; i < MAX_MONITOR_DEVICES; i++) { > + if (monitor_devices[i] && monitor_hds[i]) { > + monitor_init(monitor_hds[i], > + MONITOR_USE_READLINE | > + ((i == 0) ? MONITOR_IS_DEFAULT : 0)); > + } > + } > > for(i = 0; i < MAX_SERIAL_PORTS; i++) { > const char *devname = serial_devices[i]; -- Siemens AG, Corporate Technology, CT SE 2 Corporate Competence Center Embedded Linux