Bug 90601 - panic on write to 3ware raid array
Summary: panic on write to 3ware raid array
Status: NEW
Alias: None
Product: IO/Storage
Classification: Unclassified
Component: SCSI (show other bugs)
Hardware: x86-64 Linux
: P1 normal
Assignee: linux-scsi@vger.kernel.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-02 14:31 UTC by merlin
Modified: 2016-02-16 22:07 UTC (History)
6 users (show)

See Also:
Kernel Version: 3.16 and above
Subsystem:
Regression: No
Bisected commit-id:


Attachments
panic log (3.77 KB, text/plain)
2015-01-02 14:31 UTC, merlin
Details
tw_cli raid config (5.37 KB, text/plain)
2015-01-02 14:32 UTC, merlin
Details
syslog before crash (117.71 KB, text/x-log)
2015-01-06 15:29 UTC, merlin
Details
backtrace with CONFIG_DMA_API_DEBUG enabled (3.28 KB, text/plain)
2015-01-06 15:30 UTC, merlin
Details
kernel config (66.25 KB, application/octet-stream)
2015-01-06 15:48 UTC, merlin
Details
Hardware of a second machine with the issue (84.13 KB, text/plain)
2015-02-13 16:20 UTC, Alex Elsayed
Details
panic_screenshot (473.47 KB, image/jpeg)
2015-04-13 16:16 UTC, merlin
Details
dmesg (72.04 KB, application/octet-stream)
2015-04-16 11:21 UTC, merlin
Details
crash-backtrace (3.58 KB, text/plain)
2015-04-16 11:25 UTC, merlin
Details
dmesg for the commit that git bisect landed on (2.98 KB, text/plain)
2015-04-19 03:59 UTC, Justin Keogh
Details
git bisect log between 3.14.33 and 3.18.7 (3.12 KB, text/plain)
2015-04-19 04:00 UTC, Justin Keogh
Details
.config (107.05 KB, text/plain)
2015-04-19 04:00 UTC, Justin Keogh
Details
dmesg for commit 'scsi: convert device_busy to atomic_t' (4.11 KB, text/plain)
2015-04-19 04:04 UTC, Justin Keogh
Details
dmesg for panic without zfs modules (3.42 KB, text/plain)
2015-04-19 04:05 UTC, Justin Keogh
Details
dmesg for the commit that git bisect landed on, with IOMMU disabled (3.99 KB, text/plain)
2015-04-20 17:43 UTC, Justin Keogh
Details

Description merlin 2015-01-02 14:31:33 UTC
Created attachment 162291 [details]
panic log

Since kernel version 3.16 we are getting kernel panics and the panic message *might* suggest that it's related to the raid controller we use.
I did try the kernel versions 3.17, 3.18 and also and it keeps crashing. 3.15.10 runs totally fine though.
 
I can reproduce the crash 100% with a simple DD command
dd if=/dev/zero of=test bs=1G count=10
 
I've attached the backtrace and tw_cli configruation options.
We have several cluster nodes so I can try patches or give additional information when necessary.
Comment 1 merlin 2015-01-02 14:32:05 UTC
Created attachment 162301 [details]
tw_cli raid config
Comment 2 merlin 2015-01-02 14:33:52 UTC
I tried to mail "Adam Radford <linuxraid@lsi.com>" directly as stated in drivers/scsi/3w-sas.c but the mail address doesn't exist anymore.
Comment 3 kashyap 2015-01-05 09:17:03 UTC
Merlin, 

1.) 
Can you enable CONFIG_DMA_API_DEBUG in your kernel conf and send complete /var/log/messages along with back trace.

2.)
From existing logs I can figure out that crash happened at below place.

static void intel_unmap_sg(struct device *dev, struct scatterlist *sglist,
                           int nelems, enum dma_data_direction dir,
                           struct dma_attrs *attrs)
{
        intel_unmap(dev, sglist[0].dma_address);
}

sglist[0] is NULL and while accessing dma_address (which is 0x10th index as per below definition)

struct scatterlist {
#ifdef CONFIG_DEBUG_SG
        unsigned long   sg_magic;
#endif
        unsigned long   page_link;
        unsigned int    offset;
        unsigned int    length;
        dma_addr_t      dma_address;   < -- 0x10th index
#ifdef CONFIG_NEED_SG_DMA_LENGTH
        unsigned int    dma_length;
#endif  
};

Crash detail -
[ 1005.899543] Hardware name: Supermicro X9DR7/E-(J)LN4F/X9DR7/E-(J)LN4F, BIOS 3.0a 09/10/2013
[ 1005.899971] task: ffffffff8160a460 ti: ffffffff815f4000 task.ti: ffffffff815f4000
[ 1005.900401] RIP: 0010:[<ffffffff813db181>]  [<ffffffff813db181>] intel_unmap_sg+0x1/0x10


~ kashyap
Comment 4 merlin 2015-01-06 15:28:17 UTC
Hi Kashyap,

1. I enabled CONFIG_DMA_API_DEBUG , strangely enough after enabling it I couldn't even boot into the system anymore because it would crash when trying to access the root partition (after the kernel image was loaded). I think the problem was the initial xfs_repair that is done on bootup.

So I took the same kernel and copied it to a USB device and booted from that on the same host into a system that also resides on the USB disk.

Then I mounted /dev/sda (which is the first device on the raid controller which is the root partition).

Then I tried to reproduce the panic with the simple dd that was used before without success.
I then compiled the kernel sources with -j25 on the mounted root partition 2 times without any problems.
Then I chrooted onto that partition and did the same and could finally reproduce the crash.

I am not sure if that backtrace is more useful though.

I have also attached the /var/log/messages but of course that crash wasn't saved in it.
I also added my kernel config.
Comment 5 merlin 2015-01-06 15:29:25 UTC
Created attachment 162641 [details]
syslog before crash
Comment 6 merlin 2015-01-06 15:30:33 UTC
Created attachment 162651 [details]
backtrace with CONFIG_DMA_API_DEBUG enabled
Comment 7 merlin 2015-01-06 15:48:21 UTC
Created attachment 162661 [details]
kernel config
Comment 8 merlin 2015-01-21 11:51:02 UTC
Hi Kashyap,

is there any additional info you need or do you know a better way to create a useable backtrace for you?
Comment 9 Alex Elsayed 2015-02-13 07:25:12 UTC
I've been bitten by this as well, on a 3ware 9750. It's currently preventing from using recent kernels on the server in question - which is an issue, because while 3.16.1 is rock-solid for scsi it has an intermittent wireless oops, and 3.17.1 oopses out with this (same backtrace as the existing attachment).
Comment 10 Alex Elsayed 2015-02-13 07:54:30 UTC
Testing with 3.19 shows it's still there for me.
Comment 11 merlin 2015-02-13 08:28:49 UTC
I can confirm it's still happening with 3.19 here.

@Alex: What server hardware are you using? We are using Supermicro boards and Intel CPUs.
Comment 12 Alex Elsayed 2015-02-13 16:20:58 UTC
Created attachment 166681 [details]
Hardware of a second machine with the issue

Intel CPUs on an ASUS board - here's the output of lshw on the machine.
Comment 13 kashyap 2015-02-26 05:44:47 UTC
My old email id is not working now, so I have to update my email id to new avagotech domain. Sorry for delay in response.

Does this mean issue does not happen with 3.16.1 
but only happens with 3.17.1 (onwards) ? This is good data point.

Can you share whole dmesg logs for both 3.16.1 and 3.17.1 ?

Also are you using intel_iommu=on in your config ? Can you boot without enabling Intel IOMMU? 

New logs with ""CONFIG_DMA_API_DEBUG" does not help much. You may have to post complete logs. We may have some interesting data before crash.

Thanks, Kashyap
Comment 14 merlin 2015-02-26 07:32:18 UTC
@Kashyap

For me it started with 3.16 on all our servers with 3ware/lsi/avagotech controllers.
I rechecked in our internal ticket system.

We are using IOMMU so I completely disabled it, recompiled the kernal but getting the same error.

I also attached my kernel config before so maybe you can use that config and compile the kernel on your side.
Running with that config I can reproduce the crash with a simple dd command:
dd if=/dev/zero of=test bs=1G count=10
Comment 15 kashyap 2015-02-26 13:38:47 UTC
(In reply to merlin from comment #14)
> @Kashyap
> 
> For me it started with 3.16 on all our servers with 3ware/lsi/avagotech
> controllers.
> I rechecked in our internal ticket system.
> 
> We are using IOMMU so I completely disabled it, recompiled the kernal but
> getting the same error.
> 
> I also attached my kernel config before so maybe you can use that config and
> compile the kernel on your side.
> Running with that config I can reproduce the crash with a simple dd command:
> dd if=/dev/zero of=test bs=1G count=10

Can you share whole dmesg logs for the failure even if IOMMU is disabled ? I will try to reproduce at my setup as I was able to find same h/w.

~ Kashyap
Comment 16 merlin 2015-04-13 16:16:33 UTC
Created attachment 173931 [details]
panic_screenshot

screenshot of kernel panic
Comment 17 merlin 2015-04-13 16:16:43 UTC
I am unable to get a dmesg output since the system crashes on boot.
It looks like it's happening when udev is initialized.

Sorry for the screenshot but the system crashed before any network came up.
Comment 18 merlin 2015-04-16 11:21:22 UTC
Created attachment 174171 [details]
dmesg

I finally managed to get a dmesg output with the crashing kernel.

Especially this part might indicate the root of the problem?
[Thu Apr 16 13:02:10 2015] ------------[ cut here ]------------
[Thu Apr 16 13:02:10 2015] WARNING: CPU: 6 PID: 1736 at lib/dma-debug.c:601 debug_dma_assert_idle+0x17c/0x1e0()
[Thu Apr 16 13:02:10 2015] 3w-sas 0000:03:00.0: DMA-API: cpu touching an active dma mapped cacheline [cln=0x0000000101ff8e00]
[Thu Apr 16 13:02:10 2015] Modules linked in:
[Thu Apr 16 13:02:10 2015] CPU: 6 PID: 1736 Comm: mount Not tainted 4.0.0-gentoo #1
[Thu Apr 16 13:02:11 2015] Hardware name: Supermicro X9DR7/E-(J)LN4F/X9DR7/E-(J)LN4F, BIOS 3.0a 09/10/2013
[Thu Apr 16 13:02:11 2015]  ffffffff8170e0f5 ffff88406050fcb8 ffffffff814c8778 000000000000009a
[Thu Apr 16 13:02:11 2015]  ffff88406050fd08 ffff88406050fcf8 ffffffff8107c250 ffff884060422e08
[Thu Apr 16 13:02:11 2015]  ffff8840647fe5e0 0000000000000206 ffffea00e1bf9ce8 ffff884060422e08
[Thu Apr 16 13:02:11 2015] Call Trace:
[Thu Apr 16 13:02:11 2015]  [<ffffffff814c8778>] dump_stack+0x45/0x57
[Thu Apr 16 13:02:11 2015]  [<ffffffff8107c250>] warn_slowpath_common+0x80/0xc0
[Thu Apr 16 13:02:11 2015]  [<ffffffff8107c2d1>] warn_slowpath_fmt+0x41/0x50
[Thu Apr 16 13:02:11 2015]  [<ffffffff812b9dfc>] debug_dma_assert_idle+0x17c/0x1e0
[Thu Apr 16 13:02:11 2015]  [<ffffffff81114814>] do_wp_page+0xc4/0x810
[Thu Apr 16 13:02:11 2015]  [<ffffffff8111744c>] handle_mm_fault+0xb3c/0x10f0
[Thu Apr 16 13:02:11 2015]  [<ffffffff8111ca6d>] ? do_mmap_pgoff+0x34d/0x400
[Thu Apr 16 13:02:11 2015]  [<ffffffff81070ec6>] __do_page_fault+0x146/0x390
[Thu Apr 16 13:02:11 2015]  [<ffffffff8107114c>] do_page_fault+0xc/0x10
[Thu Apr 16 13:02:11 2015]  [<ffffffff814cf252>] page_fault+0x22/0x30
[Thu Apr 16 13:02:11 2015] ---[ end trace 326b0530baa65706 ]---


I was still able to login with root after that and reproduce the crash with another backtrace. See the next attachment.
Comment 19 merlin 2015-04-16 11:25:13 UTC
Created attachment 174181 [details]
crash-backtrace
Comment 20 Justin Keogh 2015-04-19 03:59:09 UTC
Created attachment 174421 [details]
dmesg for the commit that git bisect landed on

I'm getting a similar panic (attached).

$lspci | grep 3ware
05:00.0 RAID bus controller: 3ware Inc 9750 SAS2/SATA-II RAID PCIe (rev 05)

$uname -a
Linux localhost 3.16.0-rc5+ #18 SMP PREEMPT Wed Apr 8 20:11:03 2015 x86_64 Intel(R) Xeon(R) CPU X5482 @ 3.20GHz GenuineIntel GNU/Linux

root@localhost /usr/src/linux $git rev-parse HEAD
74665016086615bbaa3fa6f83af410a0a4e029ee

The panic bisected to:
74665016086615bbaa3fa6f83af410a0a4e029ee is the first bad commit
commit 74665016086615bbaa3fa6f83af410a0a4e029ee
Author: Christoph Hellwig <hch@lst.de>
Date:   Wed Jan 22 15:29:29 2014 +0100

    scsi: convert host_busy to atomic_t
    
    Avoid taking the host-wide host_lock to check the per-host queue limit.
    Instead we do an atomic_inc_return early on to grab our slot in the queue,
    and if necessary decrement it after finishing all checks.


I was unable to trigger the panic by writing to the 3w array with:
$dd if=/dev/zero of=test bs=1G count=10
or even:
$dd if=/dev/zero of=test bs=1G count=100

Instead, it takes somewhere between a few hours and 2 days of writing to panic, so the good bisects were run for 3 days to make sure.

Crash happens with and without ZFS modules loaded but most of the bisect was done with because I couldn't take the array out of the equation for a month. Both cases are attached along with .config and bisect log.

I'll recompile without IOMMU and post the results, further suggestions appreciated.
Comment 21 Justin Keogh 2015-04-19 04:00:05 UTC
Created attachment 174431 [details]
git bisect log between 3.14.33 and 3.18.7
Comment 22 Justin Keogh 2015-04-19 04:00:55 UTC
Created attachment 174441 [details]
.config
Comment 23 Justin Keogh 2015-04-19 04:04:01 UTC
Created attachment 174451 [details]
dmesg for commit 'scsi: convert device_busy to atomic_t'
Comment 24 Justin Keogh 2015-04-19 04:05:12 UTC
Created attachment 174461 [details]
dmesg for panic without zfs modules
Comment 25 Justin Keogh 2015-04-19 04:21:05 UTC
Just to clarify, I couldn't trigger this by writing to the array from /dev/zero at all (maybe because ZFS), all panics were triggered by writing real data from another array on the same controller.
Comment 26 Justin Keogh 2015-04-20 17:43:34 UTC
Created attachment 174581 [details]
dmesg for the commit that git bisect landed on, with IOMMU disabled
Comment 27 Justin Keogh 2015-10-10 07:30:41 UTC
I am unable to reproduce this on any of the 4.x.y kernels.

Note You need to log in before you can comment on or make changes to this bug.