[Kernel-packages] [Bug 1512815] Re: 14.04: read() from pty doesn't finish.

2015-11-03 Thread Eric Desrochers
This is a reproducer for the stall problem in drivers/tty/n_tty.c

To reproduce the problem, save the program below as pty.c, compile it,
and run it in parallel.

# cc -o pty pty.c
# for i in {1..16}; do ./pty& done; wait
The problem can be reproduced on a multi-socket server with recent CPUs.
The program always stalled during the first run when I used a server
with the following CPU.
  Intel(R) Xeon(R) CPU E5-2698 v3 @ 2.30GHz
  2-sockets x 16-cores x 2-threads

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1512815

Title:
  14.04: read() from pty doesn't finish.

Status in linux package in Ubuntu:
  New

Bug description:
  It has been brought to my attention

  By the attached test program pty, a pair of process repeats writing
  and reading only '\n' to a master pseudoterminal device (/dev/ptmx)
  and a slave pseudoterminal device (/dev/pts/N) each. When we carry out
  the following 30 pairs 10,000 times, in a pair each process doesn't
  finish reading.

  $ pty 30
  The following message will be usually indicated immediately.
  #name copy num/sec usec/num
  pty_switch 30 1541842 0.648575

  When a message wasn't indicated any more, we got the attached dump file. 
  A kernel was 3.13.0-45.74. 
  A system was Ubuntu 14.04 LTS.

  The same problem occurred in case of 3.13.0-55.92 kernel and the following 
kernel have been tested as well:
  2.6.32, 3.10: not reproduces.
  3.19, 4.0.0, 4.1.3: reproduces.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1512815/+subscriptions

-- 
Mailing list: https://launchpad.net/~kernel-packages
Post to : kernel-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kernel-packages
More help   : https://help.launchpad.net/ListHelp


[Kernel-packages] [Bug 1512815] Re: 14.04: read() from pty doesn't finish.

2015-11-03 Thread Eric Desrochers
LKML reference: 
https://lkml.org/lkml/2015/9/28/849

There is a fix applied upstream starting at v4.3-rc5

---
commit e81107d4c6bd098878af9796b24edc8d4a9524fd
Author: Kosuke Tatsukawa 
Date:   Fri Oct 2 08:27:05 2015 +

tty: fix stall caused by missing memory barrier in drivers/tty/n_tty.c
---

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1512815

Title:
  14.04: read() from pty doesn't finish.

Status in linux package in Ubuntu:
  New

Bug description:
  It has been brought to my attention

  By the attached test program pty, a pair of process repeats writing
  and reading only '\n' to a master pseudoterminal device (/dev/ptmx)
  and a slave pseudoterminal device (/dev/pts/N) each. When we carry out
  the following 30 pairs 10,000 times, in a pair each process doesn't
  finish reading.

  $ pty 30
  The following message will be usually indicated immediately.
  #name copy num/sec usec/num
  pty_switch 30 1541842 0.648575

  When a message wasn't indicated any more, we got the attached dump file. 
  A kernel was 3.13.0-45.74. 
  A system was Ubuntu 14.04 LTS.

  The same problem occurred in case of 3.13.0-55.92 kernel and the following 
kernel have been tested as well:
  2.6.32, 3.10: not reproduces.
  3.19, 4.0.0, 4.1.3: reproduces.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1512815/+subscriptions

-- 
Mailing list: https://launchpad.net/~kernel-packages
Post to : kernel-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kernel-packages
More help   : https://help.launchpad.net/ListHelp


[Kernel-packages] [Bug 1512815] Re: 14.04: read() from pty doesn't finish.

2015-11-03 Thread Eric Desrochers
According to the dump a pair of process PID 7347 and 7348 were still
waiting for read() from /dev/ptmx (struct file 880c65357c00) and
/dev/pts/18 (struct file 880c65357500) respectively .

Normal behavior is as follows;
PID 7347: read(/dev/ptmx) -> write(/dev/ptmx),
PID 7348: write(/dev/pts/18) -> read(/dev/pts/18).

In the dump, PID 7348 finished writing to /dev/pts/18, and was waiting
for completion of reading, while PID 7347 continued waiting for reading
/dev/ptmx.

Though data has already arrived at /dev/ptmx, PID 7347 doesn't seem to
have been woken up while being linked to the queue of the data to be
read at tty_struct 0x88085438ac00.

- PID: 7347 TASK: 880853111800 CPU: 15 COMMAND: "pty"
#0 [88084477dc90] __schedule at 81724e19
#1 [88084477dcf8] schedule at 817252d9
#2 [88084477dd08] schedule_timeout at 81724529
#3 [88084477ddb8] n_tty_read at 8144f6a4
#4 [88084477dec0] tty_read at 8144a94d
#5 [88084477df08] vfs_read at 811bda65
#6 [88084477df40] sys_read at 811be579
#7 [88084477df80] system_call_fastpath at 8173196d
RIP: 7fb735a52290 RSP: 7fff290b4ee8 RFLAGS: 00010212
RAX:  RBX: 8173196d RCX: 10a8b550
RDX: 0001 RSI: 7fff290b51af RDI: 0023
RBP: 7fff290b51b0 R8: 7fff290b51c0 R9: 7fff290b5128
R10: 7fff290b4f60 R11: 0246 R12: 7fff290b53d0
R13: 003b R14: 0020 R15: 0010
ORIG_RAX:  CS: 0033 SS: 002b

#5 [88084477df08] vfs_read at 811bda65
88084477df10: 880c65357c00 7fff290b51af
88084477df20: 0001 
88084477df30: 001e 88084477df78
88084477df40: 811be579

- PID: 7348 TASK: 88084354c800 CPU: 4 COMMAND: "pty"
#0 [880844631c90] __schedule at 81724e19
#1 [880844631cf8] schedule at 817252d9
#2 [880844631d08] schedule_timeout at 81724529
#3 [880844631db8] n_tty_read at 8144f6a4
#4 [880844631ec0] tty_read at 8144a94d
#5 [880844631f08] vfs_read at 811bda65
#6 [880844631f40] sys_read at 811be579
#7 [880844631f80] system_call_fastpath at 8173196d
RIP: 7fb735a52290 RSP: 7fff290b4ee8 RFLAGS: 00010206
RAX:  RBX: 8173196d RCX: 7c9d4d40
RDX: 0001 RSI: 7fff290b51af RDI: 0024
RBP: 7fff290b51b0 R8: 7fff290b51c0 R9: 7fff290b5128
R10: 7fff290b4f60 R11: 0246 R12: 7fff290b53d0
R13: 003b R14: 0021 R15: 0010
ORIG_RAX:  CS: 0033 SS: 002b

#5 [880844631f08] vfs_read at 811bda65
880844631f10: 880c65357500 7fff290b51af
880844631f20: 0001 
880844631f30: 001e 880844631f78
880844631f40: 811be579

- Files opened by PID 7347 and 7348:

FD FILE DENTRY INODE TYPE PATH tty_struct n_tty_data


35 880c65357c00 88085f5dbc80 880c674e5fd8 CHR /dev/ptmx 
0x88085438ac00 0xc9001edfb000
36 880c65357500 8808460cb8c0 8808460d36c0 CHR /dev/pts/18 
0x88085438a800 0xc9001edff000

# struct file->private_data(struct tty_file_private)
# struct tty_file_private->tty(struct tty_struct)
# struct tty_struct->disc_data (struct n_tty_data)

- About FD 35 (struct file 880c65357c00)

crash> struct tty_struct 0x88085438ac00
:
read_wait = {
lock = {
{
rlock = {
raw_lock = {
{
head_tail = 0x3e363e36,
tickets = {
head = 0x3e36,
tail = 0x3e36
}
}
}
}
}
},
task_list = {
next = 0x88084477de80,
prev = 0x88084477de80
}
},

crash> eval 0x88084477de80 - 0x18
hexadecimal: 88084477de68

crash> struct wait_queue_t 88084477de68
struct wait_queue_t {
flags = 0,
private = 0x880853111800, <== *
func = 0x8109a9b0 ,
task_list = {
next = 0x88085438ae30,
prev = 0x88085438ae30
}
}

A task_struct of PID 7347 is linked to a read_wait queue.

crash> struct n_tty_data 0xc9001edfb000
struct n_tty_data {
read_head = 2795, <== *


raw = 1 '\001',
real_raw = 1 '\001',
icanon = 0 '\000',
push = 0 '\000',
read_tail = 2794, <== *
}

read_head - read_tail = 1 1 byte data hasn't be read.

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1512815

Title:
  14.04: read() from pty doesn't finish.

Status in linux package in Ubuntu:
  New

Bug description:
  It has been brought to my attention

  By the attached test program pty, a pair of process repeats writing
  and reading only '\n' to a master pseudoterminal device (/dev/ptmx)
  and a slave pseudoterminal device (/dev/pts/N) each. When we carry out
  the following 30 pairs 10,000 times, in a pair each process doesn't
  finish reading.

  $ pty 30
  The following message