edriver
驱动小牛
驱动小牛
  • 注册日期2002-03-04
  • 最后登录2006-09-15
  • 粉丝0
  • 关注0
  • 积分13分
  • 威望3点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:1536回复:11

关于direct_io

楼主#
更多 发布于:2002-08-16 09:34
很想知道direct_io分配的内存是分页的还是非分页的,还是就是他在分配的大小上有没有限制?
另外:当用direct_io方式传多个IRP下去,内核是在一收到IRP就建立MDL,还是在处理当前IRP才建立MDL的?
zdhe
驱动太牛
驱动太牛
  • 注册日期2001-12-26
  • 最后登录2018-06-02
  • 粉丝0
  • 关注0
  • 积分72362分
  • 威望362260点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
  • 社区居民
沙发#
发布于:2002-08-18 21:36
in dispatch level, when you want to access pagable memory,
do like following:

mark pending irp.
quueworkitemex,
return peding status (DO not complete it).

in work queue, because it\'s in passive level, do as you like
then complete irp.

in filedisk or filemon anything else, there is much example about how to lower a irp.

you can not use KeLowerIrql to low a irp which was not raised by youself (use KeRaiseIrql).

so use workitem or system thread maybe best and only way.

good luck.
gung
驱动中牛
驱动中牛
  • 注册日期2001-06-10
  • 最后登录2008-04-21
  • 粉丝0
  • 关注0
  • 积分25分
  • 威望3点
  • 贡献值0点
  • 好评度2点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2002-08-17 18:42
Rifter,

Second, suppose I can get the Irp, but this routine is at Dispatch level, so the RtlCopyMemory ... can\'t be used, is there anyway I can decrease the IRQL level of this routine or is there any other ways to get the packet cpied? Thanks in advance!

zyh


RtlCopyMemory can be used at Dispatch level. The problem is that the Virtual Address of paged memory can\'t be used. You can try to lock the memory in passive level and use it at Dispatch level.
zyhflorida
驱动牛犊
驱动牛犊
  • 注册日期2002-08-09
  • 最后登录2003-11-25
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
地板#
发布于:2002-08-17 01:21
That\'s for zdhe :)

Rifter, thanks for raising the question also :)
zyhflorida
驱动牛犊
驱动牛犊
  • 注册日期2002-08-09
  • 最后登录2003-11-25
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
地下室#
发布于:2002-08-17 01:19
Rifter,

I learned a lot from your posting. My problem now is I am trying to copy a packet from a nondispatch routine to the Irp\'s buffer, but since there is no Irp in the parameter list, how can I get the Irp and the DeviceObject?

Second, suppose I can get the Irp, but this routine is at Dispatch level, so the RtlCopyMemory ... can\'t be used, is there anyway I can decrease the IRQL level of this routine or is there any other ways to get the packet cpied? Thanks in advance!

zyh
rifter
论坛版主
论坛版主
  • 注册日期2002-03-20
  • 最后登录2006-02-28
  • 粉丝1
  • 关注0
  • 积分65分
  • 威望8点
  • 贡献值0点
  • 好评度3点
  • 原创分0分
  • 专家分0分
5楼#
发布于:2002-08-16 12:34
MDL只是描述子而已,描述的内存可以十分也得也可以是不页的(不是cpu的页概念,明确的说这个页是pagafile swapable or not)。

只要driver访问时的irql低于dispatch level, 分页内存也可以使用。

对于directio,系统会把buffer lock在物理内存中,然后做成一个mdl供driver使用。

从这个意义上,directio是不分页的。当时使用可能的物理mem如果不足,自然lock就失败,这个内存永远不会大于可用物理内存。

 


懂了懂了,帮我看看 我的其他几片帖子,关于STOP停机的问题
分数 你想要吗?
zdhe
驱动太牛
驱动太牛
  • 注册日期2001-12-26
  • 最后登录2018-06-02
  • 粉丝0
  • 关注0
  • 积分72362分
  • 威望362260点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
  • 社区居民
6楼#
发布于:2002-08-16 11:21
MDL只是描述子而已,描述的内存可以十分也得也可以是不页的(不是cpu的页概念,明确的说这个页是pagafile swapable or not)。

只要driver访问时的irql低于dispatch level, 分页内存也可以使用。

对于directio,系统会把buffer lock在物理内存中,然后做成一个mdl供driver使用。

从这个意义上,directio是不分页的。当时使用可能的物理mem如果不足,自然lock就失败,这个内存永远不会大于可用物理内存。

edriver
驱动小牛
驱动小牛
  • 注册日期2002-03-04
  • 最后登录2006-09-15
  • 粉丝0
  • 关注0
  • 积分13分
  • 威望3点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
7楼#
发布于:2002-08-16 10:50
就是就是,我非常同意gung的看法,不过真的要感谢arthurtu。
还有我觉得内核如果在处理当前的IRP才建立MDL更为合理,也就是说只有在真正用到他的时候我们才用MDL来描述他,这样比较节省资源。
gung
驱动中牛
驱动中牛
  • 注册日期2001-06-10
  • 最后登录2008-04-21
  • 粉丝0
  • 关注0
  • 积分25分
  • 威望3点
  • 贡献值0点
  • 好评度2点
  • 原创分0分
  • 专家分0分
8楼#
发布于:2002-08-16 10:31
mdl在irp里面,irp是不分页的。你说呢?
当然不能大于物理内存。 :D :D
到底能多大,也不清楚,可能和当时的环境有关系。


mdl虽然在非分页内存中,但mdl描述的内存可以是分页的吧,我觉得irp中所带的内存如果只能是非分页的总是会有所局限吧,非分页内存总不好申请太大吧。
自己瞎猜,不懂的说 :D
arthurtu
驱动巨牛
驱动巨牛
  • 注册日期2001-11-08
  • 最后登录2020-12-19
  • 粉丝0
  • 关注0
  • 积分26分
  • 威望161点
  • 贡献值0点
  • 好评度35点
  • 原创分0分
  • 专家分0分
  • 社区居民
9楼#
发布于:2002-08-16 10:24
mdl在irp里面,irp是不分页的。你说呢?
当然不能大于物理内存。 :D :D
到底能多大,也不清楚,可能和当时的环境有关系。
edriver
驱动小牛
驱动小牛
  • 注册日期2002-03-04
  • 最后登录2006-09-15
  • 粉丝0
  • 关注0
  • 积分13分
  • 威望3点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
10楼#
发布于:2002-08-16 10:12
对不起,我没有说清楚。我的意思就是在用direct_io方式的时候,内核在用MDL去描述应用程序传下来的buffer,那么这个buffer映射到内核中是否是分页的呢?还有就是他的大小有限制吗?
arthurtu
驱动巨牛
驱动巨牛
  • 注册日期2001-11-08
  • 最后登录2020-12-19
  • 粉丝0
  • 关注0
  • 积分26分
  • 威望161点
  • 贡献值0点
  • 好评度35点
  • 原创分0分
  • 专家分0分
  • 社区居民
11楼#
发布于:2002-08-16 09:45
什么叫direct_io分配的内存?
在建立irp的时候,就包括mdl了
游客

返回顶部