Skip to contentSkip to conversation

ehca: remove use of do_mmap() from kernel space and minor cleanup

PATCH In review Hoang-Nam Nguyen 1 participant 2 messages Jan 11, 2007

lore
Share & tools
lore
#0 lore raw

cover ehca: remove use of do_mmap() from kernel space and minor cleanup

Hello Roland and Christoph H.!
Here is a set of patches for ehca, whose main purpose is to remove unproper use of do_mmap() in ehca kernel space as suggested by Christoph H. Other "small" changes are:
* Remove "dead" prototype declarations (those without code implementation)
* Use SLAB_ defines instead GFP_ ones when allocating memory from slab cache

Actually I should separate those patches for more clarity. Unfortunately that code cleanup above has been incorporated much earlier in our repository, and I had not paid attention on when I started to rework the mmap() stuff. Sorry for this inconvenience!

Now more detail on mmap() rework:
- For eHCA hardware register block we use remap_pfn_range() as previously.
- For queue pages we call pattern vm_insert_page() to register each allocated kernel page.
- For each mmap-ed resource (hardware register block, send/recv and completion queue) we introduce a use counter that is incremented and decremented by the call-backs open()/close(). Destroying a completion queue or queue pair will succeed only if all associated counters are zero. That means those resources must be mmap-ed resp. munmap-ed properly by user space.

Thanks
Nam

#1 lore raw

Please ignore this. Pushed the send button to fast again. Regards
Nam

Quoted 25 lines · Hoang-Nam Nguyen

Hello Roland and Christoph H.!
Here is a set of patches for ehca, whose main purpose is to remove unproper use of do_mmap() in ehca kernel space as suggested by Christoph H. Other "small" changes are:
* Remove "dead" prototype declarations (those without code implementation)
* Use SLAB_ defines instead GFP_ ones when allocating memory from slab cache

Actually I should separate those patches for more clarity. Unfortunately that code cleanup above has been incorporated much earlier in our repository, and I had not paid attention on when I started to rework the mmap() stuff. Sorry for this inconvenience!

Now more detail on mmap() rework:
- For eHCA hardware register block we use remap_pfn_range() as previously.
- For queue pages we call pattern vm_insert_page() to register each allocated kernel page.
- For each mmap-ed resource (hardware register block, send/recv and completion queue) we introduce a use counter that is incremented and decremented by the call-backs open()/close(). Destroying a completion queue or queue pair will succeed only if all associated counters are zero. That means those resources must be mmap-ed resp. munmap-ed properly by user space.

Thanks
Nam