Skip to contentSkip to conversation

possible spinlock/esp bug in 2.6.16-rc4

DISCUSSION Jason Wever 2 participants 8 messages Feb 19, 2006 – Feb 27, 2006

lore
Share & tools
lore
#0 lore raw

Hi All,

Getting the below on an Ultra 1 when booting 2.6.16-rc4. Any ideas? This box works fine using 2.4 kernels, and has worked before in 2.6 (though it is susceptible to what appear to be the same the I/O lockup issues on the Ultra 2s).

Allocated 8 Megs of memory at 0x40000000 for kernel Loaded kernel version 2.6.16

Remapping the kernel... done.
Registering callbacks... done.
Booting Linux...
PROMLIB: Sun IEEE Boot Prom 3.35.0 2004/04/19 12:15
Linux version 2.6.16-rc4 (root@saratoga) (gcc version 3.4.5 (Gentoo Linux 3.4.5)) #1 Sat Feb 18 21:18:33 MST 2006 ARCH: SUN4U Ethernet address: 08:00:20:80:5c:3e
Allocated 466944 bytes for kernel page tables.
CPU[0]: Caches D[sz(16384):line_sz(32)] I[sz(16384):line_sz(32)] E[sz(524288):line_sz(64)] Built 1 zonelists
Kernel command line: root=/dev/sda1
PID hash table entries: 2048 (order: 11, 65536 bytes)
Console: colour dummy device 80x25
Dentry cache hash table entries: 65536 (order: 6, 524288 bytes) Inode-cache hash table entries: 32768 (order: 5, 262144 bytes)
Memory: 445768k available (1968k kernel code, 752k data, 104k init) [fffff80000000000,000000003ff4a000] Mount-cache hash table entries: 512
NET: Registered protocol family 16
SCSI subsystem initialized
SYSIO: UPA portID 1f, at 000001fe00000000
sbus0: Clock 25.0 MHz
dma0: Revision 2
dma1: Revision 2
dma2: HME DVMA gate array
Total HugeTLB memory allocated, 0
Initializing Cryptographic API
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
Console: switching to colour frame buffer device 144x56
cg6: CGsix [GX+ 68020] at 1ff:20000000
zs2 at 0x000001fff1000004 (irq = 12,7e8) is a SunZilog
zs3 at 0x000001fff1000000 (irq = 12,7e8) is a SunZilog
Console: ttyS0 (SunZilog zs0)
ttyS0 at MMIO 0x0 (irq = 7194944) is a SunZilog
ttyS1 at MMIO 0x0 (irq = 7194944) is a SunZilog
loop: loaded (max 8 devices)
sunhme.c:v2.02 8/24/03 David S. Miller ([email protected])
eth0: HAPPY MEAL (SBUS) 10/100baseT Ethernet 08:00:20:80:5c:3e
esp0: IRQ 4,7e0 SCSI ID 7 Clk 40MHz CCYC=25000 CCF=8 TOut 167 NCR53C9XF(espfast) esp1: IRQ 7,7c3 SCSI ID 7 Clk 40MHz CCYC=25000 CCF=8 TOut 167 NCR53C9XF(espfast) ESP: Total of 2 ESP hosts found, 2 actually in use. scsi0 : Sparc ESP100A-FAST

  Vendor: SEAGATE   Model: ST39102LCSUN9.0G  Rev: 0828
  Type:   Direct-Access                      ANSI SCSI revision: 02
  Vendor: TOSHIBA   Model: XM-5401TASUN4XCD  Rev: 1036
  Type:   CD-ROM                             ANSI SCSI revision: 02

scsi1 : Sparc ESP366-HME
esp0: target 1 [period 100ns offset 15 10.00MHz FAST SCSI-II] SCSI device sda: 17689267 512-byte hdwr sectors (9057 MB)
sda: Write Protect is off
SCSI device sda: drive cache: write back w/ FUA
SCSI device sda: 17689267 512-byte hdwr sectors (9057 MB)
sda: Write Protect is off
SCSI device sda: drive cache: write back w/ FUA
sda: sda1 sda2 sda3
sd 0:0:1:0: Attached scsi disk sda
esp0: target 6 asynchronous
sr0: scsi-1 drive
Uniform CD-ROM driver Revision: 3.20
sd 0:0:1:0: Attached scsi generic sg0 type 0
sr 0:0:6:0: Attached scsi generic sg1 type 5
rtc_sun_init: Registered Mostek RTC driver.
mice: PS/2 mouse device common for all mice
NET: Registered protocol family 2
IP route cache hash table entries: 4096 (order: 2, 32768 bytes) TCP established hash table entries: 16384 (order: 5, 393216 bytes) TCP bind hash table entries: 16384 (order: 6, 524288 bytes)
TCP: Hash tables configured (established 16384 bind 16384) TCP reno registered
TCP bic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
kjournald starting. Commit interval 5 seconds
EXT3-fs: mounted filesystem with ordered data mode.
VFS: Mounted root (ext3 filesystem) readonly.
input: Sun Mouse as /class/input/input0
INIT: version 2.86 booting
esp0: Aborting command
esp0: dumping state
esp0: dma -- cond_reg<a6400311> addr<c7ffc002>
esp0: SW [sreg<13> sstep<04> ireg<10>]
esp0: HW reread [sreg<97> sstep<cc> ireg<08>]
esp0: current command [tgt<01> lun<00> pphase<STATUS> cphase<STATUS>]
esp0: disconnected
esp0: Aborting command
esp0: dumping state
esp0: dma -- cond_reg<a6400310> addr<c7ffc002>
esp0: SW [sreg<13> sstep<04> ireg<10>]
esp0: HW reread [sreg<17> sstep<cc> ireg<00>]
esp0: current command [tgt<01> lun<00> pphase<UNISSUED> cphase<UNISSUED>] esp0: disconnected
esp0: Resetting scsi bus

BUG: spinlock already unlocked on CPU#0, scsi_eh_0/633
 lock: fffff8003fc3d060, .magic: dead4ead, .owner:

<none>/-1, .owner_cpu: -1 Call Trace:
[000000000051aef4] _raw_spin_unlock+0x50/0xb4 [00000000005ecf00] _spin_unlock_irq+0x10/0x24 [00000000005655dc] esp_reset+0x28/0xc8 [0000000000559828] scsi_try_bus_reset+0x38/0xc8 [000000000055a8f4] scsi_error_handler+0x5ec/0x9bc [000000000044631c] kthread+0xbc/0xf0 [000000000040f7a8] kernel_thread+0x3c/0x54 [000000000044636c] keventd_create_kthread+0x1c/0x6c

Signature · 2 lines
Jason Wever
Gentoo/Sparc Team Co-Lead
#1 lore raw

From: Jason Wever <[email protected]>
Date: Sun, 19 Feb 2006 10:17:01 -0700

Quoted 4 lines

Getting the below on an Ultra 1 when booting 2.6.16-rc4. Any ideas? This box works fine using 2.4 kernels, and has worked before in 2.6 (though it is susceptible to what appear to be the same the I/O lockup issues on the Ultra 2s).

Please do a "git bisect" from the last known working version so we can find out exactly what change caused this regression.

The esp driver hasn't been touched in ages so it's probably a sparc64 or SCSI layer generic change that caused this.

Please get in the habit of using git. Using "git bisect" allows you to determine quickly exactly what patch introduced a regression saving developers and yourself a lot of wasted time analyzing bug reports.

Thanks a lot.

author Acked-by Paul E. McKenney
#2 lore raw
In reply to Jason Wever
Quoted 10 lines · On Sun, 19 Feb 2006 10:21:10 -0800 (PST) "David S. Miller"…

Please do a "git bisect" from the last known working version so we can find out exactly what change caused this regression.

The esp driver hasn't been touched in ages so it's probably a sparc64 or SCSI layer generic change that caused this.

Please get in the habit of using git. Using "git bisect" allows you to determine quickly exactly what patch introduced a regression saving developers and yourself a lot of wasted time analyzing bug reports.

Thanks for the pointer. In using this method to track down the patch, I started getting errors looking like this;

kjournald starting. Commit interval 5 seconds
EXT3-fs: mounted filesystem with ordered data mode.
VFS: Mounted root (ext3 filesystem) readonly.
INIT: version 2.86 booting
Badness in local_bh_enable at kernel/softirq.c:140

Call Trace:
 [0000000000441250] __dequeue_signal+0x50/0xa0
 [0000000000441354] dequeue_signal+0xb4/0xe0
 [0000000000442e48] get_signal_to_deliver+0x28/0x280
 [0000000000424bd8] do_signal32+0x38/0x2c0
 [000000000041b3cc] do_signal+0x4c/0x5e0
 [000000000040547c] __handle_signal+0x10/0x54
 [0000000000045288] 0x45288

Using git bisect, it traces down to the following;

4021cb279a532728c3208a16b9b09b0ca8016850 is first bad commit diff-tree 4021cb279a532728c3208a16b9b09b0ca8016850 (from d5bee775137c56ed993f1b3c9d66c268b3525d7d) Author: Ingo Molnar
<[email protected]> Date: Wed Jan 25 15:23:07 2006 +0100

[PATCH] fix uidhash_lock <-> RCU deadlock

RCU task-struct freeing can call free_uid(), which is taking uidhash_lock - while other users of uidhash_lock are softirq-unsafe.

The fix is to always take the uidhash_spinlock in a softirq-safe
manner.

:040000 040000 98d3bd6cebd288defc2bee44054d252629e6c020
9319c402e05522b655c2445e9f19cf394b006e02 M kernel

This was done against git when 2.6.16-rc4 was the most current and 2.6.14 was the last known good version.

Cheers,

Signature · 2 lines
Jason Wever
Gentoo/Sparc Team Co-Lead
#3 lore raw
In reply to Jason Wever

From: Jason Wever <[email protected]>
Date: Tue, 21 Feb 2006 20:20:57 -0700

Quoted 9 lines
Quoted 6 lines · On Sun, 19 Feb 2006 10:21:10 -0800 (PST) "David S. Miller"…

Please do a "git bisect" from the last known working version so we can find out exactly what change caused this regression.

The esp driver hasn't been touched in ages so it's probably a sparc64 or SCSI layer generic change that caused this.

Quoted 7 lines
Quoted 4 lines

Please get in the habit of using git. Using "git bisect" allows you to determine quickly exactly what patch introduced a regression saving developers and yourself a lot of wasted time analyzing bug reports.

Thanks for the pointer. In using this method to track down the patch, I started getting errors looking like this;

This is not the orignal bug you reported. This is not how you use "git bisect".

Use it to see where the bug you originally reported starts to show up.

Any other bug you trip over meanwhile probably is fixed in a later changeset and is only going to distract from finding the original bug.

I hate to say this Jason, but you're really bad at bug reporting. You never do a thorough job and that's why your sparc64 bug reports either take an enormously long time to resolve or never get resolved at all.

I did the Niagara port in one month because every time I had some weird bug to figure out I got all the necessary information and did all the necessary detective work in order to find the true cause of each and every problem.

Whereas you always send me on wild goose chases with unrelated problems from your original report. This __dequeue_signal local_bh_enable() bug message, totally unrelated to the ESP scsi crash you originally reported, is a good example of this.

I hate to do this, pointing you out like this, but I want you to be able to do good bug reports. Reports which I can solve in an afternoon, which is what is possible if you give me the right information.

#4 lore raw
In reply to Jason Wever
Quoted 14 lines · On Tue, 21 Feb 2006 19:59:50 -0800 (PST) "David S. Miller"…

I hate to say this Jason, but you're really bad at bug reporting. You never do a thorough job and that's why your sparc64 bug reports either take an enormously long time to resolve or never get resolved at all.

I did the Niagara port in one month because every time I had some weird bug to figure out I got all the necessary information and did all the necessary detective work in order to find the true cause of each and every problem.

Whereas you always send me on wild goose chases with unrelated problems from your original report. This __dequeue_signal local_bh_enable() bug message, totally unrelated to the ESP scsi crash you originally reported, is a good example of this.

Quoted 4 lines

I hate to do this, pointing you out like this, but I want you to be able to do good bug reports. Reports which I can solve in an afternoon, which is what is possible if you give me the right information.

Sorry about that :(

Thanks for taking the time to mention this though :)

Will post an update on the original bug when I have something.

Cheers,

Signature · 2 lines
Jason Wever
Gentoo/Sparc Team Co-Lead
#5 lore raw
In reply to Jason Wever
Quoted 1 line · On Tue, 21 Feb 2006 21:25:04 -0700 Jason Wever <[email protected]> wrote:

Will post an update on the original bug when I have something.

Have a bit more on the problem. Hopefully this time its actually useful :)

The short of what I found is to do one of the following:
- Use gcc-3.3.6 when the "Optimize for size" option is enabled
- Do not enable the "Optimize for size" option when using gcc-3.4.5

The long of it:

Tested Christoph's patch against the same tree on the Ultra 1 as the original bug was posted against, which is running gcc-3.4.5 as a kernel compiler. When I did this and rebooted the box, basically all that changed was that everything from the "BUG: spinlock already unlocked on CPU#0, scsi_eh_0/633" line on down no longer showed up (actual text of error with Christoph's patch in [1]).

At this point, before I went back to the "git bisect" method, I decided to try compiling the kernel with different compilers to see if that was the issue (since that's come up before). Low and behold the kernel build with gcc-3.3.6 ran fine, but the kernel built with gcc-3.4.5 did not.

As my previous git bisect attempt had been done via building kernels on a different box that contained gcc-3.3.6, I now ran git bisect on a box with gcc-3.4.5. What it appears to have boiled down to after running git bisect and making sure I'm not running off into left field with something else is the "[SPARC64]: Stop putting -finline-limit=XXX into CFLAGS" patch from 20 Dec 2005. [2].

To help confirm that this is either the issue or an issue, I rebuilt the kernel from the same tree that caused the initial problem with gcc-3.4.5 but this time with "Optimize for size" turned off. Now the kernel boots up as expected and the machine is happily updating its portage tree as I type.

I'd be interested to see if anyone running gcc-3.4.5 on debian has similar issues on an Ultra 1. The model in question is an "Ultra 1 Server" running at 143 MHz on OBP 3,35. Also be interested in hearing how people using gcc-4.0.x make out as well (didn't have access to a gcc-4.0.x compiler when doing this testing).

I still have the git tree at the point where I found the failure so if you need me to pull anything from that state, just let me know.

[1] -
INIT: version 2.86 booting

Gentoo Linux; http://www.gentoo.org/
Copyright 1999-2006 Gentoo Foundation; Distributed under the GPLv2

* Mounting proc
at /proc ... [ ok ]
* Mounting sysfs
at /sys ... [ ok ]
* Mounting /dev for
udev ... [ ok ] esp0:
Aborting command esp0: dumping state
esp0: dma -- cond_reg<a6400311> addr<c7ffc002>
esp0: SW [sreg<13> sstep<04> ireg<10>]
esp0: HW reread [sreg<97> sstep<cc> ireg<08>]
esp0: current command [tgt<01> lun<00> pphase<STATUS> cphase<STATUS>]
esp0: disconnected
esp0: Aborting command
esp0: dumping state
esp0: dma -- cond_reg<a6400310> addr<c7ffc002>
esp0: SW [sreg<13> sstep<04> ireg<10>]
esp0: HW reread [sreg<17> sstep<cc> ireg<00>]
esp0: current command [tgt<01> lun<00> pphase<UNISSUED> cphase<UNISSUED>] esp0: disconnected
esp0: Resetting scsi bus

[2] -

Author: David S. Miller <[email protected]>
Date:   Tue Dec 20 14:53:05 2005 -0800

[SPARC64]: Stop putting -finline-limit=XXX into CFLAGS

It was a stupid workaround for the "static inline" vs. "extern inline" issues of long ago, and it is what causes schedule() to be inlined like crazy into kernel/sched.c when -Os is specified.

MIPS and S390 should probably do the same.

Now CC_OPTIMIZE_FOR_SIZE can be safely used on sparc64 once more.

:040000 040000 daaaee03ba6f89a05f7f9d52ec8c63a0deaeba52
51ff3f171e37deedafbdf2adac5984dd1c47317b M arch :040000 040000
9725b0974ac6bfc1badb97cea8ed92985829a329
c406cf9af429c152e49458b4b7005de6942d9809 M init

Cheers,

Signature · 2 lines
Jason Wever
Gentoo/Sparc Team Co-Lead
#6 lore raw
In reply to Jason Wever

From: Jason Wever <[email protected]>
Date: Sun, 26 Feb 2006 17:41:19 -0700

Quoted 6 lines

As my previous git bisect attempt had been done via building kernels on a different box that contained gcc-3.3.6, I now ran git bisect on a box with gcc-3.4.5. What it appears to have boiled down to after running git bisect and making sure I'm not running off into left field with something else is the "[SPARC64]: Stop putting -finline-limit=XXX into CFLAGS" patch from 20 Dec 2005. [2].

This change you mention as [2] is specifically needed to "fix" the build with -Os specified. Otherwise gcc inlines the schedule() function in kernel/sched.c into other functions and all hell breaks loose.

The ESP driver has an incredibly deep function call chain so this may be playing into it.

So what _exact_ GIT tree did you first test Christophe's ESP spinlock fix with, the one you refer to as "the same tree on the Ultra 1 as the original bug was posted against"? Please always list such details and do not refer to specific kernel trees in such a vague manner.

If have to admit that I do all of my kernel work with gcc-4.0.x these days as that has become the default compiler on all the Debian derive dists.

#7 lore raw
In reply to Jason Wever
Quoted 4 lines · On Sun, 26 Feb 2006 16:50:20 -0800 (PST) "David S. Miller"…

So what _exact_ GIT tree did you first test Christophe's ESP spinlock fix with, the one you refer to as "the same tree on the Ultra 1 as the original bug was posted against"? Please always list such details and do not refer to specific kernel trees in such a vague manner.

Sorry about that.

The tree (non-git) that I originally ran into this with and tested Christoph's patch against was 2.6.16-rc4 as a regular joe user would download it from kernel.org (grab linux-2.6.15.tar.bz2 tarball and patch-2.6.16-rc4.bz2, unpack, apply 2.6.16-rc4 patch, apply Christoph's patch).

When I did the "git bisect" method this time, I cloned the latest tree (2.6.16-rc4-git7 I believe) so as to already have Christoph's patch applied (and not taint the cloned tree with local modifications).

Quoted 3 lines

If have to admit that I do all of my kernel work with gcc-4.0.x these days as that has become the default compiler on all the Debian derive dists.

I'll try to setup a chroot for gcc-4.0.x to test this out and see if it behaves any differently.

Cheers,

Signature · 2 lines
Jason Wever
Gentoo/Sparc Team Co-Lead