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

RE: [Xen-devel] [PATCH]make "xm console" will not block VMX booting


  • To: "Yu, Ping Y" <ping.y.yu@xxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: "Yu, Ping Y" <ping.y.yu@xxxxxxxxx>
  • Date: Fri, 20 Jan 2006 14:31:59 +0800
  • Delivery-date: Fri, 20 Jan 2006 06:39:56 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • Thread-index: AcYdaTbd6H3JbtNeQQGujqgtxMK2WAAIbfbA
  • Thread-topic: [Xen-devel] [PATCH]make "xm console" will not block VMX booting

Resend to attach the patch.

>-----Original Message-----
>From: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
>[mailto:xen-devel-bounces@xxxxxxxxxxxxxxxxxxx] On Behalf Of Yu, Ping Y
>Sent: 2006年1月20日 10:29
>To: xen-devel@xxxxxxxxxxxxxxxxxxx
>Subject: [Xen-devel] [PATCH]make "xm console" will not block VMX booting
>
>There is a known "xm console" issue related with VMX. When "serial" is
>enabled
>in script and no once uses "xm console" to read the console, VMX boting
>will hang
>due to the buffer is full.
>I added a "select" before "write". If it could not be written,
>unix_write will
>Return immediately and it will not block the VMX booting. With this fix,
>we can
> make VMX's serial enable by default.
>
>Signed-off-by: Yu Ping <ping.y.yu@xxxxxxxxx>
>
>diff -r 6ce7c026320e tools/examples/xmexample.vmx
>--- a/tools/examples/xmexample.vmx     Mon Jan 16 23:54:24 2006
>+++ b/tools/examples/xmexample.vmx     Wed Jan 18 16:23:10 2006
>@@ -132,7 +132,7 @@
>
>#-----------------------------------------------------------------------
>------
> #   serial port re-direct to pty deivce, /dev/pts/n
> #   then xm console or minicom can connect
>-#serial='pty'
>+serial='pty'
>
>
>#-----------------------------------------------------------------------
>-----
> # enable ne2000, default = 0(use pcnet)
>diff -r 6ce7c026320e tools/ioemu/vl.c
>--- a/tools/ioemu/vl.c Mon Jan 16 23:54:24 2006
>+++ b/tools/ioemu/vl.c Wed Jan 18 16:23:10 2006
>@@ -957,19 +957,34 @@
>
> static int unix_write(int fd, const uint8_t *buf, int len1)
> {
>-    int ret, len;
>+    int ret,sel_ret,len;
>+    int max_fd;
>+    fd_set writefds;
>+    struct timeval timeout;
>+
>+    max_fd = fd;
>
>     len = len1;
>     while (len > 0) {
>-        ret = write(fd, buf, len);
>-        if (ret < 0) {
>-            if (errno != EINTR && errno != EAGAIN)
>-                return -1;
>-        } else if (ret == 0) {
>-            break;
>-        } else {
>-            buf += ret;
>-            len -= ret;
>+        FD_ZERO(&writefds);
>+        FD_SET(fd, &writefds);
>+      timeout.tv_sec = 0;
>+      timeout.tv_usec = 0;
>+      sel_ret = select(max_fd + 1, NULL, &writefds, 0, &timeout);
>+      if (sel_ret <= 0) {
>+              /* Timeout or select error */
>+            return -1;
>+      } else {
>+            ret = write(fd, buf, len);
>+            if (ret < 0) {
>+                if (errno != EINTR && errno != EAGAIN)
>+                    return -1;
>+            } else if (ret == 0) {
>+                  break;
>+            } else {
>+                  buf += ret;
>+                    len -= ret;
>+            }
>         }
>     }
>     return len1 - len;
>
>
>Ping
>
>_______________________________________________
>Xen-devel mailing list
>Xen-devel@xxxxxxxxxxxxxxxxxxx
>http://lists.xensource.com/xen-devel

Attachment: xm_console.patch
Description: xm_console.patch

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.