possible deadlock in pipes

Olaf Hering olh at suse.de
Thu Aug 21 07:41:14 EST 2003


I see random dead locks in pipe_wait() on power4 (p630, p650).
I dont have a simple testcase to trigger it. The userland code its
either 32bit or 64bit, new or (very) old.
It happens with 2.4.19 and with 2.4.21.

This patch seems to fix it, maybe it is only a workaround. Is the 2.4
pipe code supposed to work on power4 (enough sync accross cpus etc.)?


diff -p -purN linux-2.4.21/arch/ppc64/kernel/semaphore.c linux-2.4.21.ppc64/arch/ppc64/kernel/semaphore.c
--- linux-2.4.21/arch/ppc64/kernel/semaphore.c	2002-08-03 02:39:43.000000000 +0200
+++ linux-2.4.21.ppc64/arch/ppc64/kernel/semaphore.c	2003-08-09 19:11:32.000000000 +0200
@@ -34,6 +34,11 @@ static inline int __sem_update_count(str
 {
 	int old_count, tmp;

+	/* make the update visible to others
+	 * should fix races in pipes
+	 */
+	wmb();
+
 	__asm__ __volatile__("\n"
 "1:	lwarx	%0,0,%3\n"
 "	srawi	%1,%0,31\n"


 On Tue, Aug 05, Olaf Hering wrote:

> The find, sed and rpm2cpio hangs since a hour or two.

No idea if I got that right, sem.count is always 1, the inodes differ.

************************************************************************
Stack traceback for pid 11015
0xc000000073324000 00011015 00010992  0  003  stop  0xc0000000733245d8 find
          SP(esp)            PC(eip)      Function(args)
0xc000000073327810  0x0000000000000000  NO_SYMBOL
0xc0000000733278a0  0xc00000000005bdd4  .do_schedule +0x258
0xc000000073327950  0xc00000000001a624  .__down +0xe8
0xc000000073327a20  0xc0000000000bb148  .pipe_wait +0x104
0xc000000073327b00  0xc0000000000bbf50  .pipe_write +0x4a0
0xc000000073327bc0  0xc0000000000a8158  .sys_write +0xe4
0xc000000073327c60  0xc0000000000101a8  .ret_from_syscall_1
  [exception: c00:(System Call) regs 0xc000000073327cd0] nip:[0xe014a9ac] gpr[1]:[0x7fffddc0]
    kdb: Not a kernel-space address 0x1ff7fffddd0

[0]kdb> mds c000000073327950
0xc000000073327950 c000000073327a20   #...s2z
0xc000000073327958 c000000003f68000   #....#..
0xc000000073327960 c00000000001a624 .__down+0xe8
                       kernel .text 0xc000000000000000 0xc00000000001a53c 0xc00000000001a670
0xc000000073327968 c000000073327970   #...s2yp
0xc000000073327970 c000000073327a20   #...s2z
0xc000000073327978 0000007fe0020000   ....#...
0xc000000073327980 c00000000005bde0 .do_schedule+0x264
                       kernel .text 0xc000000000000000 0xc00000000005bb7c 0xc00000000005bfa8
0xc000000073327988 0000000000001000   ........
0xc000000073327990 0000000000001000   ........
0xc000000073327998 0000000000001000   ........
0xc0000000733279a0 c0000001afe7eb00   #...###.
0xc0000000733279a8 c0000001afe7ebc8   #...####
0xc0000000733279b0 c000000073327a20   #...s2z
0xc0000000733279b8 c000000183ff16a8   #....#.#
0xc0000000733279c0 0000000100000000   ........
0xc0000000733279c8 c000000073324000   #...s2 at .
0xc0000000733279d0 c0000001afe7ebd8   #...####
0xc0000000733279d8 c0000001afe7ebd8   #...####
0xc0000000733279e0 0000000000000000   ........
0xc0000000733279e8 c000000000703000 irq_dir+0x128
                       kernel .bss 0xc000000000701000 0xc000000000702ed8 0xc000000000703ed8
0xc0000000733279f0 c000000073327a80   #...s2z.
0xc0000000733279f8 0000000000001000   ........
0xc000000073327a00 0000000000001000   ........
0xc000000073327a08 0000000000001000   ........
0xc000000073327a10 c0000001afe7eb00   #...###.
0xc000000073327a18 c0000001afe7ebc8   #...####

struct inode
[0]kdb> mds c0000001afe7eb00
0xc0000001afe7eb00 c0000001afe7eb00   #...###.
0xc0000001afe7eb08 c0000001afe7eb00   #...###.
0xc0000001afe7eb10 c0000001965f1510   #...._..
0xc0000001afe7eb18 c0000001b7ca4c10   #...##L.
0xc0000001afe7eb20 c0000000017bac40   #....{#@
0xc0000001afe7eb28 c0000000017bac40   #....{#@
0xc0000001afe7eb30 c0000001afe7eb30   #...###0
0xc0000001afe7eb38 c0000001afe7eb30   #...###0
0xc0000001afe7eb40 c0000001afe7eb40   #...###@
0xc0000001afe7eb48 c0000001afe7eb40   #...###@
0xc0000001afe7eb50 0000000000fc5c17   .....#\.
0xc0000001afe7eb58 0000000100060000   ........
0xc0000001afe7eb60 0000118000000000   ........
0xc0000001afe7eb68 0000000000000001   ........
0xc0000001afe7eb70 0000000000000000   ........
0xc0000001afe7eb78 0000000000000000   ........
0xc0000001afe7eb80 0000000000000000   ........
0xc0000001afe7eb88 000000003f2fd06e   ....?/#n
0xc0000001afe7eb90 000000003f2fb1de   ....?/##
0xc0000001afe7eb98 000000003f2fb1de   ....?/##
0xc0000001afe7eba0 0000000a00000000   ........
0xc0000001afe7eba8 0000000000001000   ........
0xc0000001afe7ebb0 0000000000000000   ........
0xc0000001afe7ebb8 0000000008708c5e   .....p.^
0xc0000001afe7ebc0 0000000000000000   ........
0xc0000001afe7ebc8 0000000100000000   ........  .sem
0xc0000001afe7ebd0 0000000000000000   ........
0xc0000001afe7ebd8 c0000000733279d0   #...s2y#
0xc0000001afe7ebe0 c0000000733279d0   #...s2y#
0xc0000001afe7ebe8 0000000000000000   ........
0xc0000001afe7ebf0 0000000000000000   ........
0xc0000001afe7ebf8 c0000001afe7ebf8   #...####
0xc0000001afe7ec00 c0000001afe7ebf8   #...####
0xc0000001afe7ec08 0000000100000000   ........
0xc0000001afe7ec10 0000000000000000   ........
0xc0000001afe7ec18 c0000001afe7ec18   #...###.
0xc0000001afe7ec20 c0000001afe7ec18   #...###.
0xc0000001afe7ec28 c000000000823548 empty_iops.2
                       kernel .bss 0xc000000000701000 0xc000000000823548 0xc0000000008235e8
0xc0000001afe7ec30 c0000000004359f0 rdwr_pipe_fops
                       kernel .data 0xc0000000003d7000 0xc0000000004359f0 0xc000000000435ab0
0xc0000001afe7ec38 c0000003ffcb4800   #...##H.

************************************************************************
Stack traceback for pid 2628
0xc00000017d6bc000 00002628 00000894  0  002  stop  0xc00000017d6bc5d8 sed
          SP(esp)            PC(eip)      Function(args)
0xc00000017d6bf810  0x0000000000000000  NO_SYMBOL
0xc00000017d6bf8a0  0xc00000000005bdd4  .do_schedule +0x258
0xc00000017d6bf950  0xc00000000001a624  .__down +0xe8
0xc00000017d6bfa20  0xc0000000000bb148  .pipe_wait +0x104
0xc00000017d6bfb00  0xc0000000000bbf50  .pipe_write +0x4a0
0xc00000017d6bfbc0  0xc0000000000a8158  .sys_write +0xe4
0xc00000017d6bfc60  0xc0000000000101a8  .ret_from_syscall_1
  [exception: c00:(System Call) regs 0xc00000017d6bfcd0] nip:[0xe014a9ac] gpr[1]:[0x7fffd730]
    kdb: Not a kernel-space address 0x1ff7fffd740

[0]kdb> mds c00000017d6bf950
0xc00000017d6bf950 c00000017d6bfa20   #...}k#
0xc00000017d6bf958 c000000003f6c000   #....##.
0xc00000017d6bf960 c00000000001a624 .__down+0xe8
                       kernel .text 0xc000000000000000 0xc00000000001a53c 0xc00000000001a670
0xc00000017d6bf968 c00000017d6bf970   #...}k#p
0xc00000017d6bf970 c00000017d6bfa20   #...}k#
0xc00000017d6bf978 0000007fe0021000   ....#...
0xc00000017d6bf980 c00000000005bde0 .do_schedule+0x264
                       kernel .text 0xc000000000000000 0xc00000000005bb7c 0xc00000000005bfa8
0xc00000017d6bf988 0000000000001000   ........
0xc00000017d6bf990 0000000000001000   ........
0xc00000017d6bf998 0000000000001000   ........
0xc00000017d6bf9a0 c0000001817f0180   #.......
0xc00000017d6bf9a8 c0000001817f0248   #......H
0xc00000017d6bf9b0 c00000017d6bfa20   #...}k#
0xc00000017d6bf9b8 c000000000703000 irq_dir+0x128
                       kernel .bss 0xc000000000701000 0xc000000000702ed8 0xc000000000703ed8
0xc00000017d6bf9c0 0000000100000000   ........
0xc00000017d6bf9c8 c00000017d6bc000   #...}k#.
0xc00000017d6bf9d0 c0000001817f0258   #......X
0xc00000017d6bf9d8 c0000001817f0258   #......X
0xc00000017d6bf9e0 0000000000000000   ........
0xc00000017d6bf9e8 c00000008cd21790   #....#..
0xc00000017d6bf9f0 c00000017d6bfa80   #...}k#.
0xc00000017d6bf9f8 0000000000001000   ........
0xc00000017d6bfa00 0000000000001000   ........
0xc00000017d6bfa08 0000000000001000   ........
0xc00000017d6bfa10 c0000001817f0180   #.......
0xc00000017d6bfa18 c0000001817f0248   #......H

struct inode

[0]kdb> mds c0000001817f0180
0xc0000001817f0180 c0000001817f0180   #.......
0xc0000001817f0188 c0000001817f0180   #.......
0xc0000001817f0190 c0000001817f0510   #.......
0xc0000001817f0198 c00000017d36c490   #...}6#.
0xc0000001817f01a0 c00000017ff8c2a0   #....# 
0xc0000001817f01a8 c00000017ff8c2a0   #....# 
0xc0000001817f01b0 c0000001817f01b0   #......#
0xc0000001817f01b8 c0000001817f01b0   #......#
0xc0000001817f01c0 c0000001817f01c0   #......#
0xc0000001817f01c8 c0000001817f01c0   #......#
0xc0000001817f01d0 000000000059cc18   .....Y#.
0xc0000001817f01d8 0000000100060000   ........
0xc0000001817f01e0 0000118000000000   ........
0xc0000001817f01e8 0000000000000001   ........
0xc0000001817f01f0 0000000000000000   ........
0xc0000001817f01f8 0000000000000000   ........
0xc0000001817f0200 0000000000000000   ........
0xc0000001817f0208 000000003f2edeab   ....?.#
0xc0000001817f0210 000000003f2edea9   ....?.#
0xc0000001817f0218 000000003f2edea9   ....?.#
0xc0000001817f0220 0000000a00000000   ........
0xc0000001817f0228 0000000000001000   ........
0xc0000001817f0230 0000000000000000   ........
0xc0000001817f0238 0000000000000000   ........
0xc0000001817f0240 0000000000000000   ........
0xc0000001817f0248 0000000100000000   ........  .sem
0xc0000001817f0250 0000000000000000   ........
0xc0000001817f0258 c00000017d6bf9d0   #...}k##
0xc0000001817f0260 c00000017d6bf9d0   #...}k##
0xc0000001817f0268 0000000000000000   ........
0xc0000001817f0270 0000000000000000   ........
0xc0000001817f0278 c0000001817f0278   #......x
0xc0000001817f0280 c0000001817f0278   #......x
0xc0000001817f0288 0000000100000000   ........
0xc0000001817f0290 0000000000000000   ........
0xc0000001817f0298 c0000001817f0298   #.......
0xc0000001817f02a0 c0000001817f0298   #.......
0xc0000001817f02a8 c000000000823548 empty_iops.2
                       kernel .bss 0xc000000000701000 0xc000000000823548 0xc0000000008235e8
0xc0000001817f02b0 c0000000004359f0 rdwr_pipe_fops
                       kernel .data 0xc0000000003d7000 0xc0000000004359f0 0xc000000000435ab0
0xc0000001817f02b8 c0000003ffcb4800   #...##H.




************************************************************************
Stack traceback for pid 22801
0xc0000000f8350000 00022801 00022797  0  002  stop  0xc0000000f83505d8 rpm2cpio
          SP(esp)            PC(eip)      Function(args)
0xc0000000f8353810  0x0000000000000000  NO_SYMBOL
0xc0000000f83538a0  0xc00000000005bdd4  .do_schedule +0x258
0xc0000000f8353950  0xc00000000001a624  .__down +0xe8
0xc0000000f8353a20  0xc0000000000bb148  .pipe_wait +0x104
0xc0000000f8353b00  0xc0000000000bbe80  .pipe_write +0x3d0
0xc0000000f8353bc0  0xc0000000000a8158  .sys_write +0xe4
0xc0000000f8353c60  0xc0000000000101a8  .ret_from_syscall_1
  [exception: c00:(System Call) regs 0xc0000000f8353cd0] nip:[0x1007f7ac] gpr[1]:[0xffffa888]
    kdb: Not a kernel-space address 0xffffa898

[0]kdb> mds c0000000f8353950
0xc0000000f8353950 c0000000f8353a20   #...#5:
0xc0000000f8353958 c000000003f6c000   #....##.
0xc0000000f8353960 c00000000001a624 .__down+0xe8
                       kernel .text 0xc000000000000000 0xc00000000001a53c 0xc00000000001a670
0xc0000000f8353968 c0000000f8353970   #...#59p
0xc0000000f8353970 c0000000f8353a20   #...#5:
0xc0000000f8353978 c0000000f8353980   #...#59.
0xc0000000f8353980 c00000000005bde0 .do_schedule+0x264
                       kernel .text 0xc000000000000000 0xc00000000005bb7c 0xc00000000005bfa8
0xc0000000f8353988 0000000000002000   ...... .
0xc0000000f8353990 c00000000005a7c8 .try_to_wake_up+0x2b4
                       kernel .text 0xc000000000000000 0xc00000000005a514 0xc00000000005a88c
0xc0000000f8353998 0000000000000000   ........
0xc0000000f83539a0 c0000000000bbcd4 .pipe_write+0x224
                       kernel .text 0xc000000000000000 0xc0000000000bbab0 0xc0000000000bbfe0
0xc0000000f83539a8 0000000020000000   .... ...
0xc0000000f83539b0 0000000024044480   ....$.D.
0xc0000000f83539b8 0000000000000000   ........
0xc0000000f83539c0 0000000100000000   ........
0xc0000000f83539c8 c0000000f8350000   #...#5..
0xc0000000f83539d0 c0000000962915d8   #....).#
0xc0000000f83539d8 c0000000962915d8   #....).#
0xc0000000f83539e0 0000000000000000   ........
0xc0000000f83539e8 c0000000265ca8c0   #...&\##
0xc0000000f83539f0 9000000000001032   .......2
0xc0000000f83539f8 0000000000002000   ...... .
0xc0000000f8353a00 0000000000000800   ........
0xc0000000f8353a08 0000000000000800   ........
0xc0000000f8353a10 c000000096291500   #....)..
0xc0000000f8353a18 c0000000962915c8   #....).#

struct inode

[0]kdb> mds c000000096291500
0xc000000096291500 c000000096291500   #....)..
0xc000000096291508 c000000096291500   #....)..
0xc000000096291510 c00000004d1f1890   #...M...
0xc000000096291518 c0000000244e2490   #...$N$.
0xc000000096291520 c000000091e6b7e0   #....##
0xc000000096291528 c000000091e6b7e0   #....##
0xc000000096291530 c000000096291530   #....).0
0xc000000096291538 c000000096291530   #....).0
0xc000000096291540 c000000096291540   #....).@
0xc000000096291548 c000000096291540   #....).@
0xc000000096291550 000000000023310c   .....#1.
0xc000000096291558 0000000100060000   ........
0xc000000096291560 0000118000000000   ........
0xc000000096291568 0000000000000001   ........
0xc000000096291570 0000000000000000   ........
0xc000000096291578 0000000000000000   ........
0xc000000096291580 0000000000000000   ........
0xc000000096291588 000000003f2eab79   ....?.#y
0xc000000096291590 000000003f2eab79   ....?.#y
0xc000000096291598 000000003f2eab79   ....?.#y
0xc0000000962915a0 0000000a00000000   ........
0xc0000000962915a8 0000000000001000   ........
0xc0000000962915b0 0000000000000000   ........
0xc0000000962915b8 00000000013d4ec2   .....=N#
0xc0000000962915c0 0000000000000000   ........
0xc0000000962915c8 0000000100000000   ........  .sem
0xc0000000962915d0 0000000000000000   ........
0xc0000000962915d8 c0000000f83539d0   #...#59#
0xc0000000962915e0 c0000000f83539d0   #...#59#
0xc0000000962915e8 0000000000000000   ........
0xc0000000962915f0 0000000000000000   ........
0xc0000000962915f8 c0000000962915f8   #....).#
0xc000000096291600 c0000000962915f8   #....).#
0xc000000096291608 0000000100000000   ........
0xc000000096291610 0000000000000000   ........
0xc000000096291618 c000000096291618   #....)..
0xc000000096291620 c000000096291618   #....)..
0xc000000096291628 c000000000823548 empty_iops.2
                       kernel .bss 0xc000000000701000 0xc000000000823548 0xc0000000008235e8
0xc000000096291630 c0000000004359f0 rdwr_pipe_fops
                       kernel .data 0xc0000000003d7000 0xc0000000004359f0 0xc000000000435ab0
0xc000000096291638 c0000003ffcb4800   #...##H.
0xc000000096291640 0000000000000000   ........
0xc000000096291648 c000000096291648   #....).H
0xc000000096291650 c000000096291648   #....).H
0xc000000096291658 0000000000000000   ........
0xc000000096291660 c000000096291668   #....).h
0xc000000096291668 c000000096291668   #....).h
0xc000000096291670 c000000096291668   #....).h
0xc000000096291678 c000000096291678   #....).x


--
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG

** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc64-dev mailing list