Skip to contentSkip to conversation

WARNING: at drivers/pci/pci-sysfs.c:758 pci_mmap_resource+0x133/0x190()

Regression Maciej Rutecki 3 participants 5 messages Nov 17, 2010 – Nov 18, 2010

lore
Share & tools
lore
#0 lore raw

Last known good: 2.6.37-rc1
Bad kernel: 2.6.37-rc2
Hardware: VirtualBox

Description: cannot run Xwindow, booting hangs on this kernel message:

[  143.502215] ------------[ cut here ]------------                                                              
[  143.503050] WARNING: at drivers/pci/pci-sysfs.c:758 
pci_mmap_resource+0x133/0x190()                           
[  143.523361] Hardware name: VirtualBox                                                                         
[  143.523387] process "Xorg" tried to map 0x02000000 bytes at page 0x00000000 
on 0000:00:02.0 BAR 0 (start 0x   
[  143.523408] Modules linked in: fuse loop sha256_generic aes_i586 
aes_generic cbc dm_crypt dm_mod ohci_hcd ehci
[  143.523823] Pid: 1665, comm: Xorg Not tainted 2.6.37-rc2 #1                                                   
[  143.523843] Call Trace:                                                                                       
[  143.523878]  [<c0137f9d>] warn_slowpath_common+0x6d/0xa0                                                      
[  143.523898]  [<c0281c83>] ? pci_mmap_resource+0x133/0x190                                                     
[  143.523916]  [<c0281c83>] ? pci_mmap_resource+0x133/0x190                                                     
[  143.523935]  [<c013804e>] warn_slowpath_fmt+0x2e/0x30                                                         
[  143.523953]  [<c0281c83>] pci_mmap_resource+0x133/0x190                                                       
[  143.523972]  [<c0281ce0>] ? pci_mmap_resource_uc+0x0/0x20                                                     
[  143.524000]  [<c0281cf9>] pci_mmap_resource_uc+0x19/0x20                                                      
[  143.526472]  [<c020eba2>] mmap+0x62/0x100                                                                     
[  143.526501]  [<c01ac52f>] mmap_region+0x2bf/0x410                                                             
[  143.526522]  [<c01ac8dc>] do_mmap_pgoff+0x25c/0x300                                                           
[  143.526541]  [<c01aca17>] sys_mmap_pgoff+0x97/0x130                                                           
[  143.526569]  [<c03dbd11>] syscall_call+0x7/0xb                                                                
[  143.526584] ---[ end trace 57cafb32c03e0f5f ]---

Bisection shows:
3b519e4ea618b6943a82931630872907f9ac2c2b is the first bad commit commit 3b519e4ea618b6943a82931630872907f9ac2c2b

Author: Martin Wilck <[email protected]>                                                               
Date:   Wed Nov 10 11:03:21 2010 +0100                                                                           

PCI: fix size checks for mmap() on /proc/bus/pci files

The checks for valid mmaps of PCI resources made through /proc/bus/pci
files

    that were introduced in 9eff02e2042f96fb2aedd02e032eca1c5333d767 have 

several
problems:

1. mmap() calls on /proc/bus/pci files are made with real file offsets >
0,
whereas under /sys/bus/pci/devices, the start of the resource corresponds to offset 0. This may lead to false negatives in pci_mmap_fits(), which implicitly assumes the /sys/bus/pci/devices layout.

2. The loop in proc_bus_pci_mmap doesn't skip empty resouces. This leads to false positives, because pci_mmap_fits() doesn't treat empty resources correctly (the calculated size is 1 << (8*sizeof(resource_size_t)-
PAGE_SHIFT)
in this case!).

3. If a user maps resources with BAR > 0, pci_mmap_fits will emit bogus WARNINGS for the first resources that don't fit until the correct one is
found.

On many controllers the first 2-4 BARs are used, and the others are empty. In this case, an mmap attempt will first fail on the non-empty BARs (including the "right" BAR because of 1.) and emit bogus WARNINGS because of 3., and finally succeed on the first empty BAR because of 2. This is certainly not the intended behaviour.

This patch addresses all 3 issues.
Updated with an enum type for the additional parameter for pci_mmap_fits().

040000 040000 73eda4a589e4b0da691202a36ec4b7e38f635c64
2dd7820cdcff8b2d1e23d990eee7a5832a356c38 M drivers

Full dmesg:
http://unixy.pl/maciek/download/kernel/2.6.37-rc2/vbox/dmesg-2.6.37-rc2.txt

Config:
http://unixy.pl/maciek/download/kernel/2.6.37-rc2/vbox/config-2.6.37-rc2

lspci:
http://unixy.pl/maciek/download/kernel/2.6.37-rc2/vbox/lspci.txt

Regards

Signature · 2 lines
Maciej Rutecki
http://www.maciek.unixy.pl
#1 lore raw
Quoted 3 lines · On Wed, 17 Nov 2010 21:53:10 +0100 Maciej Rutecki <[email protected]>…

Last known good: 2.6.37-rc1
Bad kernel: 2.6.37-rc2
Hardware: VirtualBox

Should be fixed in master now, please re-test.

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
#2 lore raw
Quoted 8 lines · Jesse Barnes
Quoted 3 lines · On Wed, 17 Nov 2010 21:53:10 +0100 Maciej Rutecki <[email protected]>…

Last known good: 2.6.37-rc1
Bad kernel: 2.6.37-rc2
Hardware: VirtualBox

Should be fixed in master now, please re-test.

We also had this reported in Ubuntu[1], I have applied the commit you suggested to the Ubuntu kernel and have confirmed that this is resolved for my reporters:

commit 8c05cd08a7504b855c265263e84af61aabafa329
Author: Darrick J. Wong <[email protected]>
Date: Tue Nov 16 09:13:41 2010 -0800

PCI: fix offset check for sysfs mmapped files

-apw

[1] http://bugs.launchpad.net/bugs/676963

#3 lore raw
In reply to Jesse Barnes
Quoted 8 lines · On środa, 17 listopada 2010 o 22:00:18 Jesse Barnes wrote:

On Wed, 17 Nov 2010 21:53:10 +0100

Quoted 3 lines · Maciej Rutecki

Last known good: 2.6.37-rc1
Bad kernel: 2.6.37-rc2
Hardware: VirtualBox

Should be fixed in master now, please re-test.

Yes, update to latest kernel tree, and kernel works OK.

Thanks

Signature · 2 lines
Maciej Rutecki
http://www.maciek.unixy.pl
#4 lore raw
Quoted 11 lines · On Thu, 18 Nov 2010 18:28:11 +0100 Maciej Rutecki <[email protected]>…
Quoted 8 lines · On środa, 17 listopada 2010 o 22:00:18 Jesse Barnes wrote:

On Wed, 17 Nov 2010 21:53:10 +0100

Quoted 3 lines · Maciej Rutecki

Last known good: 2.6.37-rc1
Bad kernel: 2.6.37-rc2
Hardware: VirtualBox

Should be fixed in master now, please re-test.

Yes, update to latest kernel tree, and kernel works OK.

Great, thanks for confirming.

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center