linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* 3.4.10 N_GSM tty_io WARNING and lockup
@ 2012-09-05 10:56 Krzysztof Hałasa
  2012-09-06 13:01 ` Alan Cox
  0 siblings, 1 reply; 6+ messages in thread
From: Krzysztof Hałasa @ 2012-09-05 10:56 UTC (permalink / raw)
  To: linux-kernel

Hi,

I'm trying to use GSM tty line discipline. Basically

echo AT+CMUX=0 > /dev/ttyS0

set termios (speed etc.)
int ldisc = N_GSM0710;
ioctl(fd, TIOCSETD, &ldisc);

...

The ioctl first fails with EIO (probably due to inactive DCD line) in
tty_set_ldisc():

	if (test_bit(TTY_HUPPED, &tty->flags)) {
		/* We were raced by the hangup method. It will have stomped
		   the ldisc data and closed the ldisc down */
		clear_bit(TTY_LDISC_CHANGING, &tty->flags);
		mutex_unlock(&tty->ldisc_mutex);
		tty_ldisc_put(new_ldisc);
		tty_unlock();
		return -EIO;                         <<<<<< HERE
	}


Now trying to run the program again:

------------[ cut here ]------------
WARNING: at /home/khalasa/src/linux-3.4/drivers/tty/tty_io.c:1368 tty_open+0x2e8/0x55c()
Modules linked in: m25p80 ag71xx
Call Trace:
 [<8030a02c>] dump_stack+0x8/0x34
 [<8007a35c>] warn_slowpath_common+0x78/0xa4
 [<8007a3a0>] warn_slowpath_null+0x18/0x24
 [<80193cac>] tty_open+0x2e8/0x55c
 [<800f1500>] chrdev_open+0x120/0x164
 [<800eb320>] __dentry_open.isra.12+0x1bc/0x318
 [<800fae54>] do_last.isra.32+0x774/0x78c
 [<800fb094>] path_openat+0xcc/0x3b4
 [<800fb498>] do_filp_open+0x3c/0xa4
 [<800ec3dc>] do_sys_open+0x13c/0x1ec
 [<80068dc4>] stack_done+0x20/0x40

---[ end trace 5958cc366bfb54c4 ]---

then it locks up (task "D" state, though interruptible).

A known problem probably?
Any ideas? (I know about CLOCAL).
-- 
Krzysztof Halasa

Research Institute for Automation and Measurements PIAP
Al. Jerozolimskie 202, 02-486 Warsaw, Poland

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

* Re: 3.4.10 N_GSM tty_io WARNING and lockup
  2012-09-05 10:56 3.4.10 N_GSM tty_io WARNING and lockup Krzysztof Hałasa
@ 2012-09-06 13:01 ` Alan Cox
  2012-09-07 11:07   ` Krzysztof Hałasa
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Cox @ 2012-09-06 13:01 UTC (permalink / raw)
  To: Krzysztof Hałasa; +Cc: linux-kernel

On Wed, 05 Sep 2012 12:56:03 +0200
khalasa@piap.pl (Krzysztof Hałasa) wrote:

> Hi,
> 
> I'm trying to use GSM tty line discipline. Basically
> 
> echo AT+CMUX=0 > /dev/ttyS0
> 
> set termios (speed etc.)
> int ldisc = N_GSM0710;
> ioctl(fd, TIOCSETD, &ldisc);

Baffled at this point. If you set some other ldisc instead (eg PPP) can
you reproduce it the same way ?

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

* Re: 3.4.10 N_GSM tty_io WARNING and lockup
  2012-09-06 13:01 ` Alan Cox
@ 2012-09-07 11:07   ` Krzysztof Hałasa
  2012-09-07 12:59     ` Krzysztof Halasa
  0 siblings, 1 reply; 6+ messages in thread
From: Krzysztof Hałasa @ 2012-09-07 11:07 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel

Alan Cox <alan@lxorguk.ukuu.org.uk> writes:

>> I'm trying to use GSM tty line discipline. Basically
>> 
>> echo AT+CMUX=0 > /dev/ttyS0
>> 
>> set termios (speed etc.)
>> int ldisc = N_GSM0710;
>> ioctl(fd, TIOCSETD, &ldisc);
>
> Baffled at this point. If you set some other ldisc instead (eg PPP) can
> you reproduce it the same way ?

In the meantime I've rebased to v3.5.3 and it started to work. Do you
think it is worth it investigating v3.4.10 at this point?

This is Atheros AR71xx based RouterStation Pro board (MIPS). I'm using
several patches supporting this board, though I can't see anything
relevant to serial/tty, except maybe the following (which is IMHO not
the problem source either):

@@ -1941,17 +1941,20 @@ static int serial8250_startup(struct uart_port *port)
	if (port->type == PORT_16C950) {
 		/* Wake up and initialize UART */
-		up->acr = 0;
+		up->acr = UART_ACR_RTS_485;
+		serial_icr_write(up, UART_ACR, up->acr);
 		serial_port_out(port, UART_LCR, UART_LCR_CONF_MODE_B);
 		serial_port_out(port, UART_EFR, UART_EFR_ECB);
 		serial_port_out(port, UART_IER, 0);
 		serial_port_out(port, UART_LCR, 0);
+#if 0
 		serial_icr_write(up, UART_CSR, 0); /* Reset the UART */
 		serial_port_out(port, UART_LCR, UART_LCR_CONF_MODE_B);
 		serial_port_out(port, UART_EFR, UART_EFR_ECB);
 		serial_port_out(port, UART_LCR, 0);
+#endif

Anyway the patchsets are almost identical with both kernel versions.
-- 
Krzysztof Halasa

Research Institute for Automation and Measurements PIAP
Al. Jerozolimskie 202, 02-486 Warsaw, Poland

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

* Re: 3.4.10 N_GSM tty_io WARNING and lockup
  2012-09-07 11:07   ` Krzysztof Hałasa
@ 2012-09-07 12:59     ` Krzysztof Halasa
  2012-09-07 13:29       ` Alan Cox
  0 siblings, 1 reply; 6+ messages in thread
From: Krzysztof Halasa @ 2012-09-07 12:59 UTC (permalink / raw)
  To: Krzysztof Hałasa; +Cc: Alan Cox, linux-kernel

> In the meantime I've rebased to v3.5.3 and it started to work. Do you
> think it is worth it investigating v3.4.10 at this point?

BTW I'm not sure if it's a known bug: I closed the /dev/ttyS0 with
/dev/gsmmuxX still open, and then tried to set N_TTY ldisc on the
master device. It didn't work so well :-(

# killall -9 microcom	# they use /dev/gsmmux[0-3]
# killall -9 iru	# the program messing with ldiscs
# ps axf

  344 ?        Ss     0:00  \_ sshd: root@pts/1
  346 pts/1    Ss     0:00  |   \_ -sh
  405 pts/1    D+     0:00  |       \_ [microcom]
  347 ?        Ss     0:00  \_ sshd: root@pts/2
  349 pts/2    Ss     0:00  |   \_ -sh
  403 pts/2    D+     0:00  |       \_ [microcom]
  406 ?        Ss     0:00  \_ sshd: root@pts/3
  408 pts/3    Ss     0:00  |   \_ -sh
  412 pts/3    D+     0:00  |       \_ [microcom]
  409 ?        Ss     0:00  \_ sshd: root@pts/4
  411 pts/4    Ss     0:00      \_ -sh
  413 pts/4    D+     0:00          \_ [microcom]
  415 pts/0    D      0:00 iru
-- 
Krzysztof Halasa

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

* Re: 3.4.10 N_GSM tty_io WARNING and lockup
  2012-09-07 12:59     ` Krzysztof Halasa
@ 2012-09-07 13:29       ` Alan Cox
  2012-09-07 16:14         ` Krzysztof Halasa
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Cox @ 2012-09-07 13:29 UTC (permalink / raw)
  To: Krzysztof Halasa; +Cc: Krzysztof Hałasa, linux-kernel

On Fri, 07 Sep 2012 14:59:26 +0200
Krzysztof Halasa <khc@pm.waw.pl> wrote:

> > In the meantime I've rebased to v3.5.3 and it started to work. Do you
> > think it is worth it investigating v3.4.10 at this point?
> 
> BTW I'm not sure if it's a known bug: I closed the /dev/ttyS0 with
> /dev/gsmmuxX still open, and then tried to set N_TTY ldisc on the
> master device. It didn't work so well :-(

That should be fixed in 3.7. It's unfixable until the lock splitting work
is merged.

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

* Re: 3.4.10 N_GSM tty_io WARNING and lockup
  2012-09-07 13:29       ` Alan Cox
@ 2012-09-07 16:14         ` Krzysztof Halasa
  0 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Halasa @ 2012-09-07 16:14 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel

Alan Cox <alan@lxorguk.ukuu.org.uk> writes:

>> BTW I'm not sure if it's a known bug: I closed the /dev/ttyS0 with
>> /dev/gsmmuxX still open, and then tried to set N_TTY ldisc on the
>> master device. It didn't work so well :-(
>
> That should be fixed in 3.7. It's unfixable until the lock splitting work
> is merged.

I see. Thanks.
-- 
Krzysztof Halasa

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

end of thread, other threads:[~2012-09-07 16:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-05 10:56 3.4.10 N_GSM tty_io WARNING and lockup Krzysztof Hałasa
2012-09-06 13:01 ` Alan Cox
2012-09-07 11:07   ` Krzysztof Hałasa
2012-09-07 12:59     ` Krzysztof Halasa
2012-09-07 13:29       ` Alan Cox
2012-09-07 16:14         ` Krzysztof Halasa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).