* [PATCH] staging: vc04_services: Convert get_user_pages*() --> pin_user_pages*()
@ 2020-06-02 18:54 ` Souptick Joarder
0 siblings, 0 replies; 3+ messages in thread
From: Souptick Joarder @ 2020-06-02 18:54 UTC (permalink / raw)
To: gregkh, jamal.k.shareef, dan.carpenter, marcgonzalez,
hariprasad.kelam, tasman, nachukannan
Cc: bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
devel, linux-kernel, Souptick Joarder, John Hubbard
In 2019, we introduced pin_user_pages*() and now we are converting
get_user_pages*() to the new API as appropriate. [1] & [2] could
be referred for more information.
[1] Documentation/core-api/pin_user_pages.rst
[2] "Explicit pinning of user-space pages":
https://lwn.net/Articles/807108/
Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Cc: John Hubbard <jhubbard@nvidia.com>
---
Hi,
I'm compile tested this, but unable to run-time test, so any testing
help is much appriciated.
.../vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
index 38a13e4..4616013 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
@@ -287,12 +287,8 @@ int vchiq_dump_platform_state(void *dump_context)
pagelistinfo->num_pages, pagelistinfo->dma_dir);
}
- if (pagelistinfo->pages_need_release) {
- unsigned int i;
-
- for (i = 0; i < pagelistinfo->num_pages; i++)
- put_page(pagelistinfo->pages[i]);
- }
+ if (pagelistinfo->pages_need_release)
+ unpin_user_pages(pagelistinfo->pages, pagelistinfo->num_pages);
dma_free_coherent(g_dev, pagelistinfo->pagelist_buffer_size,
pagelistinfo->pagelist, pagelistinfo->dma_addr);
@@ -395,7 +391,7 @@ int vchiq_dump_platform_state(void *dump_context)
}
/* do not try and release vmalloc pages */
} else {
- actual_pages = get_user_pages_fast(
+ actual_pages = pin_user_pages_fast(
(unsigned long)buf & PAGE_MASK,
num_pages,
type == PAGELIST_READ,
@@ -407,10 +403,8 @@ int vchiq_dump_platform_state(void *dump_context)
__func__, actual_pages, num_pages);
/* This is probably due to the process being killed */
- while (actual_pages > 0) {
- actual_pages--;
- put_page(pages[actual_pages]);
- }
+ if (actual_pages > 0)
+ unpin_user_pages(pages, actual_pages);
cleanup_pagelistinfo(pagelistinfo);
return NULL;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] staging: vc04_services: Convert get_user_pages*() --> pin_user_pages*()
@ 2020-06-02 18:54 ` Souptick Joarder
0 siblings, 0 replies; 3+ messages in thread
From: Souptick Joarder @ 2020-06-02 18:54 UTC (permalink / raw)
To: gregkh, jamal.k.shareef, dan.carpenter, marcgonzalez,
hariprasad.kelam, tasman, nachukannan
Cc: devel, John Hubbard, linux-kernel, bcm-kernel-feedback-list,
Souptick Joarder, linux-arm-kernel, linux-rpi-kernel
In 2019, we introduced pin_user_pages*() and now we are converting
get_user_pages*() to the new API as appropriate. [1] & [2] could
be referred for more information.
[1] Documentation/core-api/pin_user_pages.rst
[2] "Explicit pinning of user-space pages":
https://lwn.net/Articles/807108/
Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Cc: John Hubbard <jhubbard@nvidia.com>
---
Hi,
I'm compile tested this, but unable to run-time test, so any testing
help is much appriciated.
.../vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
index 38a13e4..4616013 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
@@ -287,12 +287,8 @@ int vchiq_dump_platform_state(void *dump_context)
pagelistinfo->num_pages, pagelistinfo->dma_dir);
}
- if (pagelistinfo->pages_need_release) {
- unsigned int i;
-
- for (i = 0; i < pagelistinfo->num_pages; i++)
- put_page(pagelistinfo->pages[i]);
- }
+ if (pagelistinfo->pages_need_release)
+ unpin_user_pages(pagelistinfo->pages, pagelistinfo->num_pages);
dma_free_coherent(g_dev, pagelistinfo->pagelist_buffer_size,
pagelistinfo->pagelist, pagelistinfo->dma_addr);
@@ -395,7 +391,7 @@ int vchiq_dump_platform_state(void *dump_context)
}
/* do not try and release vmalloc pages */
} else {
- actual_pages = get_user_pages_fast(
+ actual_pages = pin_user_pages_fast(
(unsigned long)buf & PAGE_MASK,
num_pages,
type == PAGELIST_READ,
@@ -407,10 +403,8 @@ int vchiq_dump_platform_state(void *dump_context)
__func__, actual_pages, num_pages);
/* This is probably due to the process being killed */
- while (actual_pages > 0) {
- actual_pages--;
- put_page(pages[actual_pages]);
- }
+ if (actual_pages > 0)
+ unpin_user_pages(pages, actual_pages);
cleanup_pagelistinfo(pagelistinfo);
return NULL;
}
--
1.9.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] staging: vc04_services: Convert get_user_pages*() --> pin_user_pages*()
@ 2020-06-02 18:54 ` Souptick Joarder
0 siblings, 0 replies; 3+ messages in thread
From: Souptick Joarder @ 2020-06-02 18:54 UTC (permalink / raw)
To: gregkh, jamal.k.shareef, dan.carpenter, marcgonzalez,
hariprasad.kelam, tasman, nachukannan
Cc: devel, John Hubbard, linux-kernel, bcm-kernel-feedback-list,
Souptick Joarder, linux-arm-kernel, linux-rpi-kernel
In 2019, we introduced pin_user_pages*() and now we are converting
get_user_pages*() to the new API as appropriate. [1] & [2] could
be referred for more information.
[1] Documentation/core-api/pin_user_pages.rst
[2] "Explicit pinning of user-space pages":
https://lwn.net/Articles/807108/
Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Cc: John Hubbard <jhubbard@nvidia.com>
---
Hi,
I'm compile tested this, but unable to run-time test, so any testing
help is much appriciated.
.../vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
index 38a13e4..4616013 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
@@ -287,12 +287,8 @@ int vchiq_dump_platform_state(void *dump_context)
pagelistinfo->num_pages, pagelistinfo->dma_dir);
}
- if (pagelistinfo->pages_need_release) {
- unsigned int i;
-
- for (i = 0; i < pagelistinfo->num_pages; i++)
- put_page(pagelistinfo->pages[i]);
- }
+ if (pagelistinfo->pages_need_release)
+ unpin_user_pages(pagelistinfo->pages, pagelistinfo->num_pages);
dma_free_coherent(g_dev, pagelistinfo->pagelist_buffer_size,
pagelistinfo->pagelist, pagelistinfo->dma_addr);
@@ -395,7 +391,7 @@ int vchiq_dump_platform_state(void *dump_context)
}
/* do not try and release vmalloc pages */
} else {
- actual_pages = get_user_pages_fast(
+ actual_pages = pin_user_pages_fast(
(unsigned long)buf & PAGE_MASK,
num_pages,
type == PAGELIST_READ,
@@ -407,10 +403,8 @@ int vchiq_dump_platform_state(void *dump_context)
__func__, actual_pages, num_pages);
/* This is probably due to the process being killed */
- while (actual_pages > 0) {
- actual_pages--;
- put_page(pages[actual_pages]);
- }
+ if (actual_pages > 0)
+ unpin_user_pages(pages, actual_pages);
cleanup_pagelistinfo(pagelistinfo);
return NULL;
}
--
1.9.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-06-02 18:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-02 18:54 [PATCH] staging: vc04_services: Convert get_user_pages*() --> pin_user_pages*() Souptick Joarder
2020-06-02 18:54 ` Souptick Joarder
2020-06-02 18:54 ` Souptick Joarder
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.