From patchwork Wed Sep 30 22:59:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 54340 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by patches.linaro.org (Postfix) with ESMTPS id A5E0122E23 for ; Wed, 30 Sep 2015 23:15:57 +0000 (UTC) Received: by wicgb1 with SMTP id gb1sf1557101wic.3 for ; Wed, 30 Sep 2015 16:15:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=wAK8KhnEJaQRB3Uy/xK1iQghjOwFbGqorvTNXSIIR18=; b=Qa1f31T/1+qN/YrN9l4kHsj4uN0phX+A5USliPkcK1QHiPl0gE+Zxj5u5oTuqm09BB ZjHSBi/+Dkyihj6i6t56JPbkozxnFzuOQ50iBcSTe2nZhY+obA+qbMS9H337OC3gVzM+ CKFoOKnsCu2hVkbaiYp/MwOXPF0TLZ2Lz4scq0Z9At1j02NjPp3oMICr/4B/xInh31Ud wYQ6EvuPan0BEiOeoUV4OyaFayAD+LVxGn5y2XwTNieV2R1pk9Ckwnc/lBAo1f6K2K3L 2OXh+51kaQg31Rn4ffbGrKkOvUU/3S9bvhFXWSkvuH+ZE8JChDwVIcrUalXtKjDyItVQ Jufg== X-Gm-Message-State: ALoCoQknN7tbtt5mZDi/NS5/WEqn3XpRdGDCjaNL7MAgrHn6FTJpQasbQNI7iRQE6oEZ3chKvDnn X-Received: by 10.195.18.100 with SMTP id gl4mr931004wjd.4.1443654956955; Wed, 30 Sep 2015 16:15:56 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.152.199 with SMTP id a190ls70243lfe.62.gmail; Wed, 30 Sep 2015 16:15:56 -0700 (PDT) X-Received: by 10.112.234.199 with SMTP id ug7mr1918751lbc.116.1443654956633; Wed, 30 Sep 2015 16:15:56 -0700 (PDT) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id 5si1325266lap.175.2015.09.30.16.15.56 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Sep 2015 16:15:56 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by lahh2 with SMTP id h2so64290717lah.0 for ; Wed, 30 Sep 2015 16:15:56 -0700 (PDT) X-Received: by 10.152.28.73 with SMTP id z9mr1926599lag.73.1443654956136; Wed, 30 Sep 2015 16:15:56 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp243163lbq; Wed, 30 Sep 2015 16:15:55 -0700 (PDT) X-Received: by 10.50.57.102 with SMTP id h6mr8570252igq.29.1443654955231; Wed, 30 Sep 2015 16:15:55 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h10si5805igh.20.2015.09.30.16.15.51; Wed, 30 Sep 2015 16:15:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754788AbbI3XPu (ORCPT + 30 others); Wed, 30 Sep 2015 19:15:50 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:35528 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754464AbbI3XPp (ORCPT ); Wed, 30 Sep 2015 19:15:45 -0400 Received: by pacfv12 with SMTP id fv12so54967397pac.2 for ; Wed, 30 Sep 2015 16:15:45 -0700 (PDT) X-Received: by 10.69.3.228 with SMTP id bz4mr8003501pbd.79.1443654944863; Wed, 30 Sep 2015 16:15:44 -0700 (PDT) Received: from yshi-Precision-T5600.corp.ad.wrs.com (unknown-216-82.windriver.com. [147.11.216.82]) by smtp.gmail.com with ESMTPSA id vv9sm2656582pbc.95.2015.09.30.16.15.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Sep 2015 16:15:44 -0700 (PDT) From: Yang Shi To: rostedt@goodmis.org, catalin.marinas@arm.com, will.deacon@arm.com, dave.long@linaro.org, panand@redhat.com Cc: linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linaro-kernel@lists.linaro.org, yang.shi@linaro.org Subject: [PATCH] arm64: replace read_lock to rcu lock in call_break_hook Date: Wed, 30 Sep 2015 15:59:04 -0700 Message-Id: <1443653944-21885-1-git-send-email-yang.shi@linaro.org> X-Mailer: git-send-email 2.0.2 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: yang.shi@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:917 in_atomic(): 0, irqs_disabled(): 128, pid: 342, name: perf 1 lock held by perf/342: #0: (break_hook_lock){+.+...}, at: [] call_break_hook+0x34/0xd0 irq event stamp: 62224 hardirqs last enabled at (62223): [] __call_rcu.constprop.59+0x104/0x270 hardirqs last disabled at (62224): [] vprintk_emit+0x68/0x640 softirqs last enabled at (0): [] copy_process.part.8+0x428/0x17f8 softirqs last disabled at (0): [< (null)>] (null) CPU: 0 PID: 342 Comm: perf Not tainted 4.1.6-rt5 #4 Hardware name: linux,dummy-virt (DT) Call trace: [] dump_backtrace+0x0/0x128 [] show_stack+0x20/0x30 [] dump_stack+0x7c/0xa0 [] ___might_sleep+0x174/0x260 [] __rt_spin_lock+0x28/0x40 [] rt_read_lock+0x60/0x80 [] call_break_hook+0x30/0xd0 [] brk_handler+0x30/0x98 [] do_debug_exception+0x50/0xb8 Exception stack(0xffffffc00514fe30 to 0xffffffc00514ff50) fe20: 00000000 00000000 c1594680 0000007f fe40: ffffffff ffffffff 92063940 0000007f 0550dcd8 ffffffc0 00000000 00000000 fe60: 0514fe70 ffffffc0 000be1f8 ffffffc0 0514feb0 ffffffc0 0008948c ffffffc0 fe80: 00000004 00000000 0514fed0 ffffffc0 ffffffff ffffffff 9282a948 0000007f fea0: 00000000 00000000 9282b708 0000007f c1592820 0000007f 00083914 ffffffc0 fec0: 00000000 00000000 00000010 00000000 00000064 00000000 00000001 00000000 fee0: 005101e0 00000000 c1594680 0000007f c1594740 0000007f ffffffd8 ffffff80 ff00: 00000000 00000000 00000000 00000000 c1594770 0000007f c1594770 0000007f ff20: 00665e10 00000000 7f7f7f7f 7f7f7f7f 01010101 01010101 00000000 00000000 ff40: 928e4cc0 0000007f 91ff11e8 0000007f call_break_hook is called in atomic context (hard irq disabled), so replace the sleepable lock to rcu lock. Signed-off-by: Yang Shi --- arch/arm64/kernel/debug-monitors.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c index cebf786..eb520d0 100644 --- a/arch/arm64/kernel/debug-monitors.c +++ b/arch/arm64/kernel/debug-monitors.c @@ -292,11 +292,11 @@ static int call_break_hook(struct pt_regs *regs, unsigned int esr) struct break_hook *hook; int (*fn)(struct pt_regs *regs, unsigned int esr) = NULL; - read_lock(&break_hook_lock); + rcu_read_lock(); list_for_each_entry(hook, &break_hook, node) if ((esr & hook->esr_mask) == hook->esr_val) fn = hook->fn; - read_unlock(&break_hook_lock); + rcu_read_unlock(); return fn ? fn(regs, esr) : DBG_HOOK_ERROR; }