Thanks Jeff,

I'll try the patch in the next day or so and let you know.


Mark

At 01:02 PM 8/24/2007, Jeff Dike wrote:
>On Thu, Aug 23, 2007 at 09:36:42AM -0700, Mark wrote:
> > Sorry about the HTML email, I think it is disabled now.
>
>Yup, thanks.
>
> > The ioctl calls that returned -1 from the strace are:
> > ioctl (4, TIOCGSERIAL)
> > ioctl (3, TIOCMGET,[0])
> > ioctl (4, SNDCTL_TMR_START or TCSETS, {B230400 -opost -isig -icanon
> > -echo ...})
>
>See if the patch below makes any difference.  I pass TIOCGSERIAL
>through to the host since the serial drivers seem to handle it.
>TIOCMGET and TCSETS seem to be handled within the kernel without
>looking at hardware.
>
> > The problem seems (to me) to be that the buffer in the host is not
> > getting flushed to the client (or guest to host) correctly or something
> > similar.  I also suspect this is the same reason ssh and sftp are slow
> > to get the login prompt.   Not a big problem though.
>
>You might debug this by running strace simultaneously, with
>timestamps, on UML on the host and on wvdial inside UML and merging
>the output.
>
>                                 Jeff
>
>--
>Work email - jdike at linux dot intel dot com
>
>Index: linux-2.6.22/arch/um/drivers/chan_kern.c
>===================================================================
>--- linux-2.6.22.orig/arch/um/drivers/chan_kern.c       2007-08-24 
>12:45:06.000000000 -0400
>+++ linux-2.6.22/arch/um/drivers/chan_kern.c    2007-08-24 
>12:45:29.000000000 -0400
>@@ -309,6 +309,21 @@ int write_chan(struct list_head *chans,
>         return ret;
>  }
>
>+int ioctl_chan(struct list_head *chans, unsigned int cmd, unsigned long arg)
>+{
>+       struct list_head *ele;
>+       struct chan *chan;
>+
>+       list_for_each(ele, chans) {
>+               chan = list_entry(ele, struct chan, list);
>+               if (chan->primary)
>+                       return os_ioctl_generic(chan->fd, cmd, arg);
>+       }
>+
>+       /* Shouldn't get here */
>+       return -ENODEV;
>+}
>+
>  int console_write_chan(struct list_head *chans, const char *buf, int len)
>  {
>         struct list_head *ele;
>Index: linux-2.6.22/arch/um/drivers/line.c
>===================================================================
>--- linux-2.6.22.orig/arch/um/drivers/line.c    2007-08-24 
>12:45:06.000000000 -0400
>+++ linux-2.6.22/arch/um/drivers/line.c 2007-08-24 12:58:50.000000000 -0400
>@@ -5,6 +5,8 @@
>
>  #include "linux/irqreturn.h"
>  #include "linux/kd.h"
>+#include <linux/serial.h>
>+#include <asm/uaccess.h>
>  #include "chan_kern.h"
>  #include "irq_kern.h"
>  #include "irq_user.h"
>@@ -242,37 +244,11 @@ void line_set_termios(struct tty_struct
>         /* nothing */
>  }
>
>-static const struct {
>-       int  cmd;
>-       char *level;
>-       char *name;
>-} tty_ioctls[] = {
>-       /* don't print these, they flood the log ... */
>-       { TCGETS,      NULL,       "TCGETS"      },
>-       { TCSETS,      NULL,       "TCSETS"      },
>-       { TCSETSW,     NULL,       "TCSETSW"     },
>-       { TCFLSH,      NULL,       "TCFLSH"      },
>-       { TCSBRK,      NULL,       "TCSBRK"      },
>-
>-       /* general tty stuff */
>-       { TCSETSF,     KERN_DEBUG, "TCSETSF"     },
>-       { TCGETA,      KERN_DEBUG, "TCGETA"      },
>-       { TIOCMGET,    KERN_DEBUG, "TIOCMGET"    },
>-       { TCSBRKP,     KERN_DEBUG, "TCSBRKP"     },
>-       { TIOCMSET,    KERN_DEBUG, "TIOCMSET"    },
>-
>-       /* linux-specific ones */
>-       { TIOCLINUX,   KERN_INFO,  "TIOCLINUX"   },
>-       { KDGKBMODE,   KERN_INFO,  "KDGKBMODE"   },
>-       { KDGKBTYPE,   KERN_INFO,  "KDGKBTYPE"   },
>-       { KDSIGACCEPT, KERN_INFO,  "KDSIGACCEPT" },
>-};
>-
>  int line_ioctl(struct tty_struct *tty, struct file * file,
>                unsigned int cmd, unsigned long arg)
>  {
>+       struct line *line = tty->driver_data;
>         int ret;
>-       int i;
>
>         ret = 0;
>         switch(cmd) {
>@@ -294,6 +270,9 @@ int line_ioctl(struct tty_struct *tty, s
>         case TCSETSW:
>         case TCSETS:
>         case TCGETA:
>+       case TIOCMGET:
>+       case TIOCMSET:
>+       case TCSBRKP:
>         case TCSETAF:
>         case TCSETAW:
>         case TCSETA:
>@@ -306,20 +285,29 @@ int line_ioctl(struct tty_struct *tty, s
>         case TIOCPKT:
>         case TIOCGSOFTCAR:
>         case TIOCSSOFTCAR:
>+       case TIOCLINUX:
>+       case KDGKBMODE:
>+       case KDGKBTYPE:
>+       case KDSIGACCEPT:
>                 return -ENOIOCTLCMD;
>+       case TIOCGSERIAL: {
>+               struct serial_struct tmp;
>+
>+               ret = ioctl_chan(&line->chan_list, TIOCGSERIAL, (int) &tmp);
>+               if (ret)
>+                       break;
>+
>+               if (copy_to_user((void __user *) arg, &tmp, sizeof(tmp)))
>+                       ret = -EFAULT;
>+       }
>  #if 0
>         case TCwhatever:
>                 /* do something */
>                 break;
>  #endif
>         default:
>-               for (i = 0; i < ARRAY_SIZE(tty_ioctls); i++)
>-                       if (cmd == tty_ioctls[i].cmd)
>-                               break;
>-               if (i == ARRAY_SIZE(tty_ioctls)) {
>-                       printk(KERN_ERR "%s: %s: unknown ioctl: 0x%x\n",
>-                              __FUNCTION__, tty->name, cmd);
>-               }
>+               printk(KERN_ERR "line_ioctl : %s: unknown ioctl: 0x%x\n",
>+                      tty->name, cmd);
>                 ret = -ENOIOCTLCMD;
>                 break;
>         }
>Index: linux-2.6.22/arch/um/include/chan_kern.h
>===================================================================
>--- linux-2.6.22.orig/arch/um/include/chan_kern.h       2007-08-24 
>12:45:06.000000000 -0400
>+++ linux-2.6.22/arch/um/include/chan_kern.h    2007-08-24 
>12:45:29.000000000 -0400
>@@ -34,6 +34,8 @@ extern int parse_chan_pair(char *str, st
>  extern int open_chan(struct list_head *chans);
>  extern int write_chan(struct list_head *chans, const char *buf, int len,
>                              int write_irq);
>+extern int ioctl_chan(struct list_head *chans, unsigned int cmd,
>+                     unsigned long arg);
>  extern int console_write_chan(struct list_head *chans, const char *buf,
>                               int len);
>  extern int console_open_chan(struct line *line, struct console *co);


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
User-mode-linux-user mailing list
User-mode-linux-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user

Reply via email to