From patchwork Tue Nov 29 13:45:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kochetkov X-Patchwork-Id: 9452141 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 1FE5060710 for ; Tue, 29 Nov 2016 13:52:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11E6D27F93 for ; Tue, 29 Nov 2016 13:52:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 068362832C; Tue, 29 Nov 2016 13:52:56 +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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 9937D27F93 for ; Tue, 29 Nov 2016 13:52:55 +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 1cBiq5-0006QU-PQ; Tue, 29 Nov 2016 13:52:53 +0000 Received: from mail-lf0-x243.google.com ([2a00:1450:4010:c07::243]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cBijL-0007mf-Tj; Tue, 29 Nov 2016 13:46:01 +0000 Received: by mail-lf0-x243.google.com with SMTP id 98so12666967lfs.0; Tue, 29 Nov 2016 05:45:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BU3TO70q64f9hOVZUx3Qm8RKtq7hIf+hCAvHBw8hbdk=; b=jTfirsy/ugOGCYKcaLfWx7IjHHrvznmLtEsLX2FjF6dJU8uGqQKvZ+6Ph4j2THNI/b +UILHOk801ZoPI6DPoeQ2wKVBLtai15O8u9vc2VoZs/vjs6G2xnotZ3vO9MiXhD6lKKn MaHKXvwyvBEGe1SsMJ0Ts7KJP221A2i7s6qCoW2HenzcgY1e7rSeamBznVJ2wlKWaSpX kNdvzcGOEn6+cC5ABKT0LL80FI/cuby+w3Yq/v5v8I3Tz0gZBaaejG+4M9lJz5G7GRkO UVEBhPsOO0V9neCVD8hybh6Nxq1+/U/8743kCvJFhdMwnUdBne0i/z4FPWNinbzF90Cx HYdg== 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:in-reply-to :references; bh=BU3TO70q64f9hOVZUx3Qm8RKtq7hIf+hCAvHBw8hbdk=; b=H6bIhKSt4ogw8aTNex5IX8g+yyx0x8jdJ5xBMyVCyC5KZ/LlmAWdtF1RKuzayT/hIx AqcxkRloA3W+OxwqtScmjdnNw3XzAX2uSEdlwqVrkiq1t6smY5zQv2hk2qhCmdA39d5r MLtKXWxMp3PF+WoaWS/DZjciKAbmItXlpUl2bH0mpNJwraOxczRdUi7c/IWeBQshlqSl /aSMXttmjueD61cy0kleLiOlQ3lNGMS64UNRszdrX9UiJayR+Qq7SWFL2tpeJbxaqEy4 spNC+GnIyW/eZsJM+3wFGjjj02RJlKG2YEiOfcyTnmffhSMUCQDUO4pc8mipbTbzsrTc cExw== X-Gm-Message-State: AKaTC03+RbcV8640NpPPjajHAQrncOWqlAgQP0yqAPDMyXHMjR+dLhu5yVyln7Y1xoUiuQ== X-Received: by 10.25.67.2 with SMTP id q2mr11091854lfa.22.1480427138584; Tue, 29 Nov 2016 05:45:38 -0800 (PST) Received: from ubuntu.lintech.local ([185.35.119.87]) by smtp.gmail.com with ESMTPSA id y3sm250543lfj.42.2016.11.29.05.45.37 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 29 Nov 2016 05:45:37 -0800 (PST) From: Alexander Kochetkov To: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org Subject: [PATCH v3 13/13] clocksource/drivers/rockchip_timer: Prevent ftrace recursion Date: Tue, 29 Nov 2016 16:45:18 +0300 Message-Id: <1480427118-5126-14-git-send-email-al.kochet@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1480427118-5126-1-git-send-email-al.kochet@gmail.com> References: <1480343486-25539-1-git-send-email-al.kochet@gmail.com> <1480427118-5126-1-git-send-email-al.kochet@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161129_054556_579999_0BD27504 X-CRM114-Status: GOOD ( 11.72 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Huang Tao , Heiko Stuebner , Alexander Kochetkov , Daniel Lezcano , Russell King , Rob Herring , Thomas Gleixner , Caesar Wang MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Currently rockchip_timer can be used as a scheduler clock. We properly marked rk_timer_sched_clock_read() as notrace but we then call another function rk_timer_counter_read() that _wasn't_ notrace. Having a traceable function in the sched_clock() path leads to a recursion within ftrace and a kernel crash. Fix this by adding an extra notrace function to keep other users of rk_timer_counter_read() traceable. Signed-off-by: Alexander Kochetkov --- drivers/clocksource/rockchip_timer.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/clocksource/rockchip_timer.c b/drivers/clocksource/rockchip_timer.c index 1af80a0..a127822 100644 --- a/drivers/clocksource/rockchip_timer.c +++ b/drivers/clocksource/rockchip_timer.c @@ -87,7 +87,7 @@ static void rk_timer_update_counter(u64 cycles, struct rk_timer *timer) writel_relaxed(upper, timer->base + TIMER_LOAD_COUNT1); } -static u64 rk_timer_counter_read(struct rk_timer *timer) +static u64 notrace _rk_timer_counter_read(struct rk_timer *timer) { u64 counter; u32 lower; @@ -106,6 +106,11 @@ static u64 rk_timer_counter_read(struct rk_timer *timer) return counter; } +static u64 rk_timer_counter_read(struct rk_timer *timer) +{ + return _rk_timer_counter_read(timer); +} + static void rk_timer_interrupt_clear(struct rk_timer *timer) { writel_relaxed(1, timer->base + TIMER_INT_STATUS); @@ -168,7 +173,7 @@ static u64 notrace rk_timer_sched_clock_read(void) { struct rk_clocksource *_cs = &cs_timer; - return ~rk_timer_counter_read(&_cs->timer); + return ~_rk_timer_counter_read(&_cs->timer); } static int __init rk_timer_init(struct device_node *np, u32 ctrl_reg)