All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: Ian Pratt <m+Ian.Pratt@cl.cam.ac.uk>
Cc: xen-devel@lists.xensource.com, "Yu, Ping Y" <ping.y.yu@intel.com>
Subject: Re: [PATCH]fix VMX "xm console" issue
Date: Tue, 29 Nov 2005 08:10:19 -0600	[thread overview]
Message-ID: <438C614B.3080609@us.ibm.com> (raw)
In-Reply-To: <A95E2296287EAD4EB592B5DEEFCE0E9D32EC6E@liverpoolst.ad.cl.cam.ac.uk>

I'm not sure what this patch does.  cfmakeraw() will already set all of 
those flags.  You shouldn't have to set a baud rate on a PTY either.  Is 
the real bug that somehow init_term() wasn't being called when it should 
have been?

What flag, in particular, did you need set that wasn't being set by 
cfmakeraw()?  xenconsoled sets it's end of the PTY with cfmakeraw() so 
if we modify the client to use different termios settings we probably 
need to update the server too.

Regards,

Anthony Liguori

Ian Pratt wrote:

> 
>  
>
>>>Please expand upon what this issue with the console client is. Why 
>>>hasn't the issue been seen with paravirtualized domains?
>>>      
>>>
>>"xm console" in VMX could not work well now, as we know. We 
>>can see the output of the console, but it keeps scrolling 
>>like hitting enter. 
>>When I investigate this bug, I found that the serial 
>>parameter has not been set anywhere, which might be the cause 
>>of this issue.
>>    
>>
>
>I'd prefer to understand the issue a bit more first/
>
>  
>
>>The VMX console model for VMX is somewhat different with 
>>domU's. When the serial port is redirect to pty, write the 
>>allocated device to xenstore, then xm console can get it, 
>>thus xenconsole is independent of xenconsoled in VMX.
>>    
>>
>
>But xenconsole is used by paravirt guests too. What effect does this
>patch have on them?
>
>Ian
>
>  
>
>>>What behaviour does the tcsetattr alter, and why not just set that 
>>>particular bit?
>>>      
>>>
>>I found that Minicom can work well in "xm console" VMX, and 
>>borrow minicom's behavior to set some parameter for "xen 
>>console" and domU is working well too.
>>    
>>
>>>Thanks,
>>>Ian
>>>
>>>      
>>>
>>>># HG changeset patch
>>>># User Ping Yu <ping.y.yu@intel.com>
>>>># Node ID 71111788840f0dd557d7cfc4e919beb511c0237c
>>>># Parent  8451c65671238604e2678a1f44c2f582ec6ebf96
>>>>Fix an issue for VMX console.
>>>>Add a function to set serial parameter, thus make "xm 
>>>>        
>>>>
>>console" work 
>>    
>>
>>>>well both in domU and VMX
>>>>
>>>>Signed-off-by: Ping Yu <ping.y.yu@intel.com>
>>>>
>>>>diff -r 8451c6567123 -r 71111788840f tools/console/client/main.c
>>>>--- a/tools/console/client/main.c       Wed Nov 23 19:37:33 2005
>>>>+++ b/tools/console/client/main.c       Mon Nov 28 15:53:17 2005
>>>>@@ -87,6 +87,92 @@
>>>> 	tcsetattr(fd, TCSAFLUSH, &new_term);  }
>>>>
>>>>+/* Code borrowed from Minicom
>>>>+ * Set baudrate, parity and number of bits  */ static void 
>>>>+set_serial_argument(int fd, char *baudr, char *par,
>>>>+		char *bits, char *stopb, int hwf, int swf) {
>>>>+	int spd = -1;
>>>>+	int newbaud;
>>>>+	int bit = bits[0];
>>>>+
>>>>+	struct termios tty;
>>>>+
>>>>+	tcgetattr(fd, &tty);
>>>>+
>>>>+	  /* We generate mark and space parity ourself. */
>>>>+	if (bit == '7' && (par[0] == 'M' || par[0] == 'S'))
>>>>+		bit = '8';
>>>>+
>>>>+	 /* Check if 'baudr' is really a number */
>>>>+	if ((newbaud = (atol(baudr) / 100)) == 0 && baudr[0] != '0')
>>>>+		newbaud = -1;
>>>>+
>>>>+	switch(newbaud) {
>>>>+	case 0:
>>>>+	case 3:         spd = B300;     break;
>>>>+	case 6:         spd = B600;     break;
>>>>+	case 12:        spd = B1200;    break;
>>>>+	case 24:        spd = B2400;    break;
>>>>+	case 48:        spd = B4800;    break;
>>>>+	case 96:        spd = B9600;    break;
>>>>+	case 192:       spd = B19200;   break;
>>>>+	case 384:       spd = B38400;   break;
>>>>+	case 576:       spd = B57600;   break;
>>>>+	case 1152:      spd = B115200;  break;
>>>>+	case 2304:      spd = B230400;  break;
>>>>+	}
>>>>+
>>>>+	if (spd != -1) {
>>>>+		cfsetospeed(&tty, (speed_t)spd);
>>>>+		cfsetispeed(&tty, (speed_t)spd);
>>>>+	}
>>>>+
>>>>+	switch (bit) {
>>>>+	case '5':
>>>>+		tty.c_cflag = (tty.c_cflag & ~CSIZE) | CS5;
>>>>+		break;
>>>>+	case '6':
>>>>+		tty.c_cflag = (tty.c_cflag & ~CSIZE) | CS6;
>>>>+		break;
>>>>+	case '7':
>>>>+		tty.c_cflag = (tty.c_cflag & ~CSIZE) | CS7;
>>>>+		break;
>>>>+	case '8':
>>>>+	default:
>>>>+		tty.c_cflag = (tty.c_cflag & ~CSIZE) | CS8;
>>>>+		break;
>>>>+	}
>>>>+
>>>>+	  /* Set into raw, no echo mode */
>>>>+	tty.c_iflag =  IGNBRK;
>>>>+	tty.c_lflag = 0;
>>>>+	tty.c_oflag = 0;
>>>>+	tty.c_cflag |= CLOCAL | CREAD;
>>>>+	tty.c_cc[VMIN] = 1;
>>>>+	tty.c_cc[VTIME] = 5;
>>>>+
>>>>+	if (swf)
>>>>+		tty.c_iflag |= IXON | IXOFF;
>>>>+	else
>>>>+		tty.c_iflag &= ~(IXON|IXOFF|IXANY);
>>>>+
>>>>+	tty.c_cflag &= ~(PARENB | PARODD);
>>>>+	if (par[0] == 'E')
>>>>+		tty.c_cflag |= PARENB;
>>>>+	else if (par[0] == 'O')
>>>>+		tty.c_cflag |= (PARENB | PARODD);
>>>>+
>>>>+	if (stopb[0] == '2')
>>>>+		tty.c_cflag |= CSTOPB;
>>>>+	else
>>>>+		tty.c_cflag &= ~CSTOPB;
>>>>+
>>>>+	tcsetattr(fd, TCSANOW, &tty);
>>>>+
>>>>+}
>>>>+
>>>> static void restore_term(int fd, struct termios *old)  {
>>>> 	tcsetattr(fd, TCSAFLUSH, old);
>>>>@@ -260,6 +346,7 @@
>>>> 	free(path);
>>>>
>>>> 	init_term(STDIN_FILENO, &attr);
>>>>+	set_serial_argument(spty, "115200", "N", "8", "1", 1, 0);
>>>> 	console_loop(xc_handle, domid, spty);
>>>> 	restore_term(STDIN_FILENO, &attr);
>>>>
>>>>
>>>>
>>>>
>>>>Sincerely Yours
>>>>
>>>>Yu Ping
>>>>
>>>>
>>>>
>>>>        
>>>>
>
>_______________________________________________
>Xen-devel mailing list
>Xen-devel@lists.xensource.com
>http://lists.xensource.com/xen-devel
>
>  
>

  reply	other threads:[~2005-11-29 14:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-29 11:51 [PATCH]fix VMX "xm console" issue Ian Pratt
2005-11-29 14:10 ` Anthony Liguori [this message]
2005-11-29 14:51   ` Daniel Stekloff
2005-11-29 15:03     ` Anthony Liguori
  -- strict thread matches above, loose matches on Subject: below --
2005-12-02  7:08 Yu, Ping Y
2005-11-30 11:20 Ian Pratt
2005-11-30 11:18 Yu, Ping Y
2005-11-30 14:52 ` Anthony Liguori
2005-11-30 11:09 Yu, Ping Y
2005-11-30  2:00 Yu, Ping Y
2005-11-29 11:24 Yu, Ping Y
2005-11-29 11:19 Yu, Ping Y
2005-11-29 10:14 Ian Pratt
2005-11-29  3:03 Yu, Ping Y

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=438C614B.3080609@us.ibm.com \
    --to=aliguori@us.ibm.com \
    --cc=m+Ian.Pratt@cl.cam.ac.uk \
    --cc=ping.y.yu@intel.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.