Skip to contentSkip to conversation

kernel 3.5.2/amd64: iwlwifi 0000:03:00.0: failed to allocate pci memory

DISCUSSION Marc MERLIN 5 participants 8 messages Sep 4, 2012 – Sep 13, 2012 7 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Howdy,

I currently rmmod iwlwifi before putting my laptop to sleep and reload it when coming back. Arguably, it's maybe not needed, but from time to time I hit this memory allocation failure below:

My kenrel config options are here
http://marc.merlins.org/tmp/config-3.5.2-amd64-preempt-noide-20120731

and this happens on an Lenovo T530.

dmesg:

[856806.443647] cfg80211: Calling CRDA to update world regulatory domain
[856806.448428] iwlwifi: Intel(R) Wireless WiFi Link AGN driver for Linux, in-tree:d
[856806.448431] iwlwifi: Copyright(c) 2003-2012 Intel Corporation
[856806.448929] cfg80211: World regulatory domain updated:
[856806.448931] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[856806.448933] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[856806.448941] cfg80211:   (2457000 KHz - 2482000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[856806.448942] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[856806.448943] cfg80211:   (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[856806.448945] cfg80211:   (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[856806.483929] iwlwifi 0000:03:00.0: pci_resource_len = 0x00002000
[856806.483932] iwlwifi 0000:03:00.0: pci_resource_base = ffffc900057bc000
[856806.483933] iwlwifi 0000:03:00.0: HW Revision ID = 0x3E
[856806.484004] iwlwifi 0000:03:00.0: irq 46 for MSI/MSI-X
[856806.497476] iwlwifi 0000:03:00.0: loaded firmware version 9.221.4.1 build 25532
[856806.497944] kworker/3:0: page allocation failure: order:5, mode:0xd0
[856806.497948] Pid: 17936, comm: kworker/3:0 Tainted: G        W  O 3.5.2-amd64-preempt-noide-20120731 #1
[856806.497949] Call Trace:
[856806.497959]  [<ffffffff810cf54c>] warn_alloc_failed+0x117/0x12c
[856806.497963]  [<ffffffff810d23af>] __alloc_pages_nodemask+0x6e3/0x792
[856806.497969]  [<ffffffff812b7f41>] ? pfn_to_dma_pte+0x116/0x15e
[856806.497976]  [<ffffffff810ff58b>] alloc_pages_current+0xcd/0xee
[856806.497979]  [<ffffffff810cecca>] __get_free_pages+0x9/0x45
[856806.497982]  [<ffffffff812ba67d>] intel_alloc_coherent+0x84/0xe7
[856806.497986]  [<ffffffff81085cf8>] ? arch_local_irq_save+0x15/0x1b
[856806.497999]  [<ffffffffa0b84afc>] iwl_ucode_callback+0xa49/0xc0d [iwlwifi]
[856806.498006]  [<ffffffff8128f100>] ? _request_firmware_prepare.isra.5+0x1bf/0x1bf
[856806.498010]  [<ffffffff8128f181>] request_firmware_work_func+0x81/0xb1
[856806.498014]  [<ffffffff81054b13>] process_one_work+0x16f/0x28e
[856806.498018]  [<ffffffff810555d5>] worker_thread+0xce/0x152
[856806.498021]  [<ffffffff81055507>] ? manage_workers.isra.24+0x16c/0x16c
[856806.498024]  [<ffffffff81058e3c>] kthread+0x86/0x8e
[856806.498029]  [<ffffffff813a0aa4>] kernel_thread_helper+0x4/0x10
[856806.498032]  [<ffffffff81058db6>] ? kthread_freezable_should_stop+0x3e/0x3e
[856806.498034]  [<ffffffff813a0aa0>] ? gs_change+0x13/0x13
[856806.498036] Mem-Info:
[856806.498037] Node 0 DMA per-cpu:
[856806.498039] CPU    0: hi:    0, btch:   1 usd:   0
[856806.498041] CPU    1: hi:    0, btch:   1 usd:   0
[856806.498042] CPU    2: hi:    0, btch:   1 usd:   0
[856806.498044] CPU    3: hi:    0, btch:   1 usd:   0
[856806.498045] Node 0 DMA32 per-cpu:
[856806.498047] CPU    0: hi:  186, btch:  31 usd:   0
[856806.498048] CPU    1: hi:  186, btch:  31 usd:   0
[856806.498050] CPU    2: hi:  186, btch:  31 usd:   0
[856806.498051] CPU    3: hi:  186, btch:  31 usd:   0
[856806.498052] Node 0 Normal per-cpu:
[856806.498054] CPU    0: hi:  186, btch:  31 usd:   0
[856806.498055] CPU    1: hi:  186, btch:  31 usd:   0
[856806.498057] CPU    2: hi:  186, btch:  31 usd:   0
[856806.498058] CPU    3: hi:  186, btch:  31 usd:   0
[856806.498062] active_anon:880341 inactive_anon:274439 isolated_anon:0
[856806.498062]  active_file:222778 inactive_file:228271 isolated_file:0
[856806.498062]  unevictable:1436 dirty:369 writeback:0 unstable:0
[856806.498062]  free:137592 slab_reclaimable:167927 slab_unreclaimable:17618
[856806.498062]  mapped:27053 shmem:29116 pagetables:23832 bounce:0
[856806.498065] Node 0 DMA free:15900kB min:132kB low:164kB high:196kB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:15676kB mlocked:0kB dirty:0kB writeback:0kB mapped:0kB shmem:0kB slab_reclaimable:0kB slab_unreclaimable:0kB kernel_stack:0kB pagetables:0kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? yes
[856806.498071] lowmem_reserve[]: 0 3257 7777 7777
[856806.498074] Node 0 DMA32 free:454560kB min:28252kB low:35312kB high:42376kB active_anon:1412512kB inactive_anon:513084kB active_file:333072kB inactive_file:323580kB unevictable:196kB isolated(anon):0kB isolated(file):0kB present:3335900kB mlocked:196kB dirty:108kB writeback:0kB mapped:43284kB shmem:27472kB slab_reclaimable:281024kB slab_unreclaimable:20952kB kernel_stack:4200kB pagetables:27640kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
[856806.498079] lowmem_reserve[]: 0 0 4519 4519
[856806.498083] Node 0 Normal free:79908kB min:39196kB low:48992kB high:58792kB active_anon:2108852kB inactive_anon:584672kB active_file:558040kB inactive_file:589504kB unevictable:5548kB isolated(anon):0kB isolated(file):0kB present:4627820kB mlocked:5548kB dirty:1368kB writeback:0kB mapped:64928kB shmem:88992kB slab_reclaimable:390684kB slab_unreclaimable:49520kB kernel_stack:3496kB pagetables:67688kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
[856806.498088] lowmem_reserve[]: 0 0 0 0
[856806.498090] Node 0 DMA: 1*4kB 1*8kB 1*16kB 0*32kB 2*64kB 1*128kB 1*256kB 0*512kB 1*1024kB 1*2048kB 3*4096kB = 15900kB
[856806.498098] Node 0 DMA32: 60562*4kB 25568*8kB 264*16kB 4*32kB 1*64kB 1*128kB 0*256kB 2*512kB 2*1024kB 0*2048kB 0*4096kB = 454408kB
[856806.498106] Node 0 Normal: 15497*4kB 861*8kB 162*16kB 79*32kB 22*64kB 4*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 1*4096kB = 80012kB
[856806.498115] 660922 total pagecache pages
[856806.498116] 180029 pages in swap cache
[856806.498118] Swap cache stats: add 7904087, delete 7724058, find 2010810/2392461
[856806.498119] Free swap  = 5831292kB
[856806.498121] Total swap = 10485756kB
[856806.520762] 2057712 pages RAM
[856806.520764] 63301 pages reserved
[856806.520765] 543630 pages shared
[856806.520766] 1544767 pages non-shared
[856806.520771] iwlwifi 0000:03:00.0: failed to allocate pci memory

It will typically fix itself and work again later.

Any ideas?

Thanks,
Marc

Signature · 4 lines
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems ....
                                      .... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/
#3 lore raw
In reply to a message not in the archive

Howdy,

I currently rmmod iwlwifi before putting my laptop to sleep and reload it when coming back. Arguably, it's maybe not needed, but from time to time I hit this memory allocation failure below.

I realize it's likely a memory fragmentation problem, but I have 8GB and plenty of 'free' space, so I'm hoping that somehow it can be defragmented enough for module loading ot work?

My kenrel config options are here
http://marc.merlins.org/tmp/config-3.5.2-amd64-preempt-noide-20120731

and this happens on an Lenovo T530

when it works:

[   13.494270] iwlwifi 0000:03:00.0: loaded firmware version 9.221.4.1 build 25532
[   13.494440] iwlwifi 0000:03:00.0: Detected Intel(R) Centrino(R) Ultimate-N 6300 AGN, REV=0x74

When it doesn't:

[856806.443647] cfg80211: Calling CRDA to update world regulatory domain
[856806.448428] iwlwifi: Intel(R) Wireless WiFi Link AGN driver for Linux, in-tree:d
[856806.448431] iwlwifi: Copyright(c) 2003-2012 Intel Corporation
[856806.448929] cfg80211: World regulatory domain updated:
[856806.448931] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[856806.448933] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[856806.448941] cfg80211:   (2457000 KHz - 2482000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[856806.448942] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[856806.448943] cfg80211:   (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[856806.448945] cfg80211:   (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[856806.483929] iwlwifi 0000:03:00.0: pci_resource_len = 0x00002000
[856806.483932] iwlwifi 0000:03:00.0: pci_resource_base = ffffc900057bc000
[856806.483933] iwlwifi 0000:03:00.0: HW Revision ID = 0x3E
[856806.484004] iwlwifi 0000:03:00.0: irq 46 for MSI/MSI-X
[856806.497476] iwlwifi 0000:03:00.0: loaded firmware version 9.221.4.1 build 25532
[856806.497944] kworker/3:0: page allocation failure: order:5, mode:0xd0
[856806.497948] Pid: 17936, comm: kworker/3:0 Tainted: G        W  O 3.5.2-amd64-preempt-noide-20120731 #1
[856806.497949] Call Trace:
[856806.497959]  [<ffffffff810cf54c>] warn_alloc_failed+0x117/0x12c
[856806.497963]  [<ffffffff810d23af>] __alloc_pages_nodemask+0x6e3/0x792
[856806.497969]  [<ffffffff812b7f41>] ? pfn_to_dma_pte+0x116/0x15e
[856806.497976]  [<ffffffff810ff58b>] alloc_pages_current+0xcd/0xee
[856806.497979]  [<ffffffff810cecca>] __get_free_pages+0x9/0x45
[856806.497982]  [<ffffffff812ba67d>] intel_alloc_coherent+0x84/0xe7
[856806.497986]  [<ffffffff81085cf8>] ? arch_local_irq_save+0x15/0x1b
[856806.497999]  [<ffffffffa0b84afc>] iwl_ucode_callback+0xa49/0xc0d [iwlwifi]
[856806.498006]  [<ffffffff8128f100>] ? _request_firmware_prepare.isra.5+0x1bf/0x1bf
[856806.498010]  [<ffffffff8128f181>] request_firmware_work_func+0x81/0xb1
[856806.498014]  [<ffffffff81054b13>] process_one_work+0x16f/0x28e
[856806.498018]  [<ffffffff810555d5>] worker_thread+0xce/0x152
[856806.498021]  [<ffffffff81055507>] ? manage_workers.isra.24+0x16c/0x16c
[856806.498024]  [<ffffffff81058e3c>] kthread+0x86/0x8e
[856806.498029]  [<ffffffff813a0aa4>] kernel_thread_helper+0x4/0x10
[856806.498032]  [<ffffffff81058db6>] ? kthread_freezable_should_stop+0x3e/0x3e
[856806.498034]  [<ffffffff813a0aa0>] ? gs_change+0x13/0x13
[856806.498036] Mem-Info:
[856806.498037] Node 0 DMA per-cpu:
[856806.498039] CPU    0: hi:    0, btch:   1 usd:   0
[856806.498041] CPU    1: hi:    0, btch:   1 usd:   0
[856806.498042] CPU    2: hi:    0, btch:   1 usd:   0
[856806.498044] CPU    3: hi:    0, btch:   1 usd:   0
[856806.498045] Node 0 DMA32 per-cpu:
[856806.498047] CPU    0: hi:  186, btch:  31 usd:   0
[856806.498048] CPU    1: hi:  186, btch:  31 usd:   0
[856806.498050] CPU    2: hi:  186, btch:  31 usd:   0
[856806.498051] CPU    3: hi:  186, btch:  31 usd:   0
[856806.498052] Node 0 Normal per-cpu:
[856806.498054] CPU    0: hi:  186, btch:  31 usd:   0
[856806.498055] CPU    1: hi:  186, btch:  31 usd:   0
[856806.498057] CPU    2: hi:  186, btch:  31 usd:   0
[856806.498058] CPU    3: hi:  186, btch:  31 usd:   0
[856806.498062] active_anon:880341 inactive_anon:274439 isolated_anon:0
[856806.498062]  active_file:222778 inactive_file:228271 isolated_file:0
[856806.498062]  unevictable:1436 dirty:369 writeback:0 unstable:0
[856806.498062]  free:137592 slab_reclaimable:167927 slab_unreclaimable:17618
[856806.498062]  mapped:27053 shmem:29116 pagetables:23832 bounce:0
[856806.498065] Node 0 DMA free:15900kB min:132kB low:164kB high:196kB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:15676kB mlocked:0kB dirty:0kB writeback:0kB mapped:0kB shmem:0kB slab_reclaimable:0kB slab_unreclaimable:0kB kernel_stack:0kB pagetables:0kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? yes
[856806.498071] lowmem_reserve[]: 0 3257 7777 7777
[856806.498074] Node 0 DMA32 free:454560kB min:28252kB low:35312kB high:42376kB active_anon:1412512kB inactive_anon:513084kB active_file:333072kB inactive_file:323580kB unevictable:196kB isolated(anon):0kB isolated(file):0kB present:3335900kB mlocked:196kB dirty:108kB writeback:0kB mapped:43284kB shmem:27472kB slab_reclaimable:281024kB slab_unreclaimable:20952kB kernel_stack:4200kB pagetables:27640kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
[856806.498079] lowmem_reserve[]: 0 0 4519 4519
[856806.498083] Node 0 Normal free:79908kB min:39196kB low:48992kB high:58792kB active_anon:2108852kB inactive_anon:584672kB active_file:558040kB inactive_file:589504kB unevictable:5548kB isolated(anon):0kB isolated(file):0kB present:4627820kB mlocked:5548kB dirty:1368kB writeback:0kB mapped:64928kB shmem:88992kB slab_reclaimable:390684kB slab_unreclaimable:49520kB kernel_stack:3496kB pagetables:67688kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
[856806.498088] lowmem_reserve[]: 0 0 0 0
[856806.498090] Node 0 DMA: 1*4kB 1*8kB 1*16kB 0*32kB 2*64kB 1*128kB 1*256kB 0*512kB 1*1024kB 1*2048kB 3*4096kB = 15900kB
[856806.498098] Node 0 DMA32: 60562*4kB 25568*8kB 264*16kB 4*32kB 1*64kB 1*128kB 0*256kB 2*512kB 2*1024kB 0*2048kB 0*4096kB = 454408kB
[856806.498106] Node 0 Normal: 15497*4kB 861*8kB 162*16kB 79*32kB 22*64kB 4*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 1*4096kB = 80012kB
[856806.498115] 660922 total pagecache pages
[856806.498116] 180029 pages in swap cache
[856806.498118] Swap cache stats: add 7904087, delete 7724058, find 2010810/2392461
[856806.498119] Free swap  = 5831292kB
[856806.498121] Total swap = 10485756kB
[856806.520762] 2057712 pages RAM
[856806.520764] 63301 pages reserved
[856806.520765] 543630 pages shared
[856806.520766] 1544767 pages non-shared
[856806.520771] iwlwifi 0000:03:00.0: failed to allocate pci memory

It will typically fix itself and work again later.

Any ideas?

Thanks,
Marc

Signature · 8 lines
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems ....
                                      .... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#5 lore raw
In reply to a message not in the archive
Quoted 22 lines · Marc MERLIN

I realize it's likely a memory fragmentation problem, but I have 8GB and plenty of 'free' space, so I'm hoping that somehow it can be defragmented enough for module loading ot work?

[856806.443647] cfg80211: Calling CRDA to update world regulatory domain
[856806.448428] iwlwifi: Intel(R) Wireless WiFi Link AGN driver for Linux, in-tree:d
[856806.448431] iwlwifi: Copyright(c) 2003-2012 Intel Corporation
[856806.448929] cfg80211: World regulatory domain updated:
[856806.448931] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[856806.448933] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[856806.448941] cfg80211:   (2457000 KHz - 2482000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[856806.448942] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[856806.448943] cfg80211:   (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[856806.448945] cfg80211:   (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[856806.483929] iwlwifi 0000:03:00.0: pci_resource_len = 0x00002000
[856806.483932] iwlwifi 0000:03:00.0: pci_resource_base = ffffc900057bc000
[856806.483933] iwlwifi 0000:03:00.0: HW Revision ID = 0x3E
[856806.484004] iwlwifi 0000:03:00.0: irq 46 for MSI/MSI-X
[856806.497476] iwlwifi 0000:03:00.0: loaded firmware version 9.221.4.1 build 25532
[856806.497944] kworker/3:0: page allocation failure: order:5, mode:0xd0
[856806.497948] Pid: 17936, comm: kworker/3:0 Tainted: G        W  O 3.5.2-amd64-preempt-noide-20120731 #1
[856806.497949] Call Trace:
Quoted 8 lines
[856806.497959]  [<ffffffff810cf54c>] warn_alloc_failed+0x117/0x12c
[856806.497963]  [<ffffffff810d23af>] __alloc_pages_nodemask+0x6e3/0x792
[856806.497969]  [<ffffffff812b7f41>] ? pfn_to_dma_pte+0x116/0x15e
[856806.497976]  [<ffffffff810ff58b>] alloc_pages_current+0xcd/0xee
[856806.497979]  [<ffffffff810cecca>] __get_free_pages+0x9/0x45
[856806.497982]  [<ffffffff812ba67d>] intel_alloc_coherent+0x84/0xe7
[856806.497986]  [<ffffffff81085cf8>] ? arch_local_irq_save+0x15/0x1b
[856806.497999]  [<ffffffffa0b84afc>] iwl_ucode_callback+0xa49/0xc0d [iwlwifi]

Yes, unfortunately we need a whole bunch of contiguous memory to load the firmware.

Quoted 1 line

Any ideas?

Nothing we can do from the driver side, I'm afraid.

johannes

#7 lore raw
In reply to a message not in the archive
Quoted 9 lines · Johannes Berg
Quoted 8 lines
[856806.497959]  [<ffffffff810cf54c>] warn_alloc_failed+0x117/0x12c
[856806.497963]  [<ffffffff810d23af>] __alloc_pages_nodemask+0x6e3/0x792
[856806.497969]  [<ffffffff812b7f41>] ? pfn_to_dma_pte+0x116/0x15e
[856806.497976]  [<ffffffff810ff58b>] alloc_pages_current+0xcd/0xee
[856806.497979]  [<ffffffff810cecca>] __get_free_pages+0x9/0x45
[856806.497982]  [<ffffffff812ba67d>] intel_alloc_coherent+0x84/0xe7
[856806.497986]  [<ffffffff81085cf8>] ? arch_local_irq_save+0x15/0x1b
[856806.497999]  [<ffffffffa0b84afc>] iwl_ucode_callback+0xa49/0xc0d [iwlwifi]
Quoted 6 lines

Yes, unfortunately we need a whole bunch of contiguous memory to load the firmware.

Quoted 1 line

Any ideas?

Nothing we can do from the driver side, I'm afraid.

Turns out I was wrong. Here's a patch you can test. Note that we still need a lot of DMA-coherent memory for other things, but at least for the firmware image we don't.

http://p.sipsolutions.net/11ea33b376a5bac5.txt

johannes

#9 lore raw
In reply to a message not in the archive
Quoted 16 lines · Johannes Berg
Quoted 14 lines · Johannes Berg
Quoted 8 lines
[856806.497959]  [<ffffffff810cf54c>] warn_alloc_failed+0x117/0x12c
[856806.497963]  [<ffffffff810d23af>] __alloc_pages_nodemask+0x6e3/0x792
[856806.497969]  [<ffffffff812b7f41>] ? pfn_to_dma_pte+0x116/0x15e
[856806.497976]  [<ffffffff810ff58b>] alloc_pages_current+0xcd/0xee
[856806.497979]  [<ffffffff810cecca>] __get_free_pages+0x9/0x45
[856806.497982]  [<ffffffff812ba67d>] intel_alloc_coherent+0x84/0xe7
[856806.497986]  [<ffffffff81085cf8>] ? arch_local_irq_save+0x15/0x1b
[856806.497999]  [<ffffffffa0b84afc>] iwl_ucode_callback+0xa49/0xc0d [iwlwifi]

Yes, unfortunately we need a whole bunch of contiguous memory to load the firmware.

Quoted 1 line

Any ideas?

Quoted 7 lines
Quoted 1 line

Nothing we can do from the driver side, I'm afraid.

Turns out I was wrong. Here's a patch you can test. Note that we still need a lot of DMA-coherent memory for other things, but at least for the firmware image we don't.

http://p.sipsolutions.net/11ea33b376a5bac5.txt

That patch looks like a good way to solve the problem; however, some architectures need an explicit "#include <linux/vmalloc.h>" somewhere in the headers, even though x86 does not, and I did not see it in the patch. I didn't do a lot of checking, but grep did not find one in the existing code.

Larry

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#11 lore raw
In reply to a message not in the archive
Quoted 14 lines · Johannes Berg
Quoted 12 lines · Johannes Berg
Quoted 8 lines
[856806.497959]  [<ffffffff810cf54c>] warn_alloc_failed+0x117/0x12c
[856806.497963]  [<ffffffff810d23af>] __alloc_pages_nodemask+0x6e3/0x792
[856806.497969]  [<ffffffff812b7f41>] ? pfn_to_dma_pte+0x116/0x15e
[856806.497976]  [<ffffffff810ff58b>] alloc_pages_current+0xcd/0xee
[856806.497979]  [<ffffffff810cecca>] __get_free_pages+0x9/0x45
[856806.497982]  [<ffffffff812ba67d>] intel_alloc_coherent+0x84/0xe7
[856806.497986]  [<ffffffff81085cf8>] ? arch_local_irq_save+0x15/0x1b
[856806.497999]  [<ffffffffa0b84afc>] iwl_ucode_callback+0xa49/0xc0d [iwlwifi]

Yes, unfortunately we need a whole bunch of contiguous memory to load the firmware.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Any ideas?

Nothing we can do from the driver side, I'm afraid.

Turns out I was wrong. Here's a patch you can test. Note that we still need a lot of DMA-coherent memory for other things, but at least for the firmware image we don't.

Thanks for that, I'll try it out and report back if I have other problems (it's hard to prove that it worked since I don't have the fragmented memory right away).

Marc

Signature · 8 lines
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems ....
                                      .... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/  
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#10 lore raw
In reply to Larry Finger
Quoted 6 lines · Larry Finger
Quoted 1 line

http://p.sipsolutions.net/11ea33b376a5bac5.txt

That patch looks like a good way to solve the problem; however, some architectures need an explicit "#include <linux/vmalloc.h>" somewhere in the headers, even though x86 does not, and I did not see it in the patch. I didn't do a lot of checking, but grep did not find one in the existing code.

Thanks for that, I added the include.

johannes

#14 lore raw
In reply to a message not in the archive
Quoted 9 lines · Johannes Berg
Quoted 5 lines

but http://p.sipsolutions.net/11ea33b376a5bac5.txt
refers to drivers/net/wireless/iwlwifi/dvm/ucode.c

Obviously I can fix pathnames by hand, but jus wanted to make sure I'm doing the right thing before doing that.

That'll probably just work. I may also erroneously have included dvm16/... changes that are internal only, so you won't have to worry about that file.

I had to port the patch back to my 3.5.3 kernel and since then I haven't hany firmware loading failures, thanks much.

I'll attach the patch below in case it helps others.

Thanks for your help,
Marc

Signature · 4 lines
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems ....
                                      .... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/  
iwl-drv.c +13 -12
diff -urN .iwlwifi/iwl-drv.c iwlwifi/iwl-drv.c
@@ -116,10 +116,8 @@
 
 static void iwl_free_fw_desc(struct iwl_drv *drv, struct fw_desc *desc)
 {
-	if (desc->v_addr)
-		dma_free_coherent(drv->trans->dev, desc->len,
-				  desc->v_addr, desc->p_addr);
-	desc->v_addr = NULL;
+	vfree(desc->data);
+	desc->data = NULL;
 	desc->len = 0;
 }
 
@@ -138,21 +136,24 @@
 }
 
 static int iwl_alloc_fw_desc(struct iwl_drv *drv, struct fw_desc *desc,
-		      struct fw_sec *sec)
+			     struct fw_sec *sec)
 {
-	if (!sec || !sec->size) {
-		desc->v_addr = NULL;
+	void *data;
+
+	desc->data = NULL;
+
+	if (!sec || !sec->size)
 		return -EINVAL;
-	}
 
-	desc->v_addr = dma_alloc_coherent(drv->trans->dev, sec->size,
-					  &desc->p_addr, GFP_KERNEL);
-	if (!desc->v_addr)
+	data = vmalloc(sec->size);
+	if (!data)
 		return -ENOMEM;
 
 	desc->len = sec->size;
 	desc->offset = sec->offset;
-	memcpy(desc->v_addr, sec->data, sec->size);
+	memcpy(data, sec->data, desc->len);
+	desc->data = data;
+
 	return 0;
 }
 
iwl-fw.h +1 -2
diff -urN .iwlwifi/iwl-fw.h iwlwifi/iwl-fw.h
@@ -124,8 +124,7 @@
 
 /* one for each uCode image (inst/data, init/runtime/wowlan) */
 struct fw_desc {
-	dma_addr_t p_addr;	/* hardware address */
-	void *v_addr;		/* software address */
+	const void *data;	/* vmalloc'ed data */
 	u32 len;		/* size in bytes */
 	u32 offset;		/* offset in the device */
 };
iwl-trans-pcie.c +41 -12

88 lines not on this page · raw message

iwl-ucode.c +2 -2
diff -urN .iwlwifi/iwl-ucode.c iwlwifi/iwl-ucode.c
@@ -270,7 +270,7 @@
 static int iwl_verify_sec_sparse(struct iwl_priv *priv,
 				  const struct fw_desc *fw_desc)
 {
-	__le32 *image = (__le32 *)fw_desc->v_addr;
+	__le32 *image = (__le32 *)fw_desc->data;
 	u32 len = fw_desc->len;
 	u32 val;
 	u32 i;
@@ -294,7 +294,7 @@
 static void iwl_print_mismatch_sec(struct iwl_priv *priv,
 				    const struct fw_desc *fw_desc)
 {
-	__le32 *image = (__le32 *)fw_desc->v_addr;
+	__le32 *image = (__le32 *)fw_desc->data;
 	u32 len = fw_desc->len;
 	u32 val;
 	u32 offs;