Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 148059 - Promise SATA driver included in the gentoo-sources (v1.04) does not work for PDC20579 Controller (kernel panic), but the driver (same version) in the vanilla-sources does work.
Summary: Promise SATA driver included in the gentoo-sources (v1.04) does not work for ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: AMD64 Linux
: High major (vote)
Assignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers
URL: http://forums.gentoo.org/viewtopic-t-...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-09-18 06:52 UTC by Sean
Modified: 2007-01-08 23:46 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
debug patch (pdc-debug.patch,513 bytes, patch)
2006-09-26 15:57 UTC, Daniel Drake (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sean 2006-09-18 06:52:45 UTC
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6
Build Identifier: 

The Promise SATA driver (sata_promise v1.04) used in gentoo-sources (2.6.17-r*)
does not work (kernel panic, see link), but the v1.04 sata_promise driver in the
2.6.17 vanilla-sources does work.  There are differences in the sata_promise.c
code between the two drivers included with the two sources, but I am not
knowledgeable enough about driver code to debug it.  I have not been able to use
the gentoo kernel since the sata_promise driver was upgraded from 1.03 to 1.04.


Reproducible: Always

Steps to Reproduce:
1. emerge latest gentoo kernel source
2. make oldconfig
3. 

Actual Results:  
kernel panic


The v1.04 sata_promise driver contains new code to explicitly handle the
pdc2057x controller whereas the 1.03 does not...the problem could lie somewhere
in the new code added to handle the pdc2057x controller, but since the driver
included with the vanilla-sources does work, and there are differences between
the driver provided with the gentoo-sources and the vanilla-sources, maybe it's
a patch issue?
Comment 1 Daniel Drake (RETIRED) gentoo-dev 2006-09-18 08:35:35 UTC
Can you post a photo of the kernel panic, or write down the human readable parts?
Comment 2 Sean 2006-09-18 16:36:28 UTC
(In reply to comment #1)
> Can you post a photo of the kernel panic, or write down the human readable
> parts?
> 

Below is a link to a screenshot of the kernel panic message.

http://weather.ou.edu/~sarms/panic.jpg
Comment 3 Daniel Drake (RETIRED) gentoo-dev 2006-09-20 15:15:30 UTC
Please reproduce this on gentoo-sources-2.6.18
Comment 4 Sean 2006-09-20 21:16:03 UTC
(In reply to comment #3)
> Please reproduce this on gentoo-sources-2.6.18
> 
http://weather.ou.edu/~sarms/panic2.jpg
Comment 5 Daniel Drake (RETIRED) gentoo-dev 2006-09-26 15:57:19 UTC
Created attachment 98178 [details, diff]
debug patch

Please apply this patch and retry. No need to get a photo, just note down the line which starts with "pdc_sata_scr_read ap="
Comment 6 Daniel Drake (RETIRED) gentoo-dev 2006-09-26 15:58:32 UTC
That line will appear directly above the line which says "Unable to handle kernel NULL pointer dereference"

If it doesn't, note down the "Unable to handle kernel NULL pointer dereference" line including the RIP value which follows.
Comment 7 Benoît "UBIK" Collet-Billon 2006-09-27 04:47:34 UTC
(In reply to comment #6)

Applied the debug patch (using gentoo-sources-2.16.18 on x86_64), here's the full result:

>scsi1 : sata_promise
>pdc_sata_scr_read ap=ffff81003f71c498
>pdc_sata_scr_read ap=ffff81003f71c498
>pdc_sata_scr_read ap=ffff81003f71c498
>pdc_sata_scr_read ap=ffff81003f71c498
>pdc_sata_scr_read ap=ffff81003f71c498
>ata2: SATA link down (SStatus 0 SControl 300)
>pdc_sata_scr_read ap=ffff81003f71c498
>pdc_sata_scr_read ap=ffff81003f708498
>Unable to handle kernel NULL pointer dereference at 0000000000000000 RIP:
> [<ffffffff803eb58f>] pdc_sata_scr_read+0x34/0x3b
Comment 8 Sean 2006-09-27 06:06:21 UTC
----------------------
gentoo-sources-2.16.18
----------------------


pdc_sata_src_read ap=ffff8100bfd28498
pdc_sata_src_read ap=ffff8100bfdfc498
Unable to handle kernel NULL pointer dereference at 0000000000000008
RIP ffffffff03f553e pdc_sata_scr_read+0x3e/0x50

I have a picture that I can post after I return home from work.
Comment 9 Sean 2006-10-02 18:20:46 UTC
Sorry for the delay!

http://weather.ou.edu/~sarms/panic3.jpeg
Comment 10 Daniel Drake (RETIRED) gentoo-dev 2006-10-10 18:34:07 UTC
Sorry for the delay in looking at this. I know which patch causes the problem, the intention is that it allows you to use the IDE port which is part of your SATA controller.

The diagnosis so far doesn't really make sense, so let's go a step further. Assuming you have not modified the gentoo-sources-2.6.18 kernel config since the last screenshot was posted:

emerge -n gdb
cd /usr/src/linux-2.6.18-gentoo
rm drivers/scsi/sata_promise.o
make CONFIG_DEBUG_INFO=y drivers/scsi/sata_promise.o
gdb drivers/scsi/sata_promise.o


Then at the gdb prompt:

list *pdc_sata_scr_read+0x3e

And show us the output of that.
Comment 11 Sean 2006-10-10 19:26:43 UTC
(gdb) list *pdc_sata_scr_read+0x3e
0x20e is in pdc_sata_scr_read (io.h:181).
176     {
177             return *(__force volatile __u16 *)addr;
178     }
179     static __always_inline __u32 __readl(const volatile void __iomem *addr)
180     {
181             return *(__force volatile __u32 *)addr;
182     }
183     static inline __u64 __readq(const volatile void __iomem *addr)
184     {
185             return *(__force volatile __u64 *)addr;
(gdb)
Comment 12 Sean 2006-10-10 19:29:05 UTC
By the way, no worries about the delay, I appreciate your help!
Comment 13 Daniel Drake (RETIRED) gentoo-dev 2006-10-10 19:57:07 UTC
That helps, thanks. Change this line (added in earlier patch):

	printk("pdc_sata_scr_read ap=%p\n", ap);

to:

	printk("pdc_sata_scr_read ap=%p scr_addr %ld sc_reg %d\n", ap, ap->ioaddr.scr_addr, sc_reg);

and show the new output (something like comment #8 will suffice)
Comment 14 Sean 2006-10-15 10:26:17 UTC
----------------------
gentoo-sources-2.16.18
----------------------

pdc_sata_src_read ap=ffff8100bfce0498 src_addr -68169720896256 sc_reg 2
pdc_sata_src_read ap=ffff8100bfce0498 src_addr -68169720896256 sc_reg 0
pdc_sata_src_read ap=ffff8100bfce0498 src_addr -68169720896256 sc_reg 0
pdc_sata_src_read ap=ffff8100bfce0498 src_addr -68169720896256 sc_reg 2
pdc_sata_src_read ap=ffff8100bfce0498 src_addr -68169720896256 sc_reg 0
ata2: SATA link down (SStatus 0 SControl 300)
pdc_sata_src_read ap=ffff8100bfce0498 src_addr -68169720896256 sc_reg 0
pdc_sata_src_read ap=ffff8100bfd08498 src_addr 0 sc_reg 2
Unable to handel kernel NULL pointer dereference at 0000000000000008 RIP:
 [<ffffffff803f5547>] pdc_sata_src_read+0x47/0x60


...and just in case I've left something out or you would like to see more...

http://weather.ou.edu/~sarms/panic4.jpeg
Comment 15 Daniel Drake (RETIRED) gentoo-dev 2006-10-15 12:05:34 UTC
Odd. Sorry to throw another request at you, but I figure it would be best to get the driver developers involved here. Please could you confirm the problem still exists on 2.6.19-rc2 patched with:

http://www.kernel.org/git/?p=linux/kernel/git/jgarzik/libata-dev.git;a=commitdiff_plain;h=03f8e53265e3127fca39ad4336b4326dd0439987;hp=d223a60106891bfe46febfacf46b20cd8509aaad

Thanks!
Comment 16 Sean 2006-10-15 13:57:13 UTC
Greetings!

    The patch would not apply correctly for me:

----------------------------

patch -p1 < git-03f8e53265e3127fca39ad4336b4326dd0439987.patch
patching file drivers/ata/libata-core.c
Hunk #1 succeeded at 5298 (offset 3 lines).
patching file drivers/ata/sata_promise.c
Hunk #2 FAILED at 354.
Hunk #3 succeeded at 683 (offset 1 line).
Hunk #4 succeeded at 748 (offset 1 line).
Hunk #5 succeeded at 765 (offset 1 line).
1 out of 5 hunks FAILED -- saving rejects to file drivers/ata/sata_promise.c.rejpatching file include/linux/libata.h

----------------------------

  After I added the changes from HUNK 2 of the patch by hand, the kernel would not compile correctly:

----------------------------

scripts/kconfig/conf -s arch/x86_64/Kconfig
  CHK     include/linux/version.h
  CHK     include/linux/utsrelease.h
  CHK     include/linux/compile.h
  GZIP    kernel/config_data.gz
  IKCFG   kernel/config_data.h
  CC      kernel/configs.o
  LD      kernel/built-in.o
  CC      fs/nfs/dir.o
fs/nfs/dir.c: In function `nfs_access_add_cache':
include/asm/bitops.h:122: error: inconsistent operand constraints in an `asm'
make[2]: *** [fs/nfs/dir.o] Error 1
make[1]: *** [fs/nfs] Error 2
make: *** [fs] Error 2
Comment 17 Daniel Drake (RETIRED) gentoo-dev 2006-10-17 18:57:25 UTC
Can you attach your kernel .config?
Comment 18 Sean 2006-10-22 10:37:16 UTC
Greetings!

Sorry for the delay - I got the kernel to compile (with the patch you linked) and the problem still exists.
Comment 19 Daniel Drake (RETIRED) gentoo-dev 2006-11-08 08:58:05 UTC
I removed the buggy patch from 2.6.18-r2. This means the crash will no longer happen but you won't be able to access any hardware you have connected to the IDE port of this SATA controller.

I think I found a version of the patch reported to work with 2.6.18, but haven't compared the differences yet. After seeing how unpatched gentoo-sources-2.6.18-r2 behaves, please apply this patch and tell me if anything broke:

http://cvs.pld-linux.org/cgi-bin/cvsweb/SOURCES/linux-2.6-sata-promise-pata-ports.patch?rev=1.1.2.2

Thanks!
Comment 20 Sean 2006-11-09 21:08:33 UTC
The unpatched 2.6.18-r2 worked fine as expected.  I applied the patch and got the dreaded panic (same kind of panic as before).

Let me know if you want the panic message info again.

Thanks for your help!
Comment 21 Benoît "UBIK" Collet-Billon 2006-11-10 06:07:27 UTC
(In reply to comment #19)
> ... This means the crash will no longer happen but you won't be able to 
> access any hardware you have connected to the IDE port of this SATA 
> controller...

Well, gentoo-sources-2.6.18-r2 solves the issue on my box: the disk attached to the promise_sata controller works fine.See a part of my dmesg:

> sata_promise 0000:00:0d.0: version 1.04
> GSI 18 sharing vector 0xB9 and IRQ 18
> ACPI: PCI Interrupt 0000:00:0d.0[A] -> GSI 17 (level, low) -> IRQ 18
> ata1: SATA max UDMA/133 cmd 0xFFFFC20000006200 ctl 0xFFFFC20000006238 bmdma 0x0 irq 18
> ata2: SATA max UDMA/133 cmd 0xFFFFC20000006280 ctl 0xFFFFC200000062B8 bmdma 0x0 irq 18
> scsi0 : sata_promise
> ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
> ata1.00: ATA-7, max UDMA/133, 240121728 sectors: LBA NCQ (depth 0/32)
> ata1.00: ata1: dev 0 multi count 0
> ata1.00: configured for UDMA/133
> scsi1 : sata_promise
> ata2: SATA link down (SStatus 0 SControl 300)
>   Vendor: ATA       Model: Maxtor 6L120M0    Rev: BACE
>   Type:   Direct-Access                      ANSI SCSI revision: 05
> [...]
> SCSI device sda: 240121728 512-byte hdwr sectors (122942 MB)
> sda: Write Protect is off
> sda: Mode Sense: 00 3a 00 00
> SCSI device sda: drive cache: write back
> SCSI device sda: 240121728 512-byte hdwr sectors (122942 MB)
> sda: Write Protect is off
> sda: Mode Sense: 00 3a 00 00
> SCSI device sda: drive cache: write back
>  sda: sda1
> sd 0:0:0:0: Attached scsi disk sda

I'm currently rebuilding the kernel with the provided patch, i'll post the results in a moment.


Comment 22 Benoît "UBIK" Collet-Billon 2006-11-10 06:19:34 UTC
Like Sean, the patch gives me a kernel panic, see the following photo (sorry for the quality, can't do better):

http://img84.imageshack.us/img84/8273/satapromiseni1.jpg
Comment 23 Andy Lutomirski 2006-12-21 21:03:22 UTC
It looks like there is a fix available: http://permalink.gmane.org/gmane.linux.kernel/473363

It would be nice to see the promise PATA support come back in gentoo-sources, since I have a 20375 and my shiny RAID array doesn't work very well without it :(  If I knew anything about ATA, I'd try to hack up an acceptable patch for upstream, but I don't.
Comment 24 Daniel Drake (RETIRED) gentoo-dev 2006-12-26 08:43:43 UTC
Thanks. I'd appreciate it if people could test these patches on top of gentoo-sources-2.6.19 or newer:

http://dev.gentoo.org/~dsd/genpatches/trunk/2.6.19/4100_sata-promise-ide.patch
http://dev.gentoo.org/~dsd/genpatches/trunk/2.6.19/4101_sata-promise-ide-fix.patch

I'd like to see success reports from people who actually use the IDE ports, plus people who reported the earlier crashes on this bug.
Comment 25 Sean 2006-12-26 20:45:25 UTC
I am able to access my IDE port using when I patch gentoo-sources/2.6.19-r2 with the two patches linked above.  It looks like everything works!
Comment 26 Mik 2007-01-08 22:14:44 UTC
This patch (applied to 2.6.19-gentoo-r2) has resolved the problem for my PDC20378 Promise card.  Thanks for all the work.(In reply to comment #0)

 

Comment 27 Daniel Drake (RETIRED) gentoo-dev 2007-01-08 23:46:56 UTC
Fixed in gentoo-sources-2.6.19-r3