Kernel panic using deferred_io on kmalloced buffer

痴心易碎 提交于 2019-12-06 15:38:46

Confirmed the fix so I'll answer my own question:

deferred_io changes the info mmap to its own that sets up fault handlers for writes to the video memory pages. In the fault handler it

  • checks bounds against info->fix.smem_len, so you must set that
  • gets the page that was written to.

For the latter case, it treats vmalloc differently from kmalloc (by checking info->screen_base to see if it's vmalloced). If you have vmalloced, it uses screen_base as the virtual address. If you have not used vmalloc, it assumes that the address of interest is the physical address in info->fix.smem_start.

So, to use deferred_io correctly

  • set screen_base (char __iomem *) and point that to the virtual address.
  • set info->fix.smem_len to the video buffer size
  • if you are not using vmalloc, you must set info->fix.smem_start to the video buffer's physical address by using virt_to_phys(vid_buffer);

Confirmed on Ubuntu as fixing the issue.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!