Bug 40212 - oops when rt8192ce driver call rtl_pci_probe()
Summary: oops when rt8192ce driver call rtl_pci_probe()
Status: CLOSED PATCH_ALREADY_AVAILABLE
Alias: None
Product: Drivers
Classification: Unclassified
Component: network-wireless (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Larry Finger
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-28 01:40 UTC by Liao, Hubert
Modified: 2011-08-08 14:39 UTC (History)
5 users (show)

See Also:
Kernel Version: 3.0.0-05684-ge371d46
Subsystem:
Regression: No
Bisected commit-id:


Attachments
Test patch for crash on ARM soc (1.21 KB, patch)
2011-07-28 21:28 UTC, Larry Finger
Details | Diff
Version of patch submitted upstream (1.91 KB, patch)
2011-07-29 16:03 UTC, Larry Finger
Details | Diff

Description Liao, Hubert 2011-07-28 01:40:35 UTC
Oops when rtl_pci_probe() called _rtl_pci_find_adapter(),
in this funcation, the  pdev->bus->self is a NULL pointer .

static boot _rtl_pci_find_adapter(strcut pci_dev *dev,
              struct ieee80211_hw *hw) 
{

struct pci_dev *bridge_pdev = pdev->bus->self; 
...

pcipriv->ndis_adapter.pcibridge_vendorid = bridge_pdev->vendor; <-- [oops here] 

...
}

here, I just want to know why the bus->self  is NULL?
Comment 1 Liao, Hubert 2011-07-28 01:59:32 UTC
the board is an ARM soc, 
The kernel is from the linus kernel git tree(3.0.0-05684-ge371d46-dirty),
I also have tested the 2.6.38.8 stable release, it has the same problem.

lspci -nnk
00:00.0 Class [0580]: Device [11ab:6192] (rev 03)
       Subsystem: Device [11ab:11ab]
00:01.0 Class [0280]: Device [10ec:8178] (rev 01)
       Subsystem: Device [1a3b:1178]
Comment 2 Larry Finger 2011-07-28 14:49:59 UTC
Please attach the complete dmesg output to this bug.

As you noted in your last Email, there is something upstream in the PCI setup code that is failing. I could trap this NULL in rtlwifi; however, that would only exchange the oops for a warning.
Comment 3 Larry Finger 2011-07-28 21:28:23 UTC
Created attachment 67062 [details]
Test patch for crash on ARM soc

On further investigation, rtlwifi is the only wireless driver to use the self member. This patch should work for all cases by testing bridge_pdev. Please test and inform us of the results.

This may not be the final version of the patch as I need to check if the bridge information is used on x86 architecture. If not, a lot of code can be deleted here.
Comment 4 Liao, Hubert 2011-07-29 00:52:00 UTC
Ok, I'll test it. In fact, before committed this bug, We have modified the code like this patch doing, and everything seemed ok. I have another question, if on x86 machine it works well, the self member be set properly, do you know where set the self member? Maybe I can compare these two architectures corresponding code to find why on arm did not set it.
Comment 5 Liao, Hubert 2011-07-29 01:18:31 UTC
(In reply to comment #2)
> Please attach the complete dmesg output to this bug.
> 
> As you noted in your last Email, there is something upstream in the PCI setup
> code that is failing. I could trap this NULL in rtlwifi; however, that would
> only exchange the oops for a warning.

dmesg output:
---
[    0.000000] Linux version 3.0.0-05684-ge371d46-dirty (ethan@netacrd) (gcc version 4.3.2 (sdk3.3-ct-ng-1.4.1) ) #35 PREEMPT Wed Jul 27 17:28:23 CST 2011
[    0.000000] CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE), cr=00053977
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] Machine: Marvell RD-88F6192-NAS Development Board
[    0.000000] Memory policy: ECC disabled, Data cache writeback
[    0.000000] On node 0 totalpages: 65536
[    0.000000] free_area_init_node: node 0, pgdat c04ba050, node_mem_map c0553000
[    0.000000]   Normal zone: 512 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 65024 pages, LIFO batch:15
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0 
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 65024
[    0.000000] Kernel command line: console=ttyS0,115200 root=/dev/nfs rw nfsroot=172.17.0.101:/mnt/squashfs-root ip=172.17.0.102:172.17.0.101:::DB88FXX81:eth0:none
[    0.000000] PID hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Memory: 256MB = 256MB total
[    0.000000] Memory: 254408k/254408k available, 7736k reserved, 0K highmem
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
[    0.000000]     DMA     : 0xffc00000 - 0xffe00000   (   2 MB)
[    0.000000]     vmalloc : 0xd0800000 - 0xfe800000   ( 736 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xd0000000   ( 256 MB)
[    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)
[    0.000000]       .text : 0xc0008000 - 0xc0473b68   (4527 kB)
[    0.000000]       .init : 0xc0474000 - 0xc0494000   ( 128 kB)
[    0.000000]       .data : 0xc0494000 - 0xc04bb740   ( 158 kB)
[    0.000000]        .bss : 0xc04bb764 - 0xc055257c   ( 604 kB)
[    0.000000] SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000] NR_IRQS:114
[    0.000000] sched_clock: 32 bits at 166MHz, resolution 5ns, wraps every 25769ms
[    0.000000] Console: colour dummy device 80x30
[   18.999835] Calibrating delay loop... 789.70 BogoMIPS (lpj=3948544)
[   19.039691] pid_max: default: 32768 minimum: 301
[   19.039885] Mount-cache hash table entries: 512
[   19.040385] CPU: Testing write buffer coherency: ok
[   19.041564] devtmpfs: initialized
[   19.044141] NET: Registered protocol family 16
[   19.048476] Kirkwood: MV88F6192-A1, TCLK=166666667.
[   19.048497] Feroceon L2: Enabling L2
[   19.048545] Feroceon L2: Cache support initialised.
[   19.051481] Kirkwood PCIe port 0: 
[   19.051492] link up
[   19.051503] PCI: bus0 uses PCIe port 0
[   19.051728] pci_bus 0000:00: scanning bus
[   19.051770] pci 0000:00:00.0: [11ab:6192] type 0 class 0x000580
[   19.051806] pci 0000:00:00.0: calling quirk_mmio_always_on+0x0/0x20
[   19.051838] pci 0000:00:00.0: reg 10: [mem 0xf1000000-0xf10fffff 64bit pref]
[   19.051860] pci 0000:00:00.0: reg 18: [mem 0x00000000-0x0fffffff]
[   19.051896] pci 0000:00:00.0: calling pci_fixup_ide_bases+0x0/0x50
[   19.051915] pci 0000:00:00.0: calling rc_pci_fixup+0x0/0x44
[   19.051938] pci 0000:00:00.0: calling quirk_resource_alignment+0x0/0x180
[   19.051980] pci 0000:00:00.0: supports D1 D2
[   19.052033] pci 0000:00:01.0: [10ec:8178] type 0 class 0x000280
[   19.052055] pci 0000:00:01.0: calling quirk_mmio_always_on+0x0/0x20
[   19.052086] pci 0000:00:01.0: reg 10: [io  0xf0000000-0xf00000ff]
[   19.052127] pci 0000:00:01.0: reg 18: [mem 0x90000000-0x90003fff 64bit]
[   19.052180] pci 0000:00:01.0: calling pci_fixup_ide_bases+0x0/0x50
[   19.052201] pci 0000:00:01.0: calling quirk_resource_alignment+0x0/0x180
[   19.052247] pci 0000:00:01.0: supports D1 D2
[   19.052262] pci 0000:00:01.0: PME# supported from D0 D1 D2 D3hot D3cold
[   19.052278] pci 0000:00:01.0: PME# disabled
[   19.052326] pci_bus 0000:00: fixups for bus
[   19.052347] PCI: bus0: Fast back to back transfers disabled
[   19.052361] pci_bus 0000:00: bus scan returning with max=00
[   19.052820] pci 0000:00:00.0: fixup irq: got 9
[   19.052842] pci 0000:00:01.0: fixup irq: got 9
[   19.052872] pci 0000:00:01.0: BAR 2: assigned [mem 0xe0000000-0xe0003fff 64bit]
[   19.052903] pci 0000:00:01.0: BAR 2: set to [mem 0xe0000000-0xe0003fff 64bit] (PCI address [0xe0000000-0xe0003fff])
[   19.052926] pci 0000:00:01.0: BAR 0: assigned [io  0x1000-0x10ff]
[   19.052947] pci 0000:00:01.0: BAR 0: set to [io  0x1000-0x10ff] (PCI address [0x1000-0x10ff])
[   19.069219] bio: create slab <bio-0> at 0
[   19.070061] vgaarb: loaded
[   19.070771] SCSI subsystem initialized
[   19.071291] libata version 3.00 loaded.
[   19.072140] usbcore: registered new interface driver usbfs
[   19.072495] usbcore: registered new interface driver hub
[   19.072734] usbcore: registered new device driver usb
[   19.074601] cfg80211: Calling CRDA to update world regulatory domain
[   19.075701] Switching to clocksource orion_clocksource
[   19.079705] Switched to NOHz mode on CPU #0
[   19.095155] NET: Registered protocol family 2
[   19.095388] IP route cache hash table entries: 2048 (order: 1, 8192 bytes)
[   19.096481] TCP established hash table entries: 8192 (order: 4, 65536 bytes)
[   19.096756] TCP bind hash table entries: 8192 (order: 3, 32768 bytes)
[   19.096896] TCP: Hash tables configured (established 8192 bind 8192)
[   19.096910] TCP reno registered
[   19.096930] UDP hash table entries: 256 (order: 0, 4096 bytes)
[   19.096963] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[   19.097198] NET: Registered protocol family 1
[   19.097561] RPC: Registered named UNIX socket transport module.
[   19.097578] RPC: Registered udp transport module.
[   19.097589] RPC: Registered tcp transport module.
[   19.097599] RPC: Registered tcp NFSv4.1 backchannel transport module.
[   19.097649] pci 0000:00:00.0: calling quirk_cardbus_legacy+0x0/0x2c
[   19.097681] pci 0000:00:00.0: calling quirk_usb_early_handoff+0x0/0x6f0
[   19.097710] pci 0000:00:01.0: calling quirk_cardbus_legacy+0x0/0x2c
[   19.097730] pci 0000:00:01.0: calling quirk_usb_early_handoff+0x0/0x6f0
[   19.097749] PCI: CLS 32 bytes, default 32
[   19.211411] JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
[   19.212543] msgmni has been set to 496
[   19.213135] io scheduler noop registered
[   19.213149] io scheduler deadline registered
[   19.213266] io scheduler cfq registered (default)
[   19.213376] mv_xor_shared mv_xor_shared.0: Marvell shared XOR driver
[   19.213421] mv_xor_shared mv_xor_shared.1: Marvell shared XOR driver
[   19.245803] mv_xor mv_xor.0: Marvell XOR: ( xor cpy )
[   19.285798] mv_xor mv_xor.1: Marvell XOR: ( xor fill cpy )
[   19.325788] mv_xor mv_xor.2: Marvell XOR: ( xor cpy )
[   19.365788] mv_xor mv_xor.3: Marvell XOR: ( xor fill cpy )
[   19.374983] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[   19.396454] serial8250.0: ttyS0 at MMIO 0xf1012000 (irq = 33) is a 16550A
[   19.845250] console [ttyS0] enabled
[   19.854407] loop: module loaded
[   19.858540] sata_mv sata_mv.0: version 1.28
[   19.858711] sata_mv sata_mv.0: slots 32 ports 2
[   19.866007] scsi0 : sata_mv
[   19.869420] scsi1 : sata_mv
[   19.872612] ata1: SATA max UDMA/133 irq 21
[   19.876770] ata2: SATA max UDMA/133 irq 21
[   19.883348] m25p80 spi0.0: m25p128 (16384 Kbytes)
[   19.891283] mv643xx_eth: MV-643xx 10/100/1000 ethernet driver version 1.4
[   19.898415] mv643xx_eth smi: probed
[   19.904630] mv643xx_eth_port mv643xx_eth_port.0: eth0: port 0 with MAC address 00:00:61:92:00:64
[   19.913769] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[   19.920393] orion-ehci orion-ehci.0: Marvell Orion EHCI
[   19.925667] orion-ehci orion-ehci.0: new USB bus registered, assigned bus number 1
[   19.955769] orion-ehci orion-ehci.0: irq 19, io mem 0xf1050000
[   19.975763] orion-ehci orion-ehci.0: USB 2.0 started, EHCI 1.00
[   19.982641] hub 1-0:1.0: USB hub found
[   19.986458] hub 1-0:1.0: 1 port detected
[   19.991177] Initializing USB Mass Storage driver...
[   19.996334] usbcore: registered new interface driver usb-storage
[   20.002319] USB Mass Storage support registered.
[   20.007159] usbcore: registered new interface driver ums-datafab
[   20.013330] usbcore: registered new interface driver ums-freecom
[   20.019499] usbcore: registered new interface driver ums-jumpshot
[   20.025801] usbcore: registered new interface driver ums-sddr09
[   20.031847] usbcore: registered new interface driver ums-sddr55
[   20.038304] mousedev: PS/2 mouse device common for all mice
[   20.044584] rtc-mv rtc-mv: rtc core: registered rtc-mv as rtc0
[   20.050778] i2c /dev entries driver
[   20.054943] cpuidle: using governor ladder
[   20.059704] cpuidle: using governor menu
[   20.064487] oprofile: hardware counters not available
[   20.069622] oprofile: using timer interrupt.
[   20.075212] TCP cubic registered
[   20.078564] NET: Registered protocol family 17
[   20.083204] lib80211: common routines for IEEE802.11 drivers
[   20.088968] lib80211_crypt: registered algorithm 'NULL'
[   20.088983] Gating clock of unused units
[   20.088993] before: 0x00c7c1dd
[   20.089002]  after: 0x00c7c1cd
[   20.090032] rtc-mv rtc-mv: setting system clock to 2000-02-07 17:15:36 UTC (949943736)
[   20.385768] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl F300)
[   20.405997] ata1.00: ATA-7: ST3250410AS, 3.AAF, max UDMA/133
[   20.411636] ata1.00: 488397168 sectors, multi 0: LBA48 NCQ (depth 31/32)
[   20.455986] ata1.00: configured for UDMA/133
[   20.476176] scsi 0:0:0:0: Direct-Access     ATA      ST3250410AS      3.AA PQ: 0 ANSI: 5
[   20.485323] sd 0:0:0:0: [sda] 488397168 512-byte logical blocks: (250 GB/232 GiB)
[   20.493420] sd 0:0:0:0: [sda] Write Protect is off
[   20.498272] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[   20.498403] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[   20.531794]  sda: sda1 sda2 sda3
[   20.536954] sd 0:0:0:0: [sda] Attached SCSI disk
[   20.995768] ata2: SATA link up 3.0 Gbps (SStatus 123 SControl F300)
[   21.002718] ata2.15: Port Multiplier 1.2, 0x11ab:0x4140 r193, 4 ports, feat 0x1/0x1f
[   21.018508] ata2.00: hard resetting link
[   21.366497] ata2.01: hard resetting link
[   21.716501] ata2.02: hard resetting link
[   21.866453] mv643xx_eth_port mv643xx_eth_port.0: eth0: link up, 100 Mb/s, full duplex, flow control disabled
[   21.895756] IP-Config: Guessing netmask 255.255.0.0
[   21.900818] IP-Config: Complete:
[   21.904034]      device=eth0, addr=172.17.0.102, mask=255.255.0.0, gw=255.255.255.255,
[   21.911708]      host=DB88FXX81, domain=, nis-domain=(none),
[   21.917370]      bootserver=172.17.0.101, rootserver=172.17.0.101, rootpath=
[   22.066534] ata2.03: hard resetting link
[   22.416684] ata2: EH complete
[   22.460722] VFS: Mounted root (nfs filesystem) on device 0:14.
[   22.467040] devtmpfs: mounted
[   22.470566] Freeing init memory: 128K
Comment 6 Larry Finger 2011-07-29 03:30:39 UTC
The self member is setup in arch/x86/kernel/pci-calgary_64.c.

On x86, this whole business makes little difference. On RTL8192DE the flag that indicates support for ASPM is changed from false to true if there is an Intel bridge. The value for RTL8192CE and RTL8192SE does not depend on the bridge vendor.
Comment 7 chaoming_li 2011-07-29 03:48:54 UTC
Hi all:

Please add pcipriv->ndis_adapter.pcibridge_vendor = PCI_BRIDGE_VENDOR_UNKNOWN;
and try again like this:
	
        pcipriv->ndis_adapter.pcibridge_vendorid = bridge_pdev->vendor;
	pcipriv->ndis_adapter.pcibridge_vendor = PCI_BRIDGE_VENDOR_UNKNOWN;
	for (tmp = 0; tmp < PCI_BRIDGE_VENDOR_MAX; tmp++) {
		if (bridge_pdev->vendor == pcibridge_vendors[tmp]) {
			pcipriv->ndis_adapter.pcibridge_vendor = tmp;
			RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
				 ("Pci Bridge Vendor is found index: %d\n",
				  tmp));
			break;
		}
	}

Thank you!
chaoming
Comment 8 Liao, Hubert 2011-07-29 05:16:31 UTC
(In reply to comment #7)
> Hi all:
> 
> Please add pcipriv->ndis_adapter.pcibridge_vendor =
> PCI_BRIDGE_VENDOR_UNKNOWN;
> and try again like this:
> 
>         pcipriv->ndis_adapter.pcibridge_vendorid = bridge_pdev->vendor;
>     pcipriv->ndis_adapter.pcibridge_vendor = PCI_BRIDGE_VENDOR_UNKNOWN;
>     for (tmp = 0; tmp < PCI_BRIDGE_VENDOR_MAX; tmp++) {
>         if (bridge_pdev->vendor == pcibridge_vendors[tmp]) {
>             pcipriv->ndis_adapter.pcibridge_vendor = tmp;
>             RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
>                  ("Pci Bridge Vendor is found index: %d\n",
>                   tmp));
>             break;
>         }
>     }
> 
> Thank you!
> chaoming

The problem is bridge_pdev is NULL, do this can't solve it.
Comment 9 Larry Finger 2011-07-29 16:02:17 UTC
The patch has been sent to John Linville with annotation for backporting to stable.
Comment 10 Larry Finger 2011-07-29 16:03:37 UTC
Created attachment 67112 [details]
Version of patch submitted upstream
Comment 11 Florian Mickler 2011-08-08 14:09:59 UTC
A patch referencing this bug report has been merged in Linux v3.1-rc1:

commit b6b67df3f24c45af0012ee3c8af2f62ca083ae18
Author: Larry Finger <Larry.Finger@lwfinger.net>
Date:   Fri Jul 29 10:53:12 2011 -0500

    rtlwifi: Fix kernel oops on ARM SOC

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