From patchwork Fri Aug 7 20:55:40 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Limei-E12499 X-Patchwork-Id: 40023 X-Patchwork-Delegate: khilman@deeprootsystems.com Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n77KuGAs013000 for ; Fri, 7 Aug 2009 20:56:16 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752366AbZHGU4J (ORCPT ); Fri, 7 Aug 2009 16:56:09 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752889AbZHGU4J (ORCPT ); Fri, 7 Aug 2009 16:56:09 -0400 Received: from mail153.messagelabs.com ([216.82.253.51]:10841 "EHLO mail153.messagelabs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752366AbZHGU4G convert rfc822-to-8bit (ORCPT ); Fri, 7 Aug 2009 16:56:06 -0400 X-VirusChecked: Checked X-Env-Sender: E12499@motorola.com X-Msg-Ref: server-5.tower-153.messagelabs.com!1249678566!8449225!1 X-StarScan-Version: 6.0.0; banners=-,-,- X-Originating-IP: [136.182.1.14] Received: (qmail 26664 invoked from network); 7 Aug 2009 20:56:06 -0000 Received: from motgate4.mot.com (HELO motgate4.mot.com) (136.182.1.14) by server-5.tower-153.messagelabs.com with DHE-RSA-AES256-SHA encrypted SMTP; 7 Aug 2009 20:56:06 -0000 Received: from il27exr04.cig.mot.com (il27exr04.mot.com [10.17.196.73]) by motgate4.mot.com (8.14.3/8.14.3) with ESMTP id n77Ku6ba025430; Fri, 7 Aug 2009 13:56:06 -0700 (MST) Received: from il27vts02.mot.com (il27vts02.cig.mot.com [10.17.196.86]) by il27exr04.cig.mot.com (8.13.1/Vontu) with SMTP id n77Ku5Ox017292; Fri, 7 Aug 2009 15:56:05 -0500 (CDT) Received: from zmy16exm62.ds.mot.com (zmy16exm62.ap.mot.com [10.179.4.33]) by il27exr04.cig.mot.com (8.13.1/8.13.0) with ESMTP id n77Ku4tb017273; Fri, 7 Aug 2009 15:56:05 -0500 (CDT) X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Subject: RE: Linux-omap PM: Fix dead lock condition in resource_release(vdd1_opp) Date: Sat, 8 Aug 2009 04:55:40 +0800 Message-ID: In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Linux-omap PM: Fix dead lock condition in resource_release(vdd1_opp) thread-index: AcoXgSip00gJrgJRRZ27WTFjl4ub+QAIC1jw References: From: "Wang Limei-E12499" To: "Wang Limei-E12499" , , "Kevin Hilman" , X-CFilter-Loop: Reflected Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Re-sent to linux-omap-owner@vger.kernel.org. -----Original Message----- From: Wang Limei-E12499 Sent: Friday, August 07, 2009 12:05 PM To: linux-omap@vger.kernel.org; Kevin Hilman Cc: Wang Limei-E12499 Subject: Linux-omap PM: Fix dead lock condition in resource_release(vdd1_opp) Kevin, I am using linux-omap pm-2.6.29 branch,found a dead lock condition in: arch/arm/plat-omap/resource.c->resource_release(). The dead lock happens when using resource_request("vdd1_opp",&dev,...) and resource_release("vdd1_opp", &dev) to set and release vdd1 opp constraint. The scenario is: plat-omap/resource.c/resource_release("vdd1_opp", &dev)==>resource.c/update_resource_level()=>mach-omap2/resource34xx.c/se t_opp(). In set_opp(), if the target_level of vdd1 is less than OPP3,will release the constraint set on VDD2 by calling resource_release(), but it will never return because can not get the mutex which is holding by the previous caller. int resource_release(const char *name, struct device *dev) { ....... down(&res_mutex); ........ /* Recompute and set the current level for the resource */ ret = update_resource_level(resp); res_unlock: up(&res_mutex); return ret; } int set_opp(struct shared_resource *resp, u32 target_level) { ..... if (resp == vdd1_resp) { if (target_level < 3) resource_release("vdd2_opp", &vdd2_dev); } The patch to fix this issue is below, will you pls review it and let me know your feedback? From: Limei Wang Date: Fri, 7 Aug 2009 11:40:35 -0500 Subject: [PATCH] OMAP PM: Fix dead lock bug in resourc_release(vdd1_opp). Signed-off-by: Limei Wang --- arch/arm/plat-omap/resource.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) EXPORT_SYMBOL(resource_release); -- 1.5.6.3 Thanks, Limei -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm/plat-omap/resource.c b/arch/arm/plat-omap/resource.c index ec31727..876fd12 100644 --- a/arch/arm/plat-omap/resource.c +++ b/arch/arm/plat-omap/resource.c @@ -418,10 +418,12 @@ int resource_release(const char *name, struct device *dev) list_del(&user->node); free_user(user); - /* Recompute and set the current level for the resource */ - ret = update_resource_level(resp); res_unlock: up(&res_mutex); + + /* Recompute and set the current level for the resource */ + if (!ret) + ret = update_resource_level(resp); return ret; }