From patchwork Thu Dec 20 12:44:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ??? X-Patchwork-Id: 1906441 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id C50333FCA5 for ; Sat, 22 Dec 2012 20:54:50 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TmW2E-0002Lx-Fj; Sat, 22 Dec 2012 20:51:07 +0000 Received: from mail-vc0-f169.google.com ([209.85.220.169]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TlfUX-0007AB-MX for linux-arm-kernel@lists.infradead.org; Thu, 20 Dec 2012 12:44:50 +0000 Received: by mail-vc0-f169.google.com with SMTP id gb23so3758964vcb.0 for ; Thu, 20 Dec 2012 04:44:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=Kv78jzGOuIuBKTCWIOoFvSYLU1PtW5AY1VoxIbFAFyU=; b=b3dnk36KTbauCiqStwmA0yfK5/Eav9aAHminz5K874jYqJPBympMbGwv1SLGu9cDQm 655ZLPXCgpx65gD0OIKFK/H//1rqBXMiaSgSlSgyYOH2SCNNaRrR3iW5tOrLC/fVODTZ EK2toe6P8miOvNM3aH3BA8JNDWHVmMw6WyBFnjdpvLmoUTKt6UV4731sRmdCxVU/4qQK uH8VmBa1yA1g32UwYGhGGcBfI9P7zP+o1zoiIbvOgQcXUCbGXldmYSGMBBqgyJXm6Oh6 fuRWkZGlqyhiLgzKvtb5hYnnm787J68EuOvX/mmlYdC3r0RXkv0v3M7k+UeXXWqb5DYy jW1Q== Received: by 10.220.141.6 with SMTP id k6mr13988312vcu.24.1356007488310; Thu, 20 Dec 2012 04:44:48 -0800 (PST) MIME-Version: 1.0 Received: by 10.220.2.72 with HTTP; Thu, 20 Dec 2012 04:44:28 -0800 (PST) From: "steve.zhan" Date: Thu, 20 Dec 2012 20:44:28 +0800 Message-ID: Subject: [PATCH] hwspinlock/core: Kernel panic when enable DEBUG_SPINLOCK_SLEEP config. To: linux-arm-kernel@lists.infradead.org, ohad@wizery.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121220_074449_869866_B7833F23 X-CRM114-Status: UNSURE ( 9.08 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (zhanzhenbo[at]gmail.com) -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.220.169 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 HTML_MESSAGE BODY: HTML included in message -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-Mailman-Approved-At: Sat, 22 Dec 2012 15:44:38 -0500 X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Dear Ohad, When enable this config to check kernel, kernel will complain panic at slab.c(kmem_cache_alloc function): "BUG: sleeping function called from invalid context". The Backtrace is: hwspin_lock_register -> radix_tree_insert -> kmem_cache_alloc -> __might_sleep -> BUG Hwspinlock has been inited in postcore_initcall phase, but kernel sleep check has enable in early_initcall phase(__might_sleep_init_called ==1 in sched.c) I think the the same problem is in __hwspin_lock_request function, this function use pm_runtime_get _sync interface, so might seep that flag don't have RPM_ASYNC value. Do you hae some good suggestions Or comments about this? return ret; diff --git a/drivers/hwspinlock/hwspinlock_core.c b/drivers/hwspinlock/hwspinlock_core.c index db713c0..49ff54a 100644 --- a/drivers/hwspinlock/hwspinlock_core.c +++ b/drivers/hwspinlock/hwspinlock_core.c @@ -50,7 +50,7 @@ * tree, looking for an unused hwspinlock instance, is now reduced to a * single radix tree API call. */ -static RADIX_TREE(hwspinlock_tree, GFP_KERNEL); +static RADIX_TREE(hwspinlock_tree, GFP_ATOMIC); /* * Synchronization of access to the tree is achieved using this mutex, @@ -413,7 +413,7 @@ static int __hwspin_lock_request(struct hwspinlock *hwlock) } /* notify PM core that power is now needed */ - ret = pm_runtime_get_sync(dev); + ret = pm_runtime_get(dev); if (ret < 0) { dev_err(dev, "%s: can't power on device\n", __func__);