From patchwork Thu Mar 21 00:02:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 2310641 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 2DC8740213 for ; Thu, 21 Mar 2013 00:05:32 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UISyQ-00064c-2v; Thu, 21 Mar 2013 00:03:14 +0000 Received: from mail-pd0-f181.google.com ([209.85.192.181]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UISxT-0005pq-5U for linux-arm-kernel@lists.infradead.org; Thu, 21 Mar 2013 00:02:16 +0000 Received: by mail-pd0-f181.google.com with SMTP id q10so814563pdj.40 for ; Wed, 20 Mar 2013 17:02:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=lWlyf6ge8F6VdqHggXW573c0F5O9KDNl3eqh+F2MIUw=; b=U5uNzxttpSwrpbwKm7+C2YlRAZLZlZlGcG2wit0nI3aOY1NwqqPSOCA5viUE7dIhSw egN+PpCFVykFlmSI88gf2wx0zPI4nFrpa402O/WSdYvXRI+pg7Qyh3/1Rh0MTUFHF+aD y8XZax2vSP3SalPjRUxwZCor4gtgSQLMBKb2VX3NAbkCYObZo1eUvNX/ncn5rbheTB1m 2837vkA4jrBuqZCMFNkkZ6V196veVY1OaxRnHh8ptjFQNBWL66KmZCNUJOAJwcbAlSSS D9/AoQwXrS7Q4d+BCVEudrYO8bHsb6NwOrlbpDcDoi+szdzEQHsaeUT2Dbh3m+a/bRDG MKuw== X-Received: by 10.66.156.196 with SMTP id wg4mr12210378pab.23.1363824133756; Wed, 20 Mar 2013 17:02:13 -0700 (PDT) Received: from localhost (c-24-19-7-36.hsd1.wa.comcast.net. [24.19.7.36]) by mx.google.com with ESMTPS id i10sm3759104pbd.1.2013.03.20.17.02.11 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 20 Mar 2013 17:02:12 -0700 (PDT) From: Kevin Hilman To: Frederic Weisbecker , Russell King , linux-kernel@vger.kernel.org Subject: [PATCH 3/4] ARM: context tracking: handle post exception/syscall/IRQ work Date: Wed, 20 Mar 2013 17:02:00 -0700 Message-Id: <1363824121-26169-4-git-send-email-khilman@linaro.org> X-Mailer: git-send-email 1.8.2 In-Reply-To: <1363824121-26169-1-git-send-email-khilman@linaro.org> References: <1363824121-26169-1-git-send-email-khilman@linaro.org> X-Gm-Message-State: ALoCoQkcgJIOHxFmB813VBAW/QAok2ClAnFNYQf0KAL4g/G2t6s4P4gFIdxs/W87IZJh56GnKv8P X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130320_200215_376643_F1410DFE X-CRM114-Status: GOOD ( 14.45 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [209.85.192.181 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Paul McKenney , linaro-kernel@lists.linaro.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 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 do_work_pending() may be called on IRQ, exception or syscall exit (for reschedule, signal handling, etc.) , but user_enter() may have already been called (e.g. by syscall return path.) Since do_work_pending() is still in kernel mode, keep context_tracker up to date by using user_exit/user_enter. Based on commit edf55fda35c7dc7f2d9241c3abaddaf759b457c6 (x86: Exit RCU extended QS on notify resume) Signed-off-by: Kevin Hilman --- arch/arm/kernel/signal.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c index 296786b..42514fd 100644 --- a/arch/arm/kernel/signal.c +++ b/arch/arm/kernel/signal.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -575,12 +576,15 @@ static int do_signal(struct pt_regs *regs, int syscall) asmlinkage int do_work_pending(struct pt_regs *regs, unsigned int thread_flags, int syscall) { + int retval = 0; + + user_exit(); do { if (likely(thread_flags & _TIF_NEED_RESCHED)) { schedule(); } else { if (unlikely(!user_mode(regs))) - return 0; + break; local_irq_enable(); if (thread_flags & _TIF_SIGPENDING) { int restart = do_signal(regs, syscall); @@ -590,7 +594,8 @@ do_work_pending(struct pt_regs *regs, unsigned int thread_flags, int syscall) * Deal with it without leaving * the kernel space. */ - return restart; + retval = restart; + break; } syscall = 0; } else { @@ -601,5 +606,6 @@ do_work_pending(struct pt_regs *regs, unsigned int thread_flags, int syscall) local_irq_disable(); thread_flags = current_thread_info()->flags; } while (thread_flags & _TIF_WORK_MASK); - return 0; + user_enter(); + return retval; }