简体   繁体   English

内核分散列表在虚拟地址中是连续的吗?

[英]Kernel scatterlists contiguous in virtual address?

I'd like to ask/verify whether an array of struct scatterlist that were mapped with blk_rq_map_sg are all contiguous at least in virtual address domain. 我想询问/验证至少在虚拟地址域中,用blk_rq_map_sg映射的struct scatterlist数组是否都是连续的。 Well we all know that scatterlists are primarily for DMA, where each scatter-gather (sg) array element describes a chunk of memory and those chunks are discontiguous in their physical addresses. 众所周知,散点列表主要用于DMA,其中每个散点聚集(sg)数组元素描述一块内存,而这些块在其物理地址中是不连续的。

I'm writing a block device driver. 我正在编写块设备驱动程序。 Suppose I receive struct requests from my request_queue, and I want to do something with the I/O data that my request is holding, like memcpy ing them to somewhere. 假设我收到我的request_queue结构的要求,我想这样做与我的要求是持有,如I / O数据进行处理memcpy荷兰国际集团他们的地方。 That operation will need a virtual address and length parameter. 该操作将需要一个虚拟地址和长度参数。 Now all I know is that I can access the request's data via the scatterlist mapped through the helper function blk_map_rq_sg() . 现在,我所知道的是,我可以通过通过辅助函数blk_map_rq_sg()映射的blk_map_rq_sg()访问请求的数据。 Is my assumption correct, that those sg elements are contiguous in virtual, and that I can get the data address via sg_virt() , and use that address and total length for memcpy ? 我的假设正确吗,这些sg元素在虚拟中是连续的,并且我可以通过sg_virt()获取数据地址,并将该地址和总长度用于memcpy Or they are discontiguous in virtual, and I have to walk through each sg array element and memcpy to/from each sg memory chunk (in virtual) which is harder? 还是它们在虚拟环境中是不连续的,我必须遍历每个sg数组元素和memcpy往返于每个sg内存块(在虚拟中),这更难吗?

Functions like writev allow to submit discontiguous requests, and pages in high memory do not have a virtual address to begin with. 诸如writev之类的功能允许提交不连续的请求,并且高内存中的页面没有虚拟地址开头。

To access SG list contents with the CPU, use something like sg_copy_from_buffer , which automatically maps the pages temporarily. 要使用CPU访问SG列表内容,请使用sg_copy_from_buffer类的sg_copy_from_buffer ,它会自动临时映射页面。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使物理地址区中的虚拟地址连续如何提高性能? - How does making the virtual address contiguous in physical address zone improve performance? Linux 内核编程:“无法处理虚拟地址 [地址] 处的内核空指针取消引用” - Linux Kernel Programming: “Unable to handle kernel NULL pointer dereference at virtual address [address]” 在Windows 10驱动程序中将内核空间虚拟地址映射到用户空间虚拟地址 - Mapping Kernel-Space Virtual Address to User-Space Virtual Address in Windows 10 Driver ioremap-无法处理虚拟地址XXXXXXXX上的内核分页请求 - ioremap - Unable to handle kernel paging request at virtual address XXXXXXXX OS X 内核将虚拟地址空间锁定到物理内存中 - OS X kernel lock virtual address space into physical memory “无法在虚拟地址处处理内核NULL指针取消引用。”-在向内核模块发送信号时| 面向对象 - “Unable to handle kernel NULL pointer dereference at Virtual Address.” - On signalling the Kernel Module | OOPS Helping with Linux kernel dump crash: Unable to handle kernel NULL pointer dereference at virtual address 00000001 - Helping with Linux kernel dump crash: Unable to handle kernel NULL pointer dereference at virtual address 00000001 arrays 是否保证在虚拟 memory 中是连续的? - Are arrays guaranteed to be contiguous in virtual memory? Arrays 是连续的吗? (虚拟与物理) - Are Arrays Contiguous? (Virtual vs Physical) 内核中的地址 - The address in Kernel
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM