Linux Kernel Get User Pages

Question 1:

if I malloc a buffer in user space, but I don't read/write it. I just pass the virtual address of this buffer to driver by ioctl. In driver, I am trying to use get_user_pages() to get all the pages of this virtual address. Is there page mapping in the page table? If yes, when does it setup? If no, could get_user_pages() get all the pages?

Answer:

get_user_pages() could try to trigger page fault to setup the page mapping in the page table by faultin_page() function.

Question 2:

If we use the pages we get by get_user_pages() in Question1 to peripherals such as DMA, is it possible the page was swapped out when the HW trying to use it?

Yes, it is possible. And this is a bad usage of user space pages.  

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
NU/Linux Rapid Embedded Programming by Rodolfo Giometti English | 29 Mar. 2017 | ASIN: B01IBPRA94 | 732 Pages | AZW3 | 12.68 MB An annotated guide to program and develop GNU/Linux Embedded systems quickly About This Book Rapidly design and build powerful prototypes for GNU/Linux Embedded systems Become familiar with the workings of GNU/Linux Embedded systems and how to manage its peripherals Write, monitor, and configure applications quickly and effectively, manage an external micro-controller, and use it as co-processor for real-time tasks Who This Book Is For This book targets Embedded System developers and GNU/Linux programmers who would like to program Embedded Systems and perform Embedded development. The book focuses on quick and efficient prototype building. Some experience with hardware and Embedded Systems is assumed, as is having done some previous work on GNU/Linux systems. Knowledge of scripting on GNU/Linux is expected as well. What You Will Learn Use embedded systems to implement your projects Access and manage peripherals for embedded systems Program embedded systems using languages such as C, Python, Bash, and PHP Use a complete distribution, such as Debian or Ubuntu, or an embedded one, such as OpenWrt or Yocto Harness device driver capabilities to optimize device communications Access data through several kinds of devices such as GPIO's, serial ports, PWM, ADC, Ethernet, WiFi, audio, video, I2C, SPI, One Wire, USB and CAN Practical example usage of several devices such as RFID readers, Smart card readers, barcode readers, z-Wave devices, GSM/GPRS modems Usage of several sensors such as light, pressure, moisture, temperature, infrared, power, motion In Detail Embedded computers have become very complex in the last few years and developers need to be able to easily manage embedded computer projects by focusing on problem solving; they should not have to waste time finding supported peripherals or learning how to manage them. This book shows yo

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值