omap: resource: Make resource_refresh() thread safe.
Subsystems (2)
PATCH 1/1 omap: resource: Make resource_refresh() thread safe.
Need to lock the res_mutex when traversing the res_list.
--- arch/arm/plat-omap/resource.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/plat-omap/resource.c +2 -0
@@ -234,11 +234,13 @@ int resource_refresh(void)struct shared_resource *resp =NULL ;int ret =0 ; +down (&res_mutex);list_for_each_entry (resp, &res_list, node) { ret =update_resource_level (resp);if (ret)break ; } +up (&res_mutex);return ret; }
Signature · 1 line
1.5.4.5
Kevin Hilman
AppliedQuoted 3 lines · Mike Chan
Need to lock the
res_mutexwhen traversing theres_list.Signed-off-by Mike Chan <[email protected]>
Looks good, thanks.
Pushed to PM branch and pm-2.6.29.
Kevin
Quoted 24 lines
--- arch/arm/plat-omap/resource.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)arch/arm/plat-omap/resource.c +2
-0@@ -234,11 +234,13 @@ int resource_refresh(void)struct shared_resource *resp =NULL ;int ret =0 ; +down (&res_mutex);list_for_each_entry (resp, &res_list, node) { ret =update_resource_level (resp);if (ret)break ; } +up (&res_mutex);return ret; }Signature · 1 line
1.5.4.5
Quoted 7 lines · Kevin Hilman
Quoted 3 lines · Mike Chan
Need to lock the
res_mutexwhen traversing theres_list.Signed-off-by Mike Chan <[email protected]>Looks good, thanks.
This patch causes a hang for me when transitioning to OFF mode. This was tested on the Android 2.6.29 tree and is 100% reproducible. The moment a user runs 'echo 1 > /sys/power/enable_off_mode' the board hangs without any further output.
Reverting the patch allows me to hit OFF mode again. I haven't yet tested this on vanilla 2.6.29 or latest L-O.
Mike
Quoted 33 lines
Pushed to PM branch and pm-2.6.29.
Kevin
Quoted 24 lines
--- arch/arm/plat-omap/resource.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)arch/arm/plat-omap/resource.c +2
-0@@ -234,11 +234,13 @@ int resource_refresh(void)struct shared_resource *resp =NULL ;int ret =0 ; +down (&res_mutex);list_for_each_entry (resp, &res_list, node) { ret =update_resource_level (resp);if (ret)break ; } +up (&res_mutex);return ret; }Signature · 1 line
1.5.4.5--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 9 lines · Mike Turquette
Quoted 7 lines · Kevin Hilman
Quoted 3 lines · Mike Chan
Need to lock the
res_mutexwhen traversing theres_list.Signed-off-by Mike Chan <[email protected]>Looks good, thanks.
Quoted 8 lines
This patch causes a hang for me when transitioning to OFF mode. This was tested on the Android 2.6.29 tree and is 100% reproducible. The moment a user runs 'echo 1 >
/sys/power/enable_off_mode' the board hangs without any further output.Reverting the patch allows me to hit OFF mode again. I haven't yet tested this on vanilla 2.6.29 or latest L-O.
OK, reverting this in both PM branches. Looks like a deadlock to me, as update_resource_level() must cause a call to something else that takes the mutex.
Kevin
Quoted 32 lines
Quoted 32 lines
Pushed to PM branch and pm-2.6.29.
Kevin
Quoted 21 lines
--- arch/arm/plat-omap/resource.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)arch/arm/plat-omap/resource.c +1
-0@@ -234,11 +234,13 @@ int resource_refresh(void)struct shared_resource *resp =NULL ;int ret =0 ; +down (&res_mutex);list_for_each_entry (resp, &res_list, node) { ret =update_resource_level (resp);if (ret)break ; } +up (&res_mutex);return ret; } --Quoted 1 line
1.5.4.5
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 16 lines · Kevin Hilman
Quoted 14 lines · Mike Turquette
Quoted 7 lines · Kevin Hilman
Quoted 3 lines · Mike Chan
Need to lock the
res_mutexwhen traversing theres_list.Signed-off-by Mike Chan <[email protected]>Looks good, thanks.
This patch causes a hang for me when transitioning to OFF mode. This was tested on the Android 2.6.29 tree and is 100% reproducible. The moment a user runs 'echo 1 >
/sys/power/enable_off_mode' the board hangs without any further output.
Quoted 8 lines
Quoted 3 lines
Reverting the patch allows me to hit OFF mode again. I haven't yet tested this on vanilla 2.6.29 or latest L-O.
OK, reverting this in both PM branches. Looks like a deadlock to me, as
update_resource_level()must cause a call to something else that takes the mutex.
Good catch, I see the deadlock are in the change_level function pointers. Where set_xxx will call resource_request() or resource_release() => resource_lookup() which grabs the list mutex we grabbed in resource_refresh().
Thoughts on changing the mutex to a RW semaphore?
-- Mike
Quoted 35 lines
Kevin
Quoted 32 lines
Quoted 32 lines
Pushed to PM branch and pm-2.6.29.
Kevin
Quoted 20 lines
---
arch/arm/plat-omap/resource.c | 2 ++1 files changed, 2 insertions(+), 0 deletions(-)arch/arm/plat-omap/resource.c +1
-0@@ -234,11 +234,13 @@ int resource_refresh(void) struct shared_resource *resp = NULL; int ret = 0; + down(&res_mutex); list_for_each_entry(resp, &res_list, node) { ret = update_resource_level(resp); if (ret) break; } + up(&res_mutex); return ret; }Quoted 2 lines
--
1.5.4.5--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html