* [PATCH] staging: ion: WARN when the handle kmap_cnt is going to wrap around
@ 2014-05-23 0:51 Mitchel Humpherys
2014-05-23 1:09 ` Colin Cross
0 siblings, 1 reply; 4+ messages in thread
From: Mitchel Humpherys @ 2014-05-23 0:51 UTC (permalink / raw)
To: linux-mm, Colin Cross, John Stultz
Cc: Android Kernel Team, linux-kernel, Mitchel Humpherys
There are certain client bugs (double unmap, for example) that can cause
the handle->kmap_cnt (an unsigned int) to wrap around from zero. This
causes problems when the handle is destroyed because we have:
while (handle->kmap_cnt)
ion_handle_kmap_put(handle);
which takes a long time to complete when kmap_cnt starts at ~0 and can
result in a watchdog timeout.
WARN and bail when kmap_cnt is about to wrap around from zero.
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
---
drivers/staging/android/ion/ion.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
index 3d5bf14722..f55f61a4cc 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -626,6 +626,10 @@ static void ion_handle_kmap_put(struct ion_handle *handle)
{
struct ion_buffer *buffer = handle->buffer;
+ if (!handle->kmap_cnt) {
+ WARN(1, "%s: Double unmap detected! bailing...\n", __func__);
+ return;
+ }
handle->kmap_cnt--;
if (!handle->kmap_cnt)
ion_buffer_kmap_put(buffer);
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] staging: ion: WARN when the handle kmap_cnt is going to wrap around
2014-05-23 0:51 [PATCH] staging: ion: WARN when the handle kmap_cnt is going to wrap around Mitchel Humpherys
@ 2014-05-23 1:09 ` Colin Cross
2014-05-23 18:34 ` Mitchel Humpherys
0 siblings, 1 reply; 4+ messages in thread
From: Colin Cross @ 2014-05-23 1:09 UTC (permalink / raw)
To: Mitchel Humpherys; +Cc: Linux-MM, John Stultz, Android Kernel Team, lkml
On Thu, May 22, 2014 at 5:51 PM, Mitchel Humpherys
<mitchelh@codeaurora.org> wrote:
> There are certain client bugs (double unmap, for example) that can cause
> the handle->kmap_cnt (an unsigned int) to wrap around from zero. This
> causes problems when the handle is destroyed because we have:
>
> while (handle->kmap_cnt)
> ion_handle_kmap_put(handle);
>
> which takes a long time to complete when kmap_cnt starts at ~0 and can
> result in a watchdog timeout.
>
> WARN and bail when kmap_cnt is about to wrap around from zero.
>
> Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
> ---
> drivers/staging/android/ion/ion.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
> index 3d5bf14722..f55f61a4cc 100644
> --- a/drivers/staging/android/ion/ion.c
> +++ b/drivers/staging/android/ion/ion.c
> @@ -626,6 +626,10 @@ static void ion_handle_kmap_put(struct ion_handle *handle)
> {
> struct ion_buffer *buffer = handle->buffer;
>
> + if (!handle->kmap_cnt) {
> + WARN(1, "%s: Double unmap detected! bailing...\n", __func__);
> + return;
> + }
> handle->kmap_cnt--;
> if (!handle->kmap_cnt)
> ion_buffer_kmap_put(buffer);
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> hosted by The Linux Foundation
>
> To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com.
Acked-by: Colin Cross <ccross@android.com>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] staging: ion: WARN when the handle kmap_cnt is going to wrap around
2014-05-23 1:09 ` Colin Cross
@ 2014-05-23 18:34 ` Mitchel Humpherys
2014-05-23 18:47 ` Greg Kroah-Hartman
0 siblings, 1 reply; 4+ messages in thread
From: Mitchel Humpherys @ 2014-05-23 18:34 UTC (permalink / raw)
To: Colin Cross, Greg Kroah-Hartman, devel
Cc: Linux-MM, John Stultz, Android Kernel Team, lkml
++greg-kh and devel@driverdev.osuosl.org
(my bad for missing you the first time around)
On Thu, May 22 2014 at 06:09:11 PM, Colin Cross <ccross@android.com> wrote:
> On Thu, May 22, 2014 at 5:51 PM, Mitchel Humpherys
> <mitchelh@codeaurora.org> wrote:
>> There are certain client bugs (double unmap, for example) that can cause
>> the handle->kmap_cnt (an unsigned int) to wrap around from zero. This
>> causes problems when the handle is destroyed because we have:
>>
>> while (handle->kmap_cnt)
>> ion_handle_kmap_put(handle);
>>
>> which takes a long time to complete when kmap_cnt starts at ~0 and can
>> result in a watchdog timeout.
>>
>> WARN and bail when kmap_cnt is about to wrap around from zero.
>>
>> Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
>> ---
>> drivers/staging/android/ion/ion.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
>> index 3d5bf14722..f55f61a4cc 100644
>> --- a/drivers/staging/android/ion/ion.c
>> +++ b/drivers/staging/android/ion/ion.c
>> @@ -626,6 +626,10 @@ static void ion_handle_kmap_put(struct ion_handle *handle)
>> {
>> struct ion_buffer *buffer = handle->buffer;
>>
>> + if (!handle->kmap_cnt) {
>> + WARN(1, "%s: Double unmap detected! bailing...\n", __func__);
>> + return;
>> + }
>> handle->kmap_cnt--;
>> if (!handle->kmap_cnt)
>> ion_buffer_kmap_put(buffer);
>> --
>> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
>> hosted by The Linux Foundation
>>
>> To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com.
>
> Acked-by: Colin Cross <ccross@android.com>
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] staging: ion: WARN when the handle kmap_cnt is going to wrap around
2014-05-23 18:34 ` Mitchel Humpherys
@ 2014-05-23 18:47 ` Greg Kroah-Hartman
0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2014-05-23 18:47 UTC (permalink / raw)
To: Mitchel Humpherys
Cc: Colin Cross, devel, Linux-MM, John Stultz, Android Kernel Team,
lkml
On Fri, May 23, 2014 at 11:34:59AM -0700, Mitchel Humpherys wrote:
> ++greg-kh and devel@driverdev.osuosl.org
> (my bad for missing you the first time around)
What can I do with this? Please send patches to me in a format that I
can actually apply them in...
thanks,
greg k-h
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-05-23 18:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-23 0:51 [PATCH] staging: ion: WARN when the handle kmap_cnt is going to wrap around Mitchel Humpherys
2014-05-23 1:09 ` Colin Cross
2014-05-23 18:34 ` Mitchel Humpherys
2014-05-23 18:47 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).