From patchwork Thu Sep 8 12:46:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Zhang X-Patchwork-Id: 9321275 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 52F39607D3 for ; Thu, 8 Sep 2016 12:48:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 419C229836 for ; Thu, 8 Sep 2016 12:48:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3624A29839; Thu, 8 Sep 2016 12:48:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B8ACA29836 for ; Thu, 8 Sep 2016 12:48:49 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bhyjn-0005tj-A9; Thu, 08 Sep 2016 12:47:27 +0000 Received: from mail-pa0-x22a.google.com ([2607:f8b0:400e:c03::22a]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bhyje-0005ol-G4 for linux-arm-kernel@lists.infradead.org; Thu, 08 Sep 2016 12:47:22 +0000 Received: by mail-pa0-x22a.google.com with SMTP id cm16so17260759pac.0 for ; Thu, 08 Sep 2016 05:46:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=VAupS1EwRHQqU4Uad6xD5LC4Zf3aEzNnGCuK0CodPvg=; b=Hif6VtLtqZLorOtnkwCtCHRF66uaiNmMdFnd5k/jTaPc9oLm1+zd88ZRGC/M9dUp+r rAiJPhoqNUmYTNbhEoui7+r9+kBbAvN1J9iW1rZbEotI2TfdSkWpr//AmxFDDlS5SO9w 1OdKz5KjsCHf1mPkX2zZgmcezCgFLA2J4enA4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=VAupS1EwRHQqU4Uad6xD5LC4Zf3aEzNnGCuK0CodPvg=; b=Fzzlrnd0g9eVrWrjViYZqYFyVQeorJ3GM2z0Xj/qgRHyQnu+BwX2rm3DUswRMPRge0 oV9BsjSsLk3oSLNQe+sb9KjGEBzElo3MBeGghZCqu4K1WUEQK2ggapE1/VhE1ADizzZx YqvWO9Hca4+yFc1kk2WQX1ahmVlIn0me9Ag1wR9SFt9FsUmQ5H3UMajVtHKBnVEZdeM3 forMdKVeqQOUcRCNNj9CZYA8phCeEJ2LnuodipLDI9rpzSKTbHYx56uAs5EZK54IlnQi nhmP2FfhbkeX27wPoFTMfvzVBwz9ngOLJn+eTYgK+8AEHTkcvE0e65UXt2iPEREETPXw 1tUg== X-Gm-Message-State: AE9vXwPwyc2m+/sIjnbgVzz3Kh0lyboHGckSKG2O0Vig1fFKby/5GYKJOrkFoxne2hf9Zt4f X-Received: by 10.66.10.162 with SMTP id j2mr49996104pab.3.1473338817058; Thu, 08 Sep 2016 05:46:57 -0700 (PDT) Received: from ubuntu16.spreadtrum.com ([175.111.195.49]) by smtp.gmail.com with ESMTPSA id an11sm56353453pac.26.2016.09.08.05.46.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Sep 2016 05:46:56 -0700 (PDT) From: Chunyan Zhang To: rostedt@goodmis.org, mingo@redhat.com Subject: [PATCH] arm64: use preempt_disable_notrace in _percpu_read/write Date: Thu, 8 Sep 2016 20:46:42 +0800 Message-Id: <1473338802-18712-1-git-send-email-zhang.chunyan@linaro.org> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160908_054718_641730_B9BD5C4C X-CRM114-Status: GOOD ( 11.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.yang@spreadtrum.com, zhang.lyra@gmail.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, takahiro.akashi@linaro.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP When debug preempt or preempt tracer is enabled, preempt_count_add/sub() can be traced by function and function graph tracing, and preempt_disable/enable() would call preempt_count_add/sub(), so in Ftrace subsystem we should use preempt_disable/enable_notrace instead. In the commit 345ddcc882d8 ("ftrace: Have set_ftrace_pid use the bitmap like events do") the function this_cpu_read() was added to trace_graph_entry(), and if this_cpu_read() calls preempt_disable(), graph tracer will go into a recursive loop, even if the tracing_on is disabled. So this patch change to use preempt_enable/disable_notrace instead in this_cpu_read(). Since Yonghui Yang helped a lot to find the root cause of this problem, so also add his SOB. Signed-off-by: Yonghui Yang Signed-off-by: Chunyan Zhang Acked-by: Will Deacon --- arch/arm64/include/asm/percpu.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm64/include/asm/percpu.h b/arch/arm64/include/asm/percpu.h index 0a456be..2fee2f5 100644 --- a/arch/arm64/include/asm/percpu.h +++ b/arch/arm64/include/asm/percpu.h @@ -199,19 +199,19 @@ static inline unsigned long __percpu_xchg(void *ptr, unsigned long val, #define _percpu_read(pcp) \ ({ \ typeof(pcp) __retval; \ - preempt_disable(); \ + preempt_disable_notrace(); \ __retval = (typeof(pcp))__percpu_read(raw_cpu_ptr(&(pcp)), \ sizeof(pcp)); \ - preempt_enable(); \ + preempt_enable_notrace(); \ __retval; \ }) #define _percpu_write(pcp, val) \ do { \ - preempt_disable(); \ + preempt_disable_notrace(); \ __percpu_write(raw_cpu_ptr(&(pcp)), (unsigned long)(val), \ sizeof(pcp)); \ - preempt_enable(); \ + preempt_enable_notrace(); \ } while(0) \ #define _pcp_protect(operation, pcp, val) \