免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
1234下一页
最近访问板块 发新帖
查看: 7715 | 回复: 33
打印 上一主题 下一主题

[内存管理] 关于DMA zone的疑问 [复制链接]

论坛徽章:
4
酉鸡
日期:2014-03-21 23:19:50狮子座
日期:2014-08-01 22:11:40酉鸡
日期:2015-01-10 21:31:442015年辞旧岁徽章
日期:2015-03-03 16:54:15
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-04-21 13:41 |只看该作者 |倒序浏览
本帖最后由 chishanmingshen 于 2013-04-21 13:43 编辑

3G到3G+8M是内核映像,3G到3G+16M是dma区间。

(只考虑简单的32位系统,可以仅考虑UP。)

这个理解对么?请大家指点。谢谢!

论坛徽章:
16
2015亚冠之吉达阿赫利
日期:2015-08-17 11:21:462015年迎新春徽章
日期:2015-03-04 09:58:11酉鸡
日期:2014-12-07 09:06:19水瓶座
日期:2014-11-04 14:23:29天秤座
日期:2014-03-02 08:57:52双鱼座
日期:2014-02-22 13:07:56午马
日期:2014-02-14 11:08:18双鱼座
日期:2014-02-13 11:09:37卯兔
日期:2014-02-06 15:10:34子鼠
日期:2014-01-20 14:48:19戌狗
日期:2013-12-19 09:37:46射手座
日期:2013-12-19 09:33:47
2 [报告]
发表于 2013-04-21 15:59 |只看该作者
回复 1# chishanmingshen


dmesg 的信息

[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x00001000-0x00ffffff]
[    0.000000]   Normal   [mem 0x01000000-0x37bfdfff]
[    0.000000]   HighMem  [mem 0x37bfe000-0x3e5fffff]


[    0.000000] virtual kernel memory layout:
[    0.000000]     fixmap  : 0xfff14000 - 0xfffff000   ( 940 kB)
[    0.000000]     pkmap   : 0xffc00000 - 0xffe00000   (2048 kB)
[    0.000000]     vmalloc : 0xf83fe000 - 0xffbfe000   ( 120 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xf7bfe000   ( 891 MB)
[    0.000000]       .init : 0xc190c000 - 0xc19d7000   ( 812 kB)
[    0.000000]       .data : 0xc1612e9c - 0xc190b140   (3040 kB)
[    0.000000]       .text : 0xc1000000 - 0xc1612e9c   (6219 kB)


   

论坛徽章:
16
2015亚冠之吉达阿赫利
日期:2015-08-17 11:21:462015年迎新春徽章
日期:2015-03-04 09:58:11酉鸡
日期:2014-12-07 09:06:19水瓶座
日期:2014-11-04 14:23:29天秤座
日期:2014-03-02 08:57:52双鱼座
日期:2014-02-22 13:07:56午马
日期:2014-02-14 11:08:18双鱼座
日期:2014-02-13 11:09:37卯兔
日期:2014-02-06 15:10:34子鼠
日期:2014-01-20 14:48:19戌狗
日期:2013-12-19 09:37:46射手座
日期:2013-12-19 09:33:47
3 [报告]
发表于 2013-04-21 16:03 |只看该作者
内核镜像所占的内存没有释放给buddy system,但是建立direct mapping的时候已经包含了内核镜像部分,所以内核代码自己还是可以访问的,就是之后不会被buddy system进行释放,分配什么的。

论坛徽章:
4
酉鸡
日期:2014-03-21 23:19:50狮子座
日期:2014-08-01 22:11:40酉鸡
日期:2015-01-10 21:31:442015年辞旧岁徽章
日期:2015-03-03 16:54:15
4 [报告]
发表于 2013-04-21 17:23 |只看该作者
回复 2# embeddedlwp


    回复 1# chishanmingshen


dmesg 的信息

[    0.000000]     lowmem  : 0xc0000000 - 0xf7bfe000   ( 891 MB)
[    0.000000]       .init : 0xc190c000 - 0xc19d7000   ( 812 kB)
[    0.000000]       .data : 0xc1612e9c - 0xc190b140   (3040 kB)
[    0.000000]       .text : 0xc1000000 - 0xc1612e9c   (6219 kB)

理解,我想知道那DMA内存在3G到4G的哪里啊?

   

论坛徽章:
0
5 [报告]
发表于 2013-04-21 17:58 |只看该作者
回复 4# chishanmingshen
在C0001000 - C0FFFFFF吧,物理内存的前16M(除起始的0x1000之外)作为DMA区域,一一映射后就到C0000000之后的16M位置了,但内核使用它的方式不是访问这块虚拟地址,而是基于ZONE_DMA的页分配进行管理的,而且除了一些ISA设备需要使用这块内存作为DMA内存,现在的设备一般都支持全地址的DMA访问


   

论坛徽章:
4
酉鸡
日期:2014-03-21 23:19:50狮子座
日期:2014-08-01 22:11:40酉鸡
日期:2015-01-10 21:31:442015年辞旧岁徽章
日期:2015-03-03 16:54:15
6 [报告]
发表于 2013-04-21 18:25 |只看该作者
刚看错了。
[    0.000000]       .text : 0xc1000000 - 0xc1612e9c   (6219 kB)
这个已经表明前16m是留给dma zone了。

我的疑问:3G到3G+8M不是给映像的么?
启动中0-8M和3G到3G+8M都映射到映像,之后会仅仅保留3G到3G+8M的映像映射。

求指点,谢谢!:wink:

论坛徽章:
4
酉鸡
日期:2014-03-21 23:19:50狮子座
日期:2014-08-01 22:11:40酉鸡
日期:2015-01-10 21:31:442015年辞旧岁徽章
日期:2015-03-03 16:54:15
7 [报告]
发表于 2013-04-21 21:43 |只看该作者
怎么理解? 难道dma zone是16M减去映像的大小?不会吧。。。

论坛徽章:
0
8 [报告]
发表于 2013-04-21 22:05 |只看该作者
内核代码段的加载位置是PAGE_OFFSET + CONFIG_PHYSICAL_START吧
  1. config PHYSICAL_START
  2.         hex "Physical address where the kernel is loaded" if (EMBEDDED || CRASH_DUMP)
  3.         default "0x1000000"
  4.         ---help---
  5.           This gives the physical address where the kernel is loaded.

  6.           If kernel is a not relocatable (CONFIG_RELOCATABLE=n) then
  7.           bzImage will decompress itself to above physical address and
  8.           run from there. Otherwise, bzImage will run from the address where
  9.           it has been loaded by the boot loader and will ignore above physical
  10.           address.

  11.           In normal kdump cases one does not have to set/change this option
  12.           as now bzImage can be compiled as a completely relocatable image
  13.           (CONFIG_RELOCATABLE=y) and be used to load and run from a different
  14.           address. This option is mainly useful for the folks who don't want
  15.           to use a bzImage for capturing the crash dump and want to use a
  16.           vmlinux instead. vmlinux is not relocatable hence a kernel needs
  17.           to be specifically compiled to run from a specific memory area
  18.           (normally a reserved region) and this option comes handy.

  19.           So if you are using bzImage for capturing the crash dump,
  20.           leave the value here unchanged to 0x1000000 and set
  21.           CONFIG_RELOCATABLE=y.  Otherwise if you plan to use vmlinux
  22.           for capturing the crash dump change this value to start of
  23.           the reserved region.  In other words, it can be set based on
  24.           the "X" value as specified in the "crashkernel=YM@XM"
  25.           command line boot parameter passed to the panic-ed
  26.           kernel. Please take a look at Documentation/kdump/kdump.txt
  27.           for more details about crash dumps.

  28.           Usage of bzImage for capturing the crash dump is recommended as
  29.           one does not have to build two kernels. Same kernel can be used
  30.           as production kernel and capture kernel. Above option should have
  31.           gone away after relocatable bzImage support is introduced. But it
  32.           is present because there are users out there who continue to use
  33.           vmlinux for dump capture. This option should go away down the
  34.           line.

  35.           Don't change this unless you know what you are doing.
复制代码
详见http://bbs.chinaunix.net/thread-2029114-1-1.html

论坛徽章:
4
酉鸡
日期:2014-03-21 23:19:50狮子座
日期:2014-08-01 22:11:40酉鸡
日期:2015-01-10 21:31:442015年辞旧岁徽章
日期:2015-03-03 16:54:15
9 [报告]
发表于 2013-04-21 22:58 |只看该作者
回复 8# junnyg

你说的没错,但是你看我6楼的问题啊。

   

论坛徽章:
16
2015亚冠之吉达阿赫利
日期:2015-08-17 11:21:462015年迎新春徽章
日期:2015-03-04 09:58:11酉鸡
日期:2014-12-07 09:06:19水瓶座
日期:2014-11-04 14:23:29天秤座
日期:2014-03-02 08:57:52双鱼座
日期:2014-02-22 13:07:56午马
日期:2014-02-14 11:08:18双鱼座
日期:2014-02-13 11:09:37卯兔
日期:2014-02-06 15:10:34子鼠
日期:2014-01-20 14:48:19戌狗
日期:2013-12-19 09:37:46射手座
日期:2013-12-19 09:33:47
10 [报告]
发表于 2013-04-22 07:41 |只看该作者
回复 5# junnyg

除0x1000是因为memblock_trim_memory()中有个以页对齐向上取整的操作,这样0x0000就变成0x1000了。

   
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP