From patchwork Fri Dec 5 14:51:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 5444351 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5DAA39F1D4 for ; Fri, 5 Dec 2014 14:53:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7DEC3201EC for ; Fri, 5 Dec 2014 14:53:53 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8A959201B4 for ; Fri, 5 Dec 2014 14:53:52 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XwuEP-00057A-P1; Fri, 05 Dec 2014 14:51:41 +0000 Received: from nm38-vm9.bullet.mail.bf1.yahoo.com ([72.30.239.25]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XwuEL-0004xl-BT for linux-arm-kernel@lists.infradead.org; Fri, 05 Dec 2014 14:51:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1417791075; bh=KYrSWYH+/mYvYGZHnBCKE3c+5marrKJjL5AM7s1jAzA=; h=From:To:Cc:Subject:Date:From:Subject; b=TyPpb3dBXr07WAIVlfZfAB4Kz2IqvT9iDg5efeUYZ6b0bYtOMS9QA3rPChcJUMMHuPtAbJynLyTNQFXlf7z8WLIdtq63pSgjfRkk/8dBByeZB3/R7J7z8yufhPftSMpqinweZ0iNlJbGTd0MNNPECya/jQfobtoiFydjBTLl9/LLjVjWghSkQ0Qk2C8KHo59qR7mBTntPhNkLGmqIjYhE/tBuExqmBBp52uztyKSUDW/beU223VlUpHGhkg/iMr//qVbu2WffO+2M7pgog1nRN3Xnp2Gsm8R3g1LwAp02ZYmQEeqr6vVVdsIiepRmoQs8vSEVg+MQYiyjjC14NVkrw== DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s2048; d=yahoo.com; b=UwiyguyjRTJI5HY13fygG86W3swXVRq+fWdnR+TJW0IkSM0yl7nkwSrk6kJkHOTuSUVSghL/OzUDe+cZqeZp7vbFuZNxEvEye4WVgCF2f16wqJZxL/4wUTM2Rp+92qGfr2NpNEe3YlOzGjmrOAfpSiXwwMIEeEKJW92ap//T26jtU6f+AqQ2dWT4IEKk8lOYEQ/VUkNHwAlrNv/0Hu9JCfTPEcJn5vj7xR1fQWH5cIeHN/Lrpqb3oFo8JTdqCaSbKSn0hgcnRsbeAq+/XlzNqtlH6JX+afW6b+ow3RgCicVVMO8EeNqKk1fiikZzC1V4BJr2G06exxxsqHPffBHodw==; Received: from [98.139.215.140] by nm38.bullet.mail.bf1.yahoo.com with NNFMP; 05 Dec 2014 14:51:15 -0000 Received: from [98.139.211.162] by tm11.bullet.mail.bf1.yahoo.com with NNFMP; 05 Dec 2014 14:51:15 -0000 Received: from [127.0.0.1] by smtp219.mail.bf1.yahoo.com with NNFMP; 05 Dec 2014 14:51:15 -0000 X-Yahoo-Newman-Id: 343947.18679.bm@smtp219.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: 1.v6rekVM1lhsNtBvj4WsRkO0NagczhX2n7kxlzlA7QJaEc EJzGW4ItYOyoxhNQf6ImPtH80Rn1AxRjs5R44VBNAE.HtbIwgetyFdoMjYHT .2lmrk9UQo0toS3gFgI4P8fOoVqua7OSV6lbXPzBxX8AL9I7oRt1_RPojzjW aAG.5etnBrA8oIB5w38Ro94g77XMQmQGSY3fIc6ngHztEHsypWlYHtiviQCy UT53cBuyFWBX3I9UGHvJU1BJ1GO71XYL7V6Qm7zKR5lteTA6pVgn30jtGfs_ 2EvNkDUQTOcAAUOdvTn16uNwVTBVVSa3kffKOLy65mPhV6W9uURQpifGvh4F TvkBWUhYg2qA0ihQSfUjXRFVRSaMlLkEtEiVfAvnIXDppP4s88PJVo9rdE5e 0gX2nw300RCGWQy40VKsamQkH8p9vhj5L31tM4r6tJ.S43Db8AJoqIAM8656 5wy2Fevjm_yW7qPGMf09.FPr0Kn0aeK9djfJVnVsEc9Moc1rIO58rEx.E8HY KKrPKKg1QxTL4N8Qo78i5lEchLunV.Kz. X-Yahoo-SMTP: Yh1ZCseswBB87.sev4MWOyuvEVa7giM- From: Anand Moon To: Russell King , Rabin Vincent , Anand Moon , "David A. Long" Subject: [PATCH] do_work_pending: Enable interrupts in do_work_pending() Date: Fri, 5 Dec 2014 20:21:06 +0530 Message-Id: <1417791066-5458-1-git-send-email-moon.linux@yahoo.com> X-Mailer: git-send-email 2.1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141205_065137_564136_CBC2B814 X-CRM114-Status: GOOD ( 13.90 ) X-Spam-Score: -0.1 (/) Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FORGED_YAHOO_RCVD, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP A recent change triggered a WARN_ON that interrupts were disabled, and in fact other architectures enable interrupts uniformly for their related do_work_pending() type code, and all the things we call from this routine appear to expect interrupts to be enabled. So, enable them. Below is the warning. [ 12.094106] systemd-udevd[1643]: starting version 204 [ 13.466537] ------------[ cut here ]------------ [ 13.469750] WARNING: CPU: 1 PID: 1645 at kernel/locking/lockdep.c:3536 check_flags+0x7c/0x1d0() [ 13.478397] DEBUG_LOCKS_WARN_ON(current->hardirqs_enabled) [ 13.483663] Modules linked in: [ 13.486863] CPU: 1 PID: 1645 Comm: systemd-udevd Not tainted 3.17.4-arm7 #6 [ 13.493851] [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [ 13.501563] [] (show_stack) from [] (dump_stack+0x80/0xac) [ 13.508753] [] (dump_stack) from [] (warn_slowpath_common+0x60/0x84) [ 13.516808] [] (warn_slowpath_common) from [] (warn_slowpath_fmt+0x2c/0x3c) [ 13.525463] [] (warn_slowpath_fmt) from [] (check_flags+0x7c/0x1d0) [ 13.533447] [] (check_flags) from [] (lock_is_held+0x34/0x60) [ 13.540884] [] (lock_is_held) from [] (__schedule+0x98/0x7cc) [ 13.548342] [] (__schedule) from [] (do_work_pending+0x28/0xbc) [ 13.555962] [] (do_work_pending) from [] (work_pending+0xc/0x20) [ 13.563663] ---[ end trace 33bbfa4173cfa520 ]--- [ 13.568238] possible reason: unannotated irqs-off. [ 13.573005] irq event stamp: 5227 [ 13.576293] hardirqs last enabled at (5227): [] ret_fast_syscall+0x24/0x48 [ 13.584096] hardirqs last disabled at (5226): [] ret_fast_syscall+0xc/0x48 [ 13.591823] softirqs last enabled at (5222): [] __do_softirq+0x1e8/0x270 [ 13.599447] softirqs last disabled at (5205): [] irq_exit+0x84/0xf4 [ 13.656634] random: nonblocking pool is initialized Signed-off-by: Anand Moon --- arch/arm/kernel/signal.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c index bd19834..52bc9d6 100644 --- a/arch/arm/kernel/signal.c +++ b/arch/arm/kernel/signal.c @@ -476,7 +476,7 @@ setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs) /* * OK, we're invoking a handler - */ + */ static void handle_signal(struct ksignal *ksig, struct pt_regs *regs) { sigset_t *oldset = sigmask_to_save(); @@ -574,12 +574,14 @@ asmlinkage int do_work_pending(struct pt_regs *regs, unsigned int thread_flags, int syscall) { do { + if (unlikely(!user_mode(regs))) + return 0; + /* Enable interrupts; they are disabled again on return to + * caller. */ + local_irq_enable(); if (likely(thread_flags & _TIF_NEED_RESCHED)) { schedule(); } else { - if (unlikely(!user_mode(regs))) - return 0; - local_irq_enable(); if (thread_flags & _TIF_SIGPENDING) { int restart = do_signal(regs, syscall); if (unlikely(restart)) { @@ -588,6 +590,7 @@ do_work_pending(struct pt_regs *regs, unsigned int thread_flags, int syscall) * Deal with it without leaving * the kernel space. */ + local_irq_disable(); return restart; } syscall = 0;