1. 程式人生 > >linux 核心修改解析度後出現的WARNING解決方法

linux 核心修改解析度後出現的WARNING解決方法

將解析度由800x480改為1280x800後 出現瞭如下警告

[   21.581886] ------------[ cut here ]------------
[   21.581907] WARNING: at mm/page_alloc.c:2121 __alloc_pages_nodemask+0x468/0x63c()
[   21.581914] Modules linked in:
[   21.581940] [<c0040b28>] (unwind_backtrace+0x0/0xfc) from [<c005aed4>] (warn_slowpath_common+0x54/0x64)
[   21.581957] [<c005aed4>] (warn_slowpath_common+0x54/0x64) from [<c005af00>] (warn_slowpath_null+0x1c/0x24)
[   21.581971] [<c005af00>] (warn_slowpath_null+0x1c/0x24) from [<c00a9d24>] (__alloc_pages_nodemask+0x468/0x63c)
[   21.581986] [<c00a9d24>] (__alloc_pages_nodemask+0x468/0x63c) from [<c00419f8>] (__dma_alloc+0x8c/0x3bc)
[   21.581999] [<c00419f8>] (__dma_alloc+0x8c/0x3bc) from [<c0041d4c>] (dma_alloc_writecombine+0x24/0x2c)
[   21.582016] [<c0041d4c>] (dma_alloc_writecombine+0x24/0x2c) from [<c02791ec>] (s3cfb_map_video_memory+0xac/0x174)
[   21.582031] [<c02791ec>] (s3cfb_map_video_memory+0xac/0x174) from [<c02799f4>] (s3cfb_set_par+0x58/0xc0)
[   21.582050] [<c02799f4>] (s3cfb_set_par+0x58/0xc0) from [<c0271250>] (fb_set_var+0x168/0x2a4)
[   21.582065] [<c0271250>] (fb_set_var+0x168/0x2a4) from [<c0271748>] (do_fb_ioctl+0x3bc/0x5f4)
[   21.582079] [<c0271748>] (do_fb_ioctl+0x3bc/0x5f4) from [<c00e2aac>] (do_vfs_ioctl+0x80/0x5fc)
[   21.582092] [<c00e2aac>] (do_vfs_ioctl+0x80/0x5fc) from [<c00e3060>] (sys_ioctl+0x38/0x60)
[   21.582108] [<c00e3060>] (sys_ioctl+0x38/0x60) from [<c003ab00>] (ret_fast_syscall+0x0/0x30)
[   21.582117] ---[ end trace d22d266c12264dc9 ]---

出現這個必不會影響顯示 還是覺得不妥 以前也出現過這個問題也去管 這次就跟蹤下吧

不知道你們看不看的了 我把原文貼在下面

問題

Hello,

I'm using dma_alloc_writecombine() to allocate memory in my framebuffer
device driver just like many other drivers do.

Now I have a new panel with a higher resolution and more bits-per-pixel.
I want to use double-buffering with DirectFB and so my framebuffer size
exceeds 4Mb.

Even though my embedded system has plenty of memory, now I receive the
following warning and the allocation fails:

WARNING: at /home/teemhu/mcu/has/topas/mm/page_alloc.c:2012
__alloc_pages_nodemask+0x444/0x650()

This is due to the following check in __alloc_pages_slowpath():
	if (order >= MAX_ORDER) {
		WARN_ON_ONCE(!(gfp_mask & __GFP_NOWARN));
		return NULL;
	}

Because MAX_ORDER is 11, only memory chunks of size (PAGE_SIZE <<
MAX_ORDER_NR_PAGES) = 4Mb can be allocated.

Apparently this topic has come up when using the OMAP DSS already:
http://www.spinics.net/lists/linux-omap/msg08124.html

Another user has asked this question on the linuxfb-dev mailing list in
October 2010, but did not receive an answer:
http://www.spinics.net/lists/linux-fbdev/msg01745.html
出現這個問題的原因
DMA memory allocation is limited to 4MB
大小定義說明
#define CONFIG_FORCE_MAX_ZONEORDER 12

 

By default, MAX_ORDER is 11 which means the biggest memory chunk is: PAGE_SIZE * 2 ^( FORCE_MAX_ZONEORDER - 1)

= 4K * 1 K = 4M.
最後解決方法直接將
MAX_ORDER
改大

在標頭檔案include/linux/mmzone.h裡定義了MAX_ORDER

首先確定下有沒有定義FORCE_MAX_ZONEORDER

我的裡面定義了FORCE_MAX_ZONEORDER但是make menuconfig裡直接改不了FORCE_MAX_ZONEORDER在

arch/arm/Kconfig定義直接把default改成 然後make menuconfig儲存 確認下.config這個引數是不是改了 編譯下載

問題解決