From patchwork Mon Nov 9 01:41:34 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Miller X-Patchwork-Id: 37955 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id E7105B7088 for ; Mon, 9 Nov 2009 12:41:21 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751406AbZKIBlJ (ORCPT ); Sun, 8 Nov 2009 20:41:09 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751739AbZKIBlJ (ORCPT ); Sun, 8 Nov 2009 20:41:09 -0500 Received: from 74-93-104-97-Washington.hfc.comcastbusiness.net ([74.93.104.97]:55570 "EHLO sunset.davemloft.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751406AbZKIBlI (ORCPT ); Sun, 8 Nov 2009 20:41:08 -0500 Received: from localhost (localhost [127.0.0.1]) by sunset.davemloft.net (Postfix) with ESMTP id D71A6C8C506; Sun, 8 Nov 2009 17:41:34 -0800 (PST) Date: Sun, 08 Nov 2009 17:41:34 -0800 (PST) Message-Id: <20091108.174134.45234225.davem@davemloft.net> To: tglx@linutronix.de Cc: sparclinux@vger.kernel.org Subject: Re: [patch] sparc: Remove bogus of_set_property_mutex From: David Miller In-Reply-To: References: <20091107184538.543684450@linutronix.de> <20091107.203916.240004731.davem@davemloft.net> X-Mailer: Mew version 6.2.51 on Emacs 22.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Sender: sparclinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org From: Thomas Gleixner Date: Sun, 8 Nov 2009 21:16:47 +0100 (CET) > Then you need to fix the problem that you lock the mutex inside the > preempt disabled region under devtree_lock. :) That's simple, just move it outside the rwlock: sparc: Move of_set_property_mutex acquisition outside of devtree_lock grab. Otherwise we try to sleep with preemption disabled, etc. Noticed by Thomas Gleixner. Signed-off-by: David S. Miller --- arch/sparc/kernel/prom_common.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c index 138910c..d80a65d 100644 --- a/arch/sparc/kernel/prom_common.c +++ b/arch/sparc/kernel/prom_common.c @@ -79,6 +79,7 @@ int of_set_property(struct device_node *dp, const char *name, void *val, int len err = -ENODEV; + mutex_lock(&of_set_property_mutex); write_lock(&devtree_lock); prevp = &dp->properties; while (*prevp) { @@ -88,9 +89,7 @@ int of_set_property(struct device_node *dp, const char *name, void *val, int len void *old_val = prop->value; int ret; - mutex_lock(&of_set_property_mutex); ret = prom_setprop(dp->node, name, val, len); - mutex_unlock(&of_set_property_mutex); err = -EINVAL; if (ret >= 0) { @@ -109,6 +108,7 @@ int of_set_property(struct device_node *dp, const char *name, void *val, int len prevp = &(*prevp)->next; } write_unlock(&devtree_lock); + mutex_unlock(&of_set_property_mutex); /* XXX Upate procfs if necessary... */