Bug 81991

Summary: X page allocation errors referencing radeon_vm_get_bos
Product: DRI Reporter: fixitup
Component: DRM/RadeonAssignee: Default DRI bug account <dri-devel>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: XOrg git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
Kernel config file, vanilla kernel 3.15.6
none
drm/radeon: Use drm_malloc_ab instead of kmalloc_array none

Description fixitup 2014-08-01 05:12:51 UTC
Created attachment 103787 [details]
Kernel config file, vanilla kernel 3.15.6

System is quad-core:
processor       : 0
vendor_id       : AuthenticAMD
cpu family      : 16
model           : 4
model name      : AMD Phenom(tm) II X4 945 Processor
stepping        : 3
microcode       : 0x10000c8
cpu MHz         : 3000.000
cache size      : 512 KB
physical id     : 0
siblings        : 4
core id         : 0
cpu cores       : 4
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 5
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good nopl nonstop_tsc extd_apicid pni monitor cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt nodeid_msr hw_pstate npt lbrv svm_lock nrip_save
bogomips        : 6020.00
TLB size        : 1024 4K pages
clflush size    : 64
cache_alignment : 64
address sizes   : 48 bits physical, 48 bits virtual
power management: ts ttp tm stc 100mhzsteps hwpstate

Linux heartofgold 3.15.6_cartis_heartofgold #1 SMP PREEMPT Mon Jul 28 02:19:28 CDT 2014 x86_64 AMD Phenom(tm) II X4 945 Processor AuthenticAMD GNU/Linux

Slackware 14.1 x86_64 base packages but I believe I have an updated libdrm 2.4.54.  Also updated Mesa to 10.1.4, glamor a4fbc77 from 2014-03-02.  Video card is a Radeon HD 7950 (Tahiti).

This problem appears to happen when I am running guest vm's on this system with qemu 2.0.0.  My system does have an IOMMU enabled.  I don't believe that the error occurs when no guest OS is running on the system.

[329020.778132] X: page allocation failure: order:4, mode:0x1040d0
[329020.778138] CPU: 3 PID: 1583 Comm: X Not tainted 3.15.6_cartis_heartofgold #1
[329020.778139] Hardware name: System manufacturer System Product Name/M4A89TD PRO USB3, BIOS 3029    09/07/2012
[329020.778141]  ffff8800cb9f7848 ffffffff814ead3d 00000000001040d0 ffffffff810d4477
[329020.778143]  0000000000000000 ffff88022fffd900 0000000000000003 00000000ffffffff
[329020.778145]  0000000000000001 ffffffff810e6edc ffff88022fffd908 0000000000000002
[329020.778147] Call Trace:
[329020.778153]  [<ffffffff814ead3d>] ? dump_stack+0x49/0x6a
[329020.778157]  [<ffffffff810d4477>] ? warn_alloc_failed+0xd7/0x130
[329020.778160]  [<ffffffff810e6edc>] ? next_online_pgdat+0x1c/0x40
[329020.778162]  [<ffffffff810d7ac5>] ? __alloc_pages_nodemask+0x8e5/0xb10
[329020.778165]  [<ffffffff8110fe30>] ? alloc_pages_current+0xb0/0x180
[329020.778167]  [<ffffffff810d3745>] ? __get_free_pages+0x5/0x40
[329020.778188]  [<ffffffffa03a8706>] ? radeon_vm_get_bos+0x26/0x110 [radeon]
[329020.778198]  [<ffffffffa031129f>] ? radeon_cs_parser_relocs+0x37f/0x3e0 [radeon]
[329020.778209]  [<ffffffffa0311be3>] ? radeon_cs_ioctl+0x1c3/0x6c0 [radeon]
[329020.778216]  [<ffffffffa024b88f>] ? drm_ioctl+0x20f/0x5f0 [drm]
[329020.778219]  [<ffffffff810981ec>] ? do_futex+0xfc/0xa90
[329020.778226]  [<ffffffffa02e1052>] ? radeon_drm_ioctl+0x52/0x90 [radeon]
[329020.778230]  [<ffffffff81141377>] ? do_vfs_ioctl+0x2c7/0x490
[329020.778231]  [<ffffffff81098bfc>] ? SyS_futex+0x7c/0x170
[329020.778234]  [<ffffffff8114af11>] ? __fget+0x71/0xb0
[329020.778236]  [<ffffffff81141587>] ? SyS_ioctl+0x47/0xa0
[329020.778238]  [<ffffffff814f0826>] ? system_call_fastpath+0x1a/0x1f
[329020.778240] Mem-Info:
[329020.778241] Node 0 DMA per-cpu:
[329020.778243] CPU    0: hi:    0, btch:   1 usd:   0
[329020.778244] CPU    1: hi:    0, btch:   1 usd:   0
[329020.778245] CPU    2: hi:    0, btch:   1 usd:   0
[329020.778246] CPU    3: hi:    0, btch:   1 usd:   0
[329020.778246] Node 0 DMA32 per-cpu:
[329020.778248] CPU    0: hi:  186, btch:  31 usd:   0
[329020.778249] CPU    1: hi:  186, btch:  31 usd:   0
[329020.778250] CPU    2: hi:  186, btch:  31 usd:   0
[329020.778251] CPU    3: hi:  186, btch:  31 usd:   0
[329020.778252] Node 0 Normal per-cpu:
[329020.778253] CPU    0: hi:  186, btch:  31 usd:  50
[329020.778254] CPU    1: hi:  186, btch:  31 usd:   0
[329020.778255] CPU    2: hi:  186, btch:  31 usd:   0
[329020.778256] CPU    3: hi:  186, btch:  31 usd:   0
[329020.778259] active_anon:1230097 inactive_anon:283289 isolated_anon:0
[329020.778259]  active_file:175253 inactive_file:174618 isolated_file:0
[329020.778259]  unevictable:1 dirty:2209 writeback:0 unstable:0
[329020.778259]  free:57635 slab_reclaimable:75023 slab_unreclaimable:10560
[329020.778259]  mapped:53166 shmem:13460 pagetables:13314 bounce:0
[329020.778259]  free_cma:0
[329020.778262] Node 0 DMA free:15880kB min:128kB low:160kB high:192kB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:15976kB managed:15892kB mlocked:0kB dirty:0kB writeback:0kB mapped:0kB shmem:0kB slab_reclaimable:0kB slab_unreclaimable:8kB kernel_stack:0kB pagetables:0kB unstable:0kB bounce:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? yes
[329020.778266] lowmem_reserve[]: 0 3238 7973 7973
[329020.778268] Node 0 DMA32 free:114980kB min:27392kB low:34240kB high:41088kB active_anon:1967220kB inactive_anon:532236kB active_file:258644kB inactive_file:266524kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:3389952kB managed:3316652kB mlocked:0kB dirty:7864kB writeback:0kB mapped:89232kB shmem:24008kB slab_reclaimable:121184kB slab_unreclaimable:16256kB kernel_stack:3728kB pagetables:21720kB unstable:0kB bounce:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
[329020.778272] lowmem_reserve[]: 0 0 4734 4734
[329020.778274] Node 0 Normal free:99680kB min:40056kB low:50068kB high:60084kB active_anon:2953168kB inactive_anon:600920kB active_file:442368kB inactive_file:431948kB unevictable:4kB isolated(anon):0kB isolated(file):0kB present:4980736kB managed:4848600kB mlocked:4kB dirty:972kB writeback:0kB mapped:123432kB shmem:29832kB slab_reclaimable:178908kB slab_unreclaimable:25976kB kernel_stack:5840kB pagetables:31536kB unstable:0kB bounce:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:25 all_unreclaimable? no
[329020.778278] lowmem_reserve[]: 0 0 0 0
[329020.778279] Node 0 DMA: 0*4kB 1*8kB (U) 0*16kB 0*32kB 2*64kB (U) 1*128kB (U) 1*256kB (U) 0*512kB 1*1024kB (U) 1*2048kB (R) 3*4096kB (M) = 15880kB
[329020.778286] Node 0 DMA32: 8502*4kB (UEM) 6303*8kB (UEM) 1642*16kB (UEM) 129*32kB (UEM) 5*64kB (UM) 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 115152kB
[329020.778292] Node 0 Normal: 23477*4kB (UEM) 738*8kB (UEM) 12*16kB (UM) 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 100004kB
[329020.778298] Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=2048kB
[329020.778299] 364887 total pagecache pages
[329020.778300] 1611 pages in swap cache
[329020.778301] Swap cache stats: add 84213, delete 82602, find 34314/36120
[329020.778302] Free swap  = 16560880kB
[329020.778303] Total swap = 16884200kB
[329020.778304] 2096666 pages RAM
[329020.778305] 0 pages HighMem/MovableOnly
[329020.778306] 33034 pages reserved


# lsmod 
Module                  Size  Used by
vringh                  8727  0 
vhost_scsi             17503  0 
target_core_mod       226734  1 vhost_scsi
configfs               21698  2 target_core_mod
vhost_net               8323  1 
vhost                  13934  2 vhost_net,vhost_scsi
macvtap                10278  1 vhost_net
macvlan                 9165  1 macvtap
kvm_amd                46027  4 
kvm                   278165  1 kvm_amd
fuse                   78369  3 
nfsv3                  23809  1 
nfs_acl                 2567  1 nfsv3
nfs                   117564  3 nfsv3
lockd                  60420  2 nfs,nfsv3
sunrpc                178844  21 nfs,lockd,nfsv3,nfs_acl
uinput                  8261  1 
bridge                 72610  0 
stp                     1477  1 bridge
llc                     3393  2 stp,bridge
ipv6                  322917  47 bridge
i2c_dev                 5380  0 
dm_mod                 78720  6 
uvcvideo               69150  0 
videobuf2_vmalloc       2616  1 uvcvideo
videobuf2_memops        1775  1 videobuf2_vmalloc
videobuf2_core         29529  1 uvcvideo
snd_usb_audio         116908  2 
videodev              105637  2 uvcvideo,videobuf2_core
snd_usbmidi_lib        19012  1 snd_usb_audio
snd_hwdep               5740  1 snd_usb_audio
snd_rawmidi            17182  1 snd_usbmidi_lib
snd_seq_device          4908  1 snd_rawmidi
usb_storage            46004  0 
sr_mod                 14546  0 
cdrom                  34305  1 sr_mod
ata_generic             3418  0 
radeon               1278800  4 
ttm                    59721  1 radeon
fbcon                  37322  71 
bitblit                 4721  1 fbcon
softcursor              1189  1 bitblit
font                    7372  1 fbcon
drm_kms_helper         30503  1 radeon
drm                   225400  7 ttm,drm_kms_helper,radeon
agpgart                26244  2 drm,ttm
cfbfillrect             3634  1 radeon
cfbimgblt               1991  1 radeon
snd_ctxfi              85898  7 
cfbcopyarea             3142  1 radeon
i2c_algo_bit            5023  1 radeon
asus_atk0110            7625  0 
backlight               5638  1 radeon
fb                     49862  5 fbcon,drm_kms_helper,radeon,softcursor,bitblit
snd_pcm                71866  6 snd_usb_audio,snd_ctxfi
snd_timer              17935  2 snd_pcm
ohci_pci                2896  0 
xhci_hcd               97994  0 
ohci_hcd               19566  1 ohci_pci
ehci_pci                3296  0 
ehci_hcd               41436  1 ehci_pci
k10temp                 2906  0 
fbdev                    750  2 fb,fbcon
ahci                   23419  0 
r8169                  55423  0 
firewire_ohci          30581  0 
libahci                20828  1 ahci
firewire_core          49708  1 firewire_ohci
snd                    43711  21 snd_usb_audio,snd_ctxfi,snd_hwdep,snd_timer,snd_pcm,snd_rawmidi,snd_usbmidi_lib,snd_seq_device
serio_raw               4289  0 
i2c_piix4               8488  0 
i2c_core               20478  7 drm,i2c_dev,i2c_piix4,drm_kms_helper,i2c_algo_bit,radeon,videodev
soundcore                864  1 snd
mii                     3819  1 r8169
pata_jmicron            2443  0 
crc_itu_t               1283  1 firewire_core
hwmon                   2834  3 asus_atk0110,k10temp,radeon
acpi_cpufreq            6471  1 
wmi                     8011  0 
loop                   18568  0
Comment 1 Alex Deucher 2014-08-01 13:19:18 UTC
This is a kernel out of memory error not a driver bug.  The driver is not able to allocate the memory it needs.
Comment 2 Michel Dänzer 2014-08-01 14:35:50 UTC
(In reply to comment #1)
> This is a kernel out of memory error not a driver bug.  The driver is not
> able to allocate the memory it needs.

That may be technically true, but order 4 means 16 physically contiguous pages IIUC, which may be difficult for the kernel to provide. We can avoid this by making radeon_vm_get_bos() allocate each list node separately instead of a single large array for all of them.
Comment 3 Michel Dänzer 2014-10-17 03:25:49 UTC
Created attachment 107967 [details]
drm/radeon: Use drm_malloc_ab instead of kmalloc_array

Does this patch fix the problem?
Comment 4 Michel Dänzer 2016-01-29 07:24:59 UTC
I think this was fixed long ago.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.