diff options
author | Jan Kara <jack@suse.cz> | 2013-10-02 10:27:47 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-10-05 21:04:55 -0400 |
commit | 240ddd495a9e72073d11b1b7c2ec9ea14e7015cb (patch) | |
tree | 68f1fe2c753dcfca69748bd7226da531654034ac /drivers/misc | |
parent | af190494f9b2e1fb6e1c039e9626c3c334717da1 (diff) |
vmw_vmci: Convert driver to use get_user_pages_fast()
Convert vmci_host_setup_notify() and qp_host_get_user_memory() to use
get_user_pages_fast() instead of get_user_pages(). Note that
qp_host_get_user_memory() was using mmap_sem for writing without an
apparent reason.
CC: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/vmw_vmci/vmci_host.c | 6 | ||||
-rw-r--r-- | drivers/misc/vmw_vmci/vmci_queue_pair.c | 21 |
2 files changed, 7 insertions, 20 deletions
diff --git a/drivers/misc/vmw_vmci/vmci_host.c b/drivers/misc/vmw_vmci/vmci_host.c index d4722b3dc8ec..1723a6e4f2e8 100644 --- a/drivers/misc/vmw_vmci/vmci_host.c +++ b/drivers/misc/vmw_vmci/vmci_host.c | |||
@@ -243,11 +243,7 @@ static int vmci_host_setup_notify(struct vmci_ctx *context, | |||
243 | /* | 243 | /* |
244 | * Lock physical page backing a given user VA. | 244 | * Lock physical page backing a given user VA. |
245 | */ | 245 | */ |
246 | down_read(¤t->mm->mmap_sem); | 246 | retval = get_user_pages_fast(PAGE_ALIGN(uva), 1, 1, &page); |
247 | retval = get_user_pages(current, current->mm, | ||
248 | PAGE_ALIGN(uva), | ||
249 | 1, 1, 0, &page, NULL); | ||
250 | up_read(¤t->mm->mmap_sem); | ||
251 | if (retval != 1) | 247 | if (retval != 1) |
252 | return VMCI_ERROR_GENERIC; | 248 | return VMCI_ERROR_GENERIC; |
253 | 249 | ||
diff --git a/drivers/misc/vmw_vmci/vmci_queue_pair.c b/drivers/misc/vmw_vmci/vmci_queue_pair.c index a0515a6d6ebd..1b7b303085d2 100644 --- a/drivers/misc/vmw_vmci/vmci_queue_pair.c +++ b/drivers/misc/vmw_vmci/vmci_queue_pair.c | |||
@@ -732,13 +732,9 @@ static int qp_host_get_user_memory(u64 produce_uva, | |||
732 | int retval; | 732 | int retval; |
733 | int err = VMCI_SUCCESS; | 733 | int err = VMCI_SUCCESS; |
734 | 734 | ||
735 | down_write(¤t->mm->mmap_sem); | 735 | retval = get_user_pages_fast((uintptr_t) produce_uva, |
736 | retval = get_user_pages(current, | 736 | produce_q->kernel_if->num_pages, 1, |
737 | current->mm, | 737 | produce_q->kernel_if->u.h.header_page); |
738 | (uintptr_t) produce_uva, | ||
739 | produce_q->kernel_if->num_pages, | ||
740 | 1, 0, | ||
741 | produce_q->kernel_if->u.h.header_page, NULL); | ||
742 | if (retval < produce_q->kernel_if->num_pages) { | 738 | if (retval < produce_q->kernel_if->num_pages) { |
743 | pr_warn("get_user_pages(produce) failed (retval=%d)", retval); | 739 | pr_warn("get_user_pages(produce) failed (retval=%d)", retval); |
744 | qp_release_pages(produce_q->kernel_if->u.h.header_page, | 740 | qp_release_pages(produce_q->kernel_if->u.h.header_page, |
@@ -747,12 +743,9 @@ static int qp_host_get_user_memory(u64 produce_uva, | |||
747 | goto out; | 743 | goto out; |
748 | } | 744 | } |
749 | 745 | ||
750 | retval = get_user_pages(current, | 746 | retval = get_user_pages_fast((uintptr_t) consume_uva, |
751 | current->mm, | 747 | consume_q->kernel_if->num_pages, 1, |
752 | (uintptr_t) consume_uva, | 748 | consume_q->kernel_if->u.h.header_page); |
753 | consume_q->kernel_if->num_pages, | ||
754 | 1, 0, | ||
755 | consume_q->kernel_if->u.h.header_page, NULL); | ||
756 | if (retval < consume_q->kernel_if->num_pages) { | 749 | if (retval < consume_q->kernel_if->num_pages) { |
757 | pr_warn("get_user_pages(consume) failed (retval=%d)", retval); | 750 | pr_warn("get_user_pages(consume) failed (retval=%d)", retval); |
758 | qp_release_pages(consume_q->kernel_if->u.h.header_page, | 751 | qp_release_pages(consume_q->kernel_if->u.h.header_page, |
@@ -763,8 +756,6 @@ static int qp_host_get_user_memory(u64 produce_uva, | |||
763 | } | 756 | } |
764 | 757 | ||
765 | out: | 758 | out: |
766 | up_write(¤t->mm->mmap_sem); | ||
767 | |||
768 | return err; | 759 | return err; |
769 | } | 760 | } |
770 | 761 | ||