From patchwork Fri Nov 30 15:08:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 10706505 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3B3BD13BF for ; Fri, 30 Nov 2018 15:09:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 29844301A4 for ; Fri, 30 Nov 2018 15:09:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1D51B301DC; Fri, 30 Nov 2018 15:09:35 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F26F4301A4 for ; Fri, 30 Nov 2018 15:09:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=38ZviJRJAozpW1Gj5F1cYN3vdpyBwR7uBF6MwHIL79Q=; b=h4IdXzu5ZVn2Q1 FexiPFVOLaBW64zVRYydxzHhq7nBPnnU6x/A7MXzrzsyna70BEq9nTEU6Dadrp5DS4USDYXjgR08M 4EW5nfmJUxFX6X/3T3Y9puYfhd+WUgJnwKXJnzOddlrbKP8J7980tjGQCFjTan1RwFYVlu6/prqUR kNoIjd3bh0wPYmxXlchgdOSYarexxYFyoLKBiafTYkr0g61B0K/j2DTxecjdekXdnr4hFki7to0Ah r/2zCy2xqZ/tjXoJiJYPHpzp1+lvhT7+m3tLwu9Cp8LYqQn9EbRcSb1kyvTBKzFbsFWPe2CiwOAph BwTKGPOXViUdPhEvYxyg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gSkQ4-0001dZ-Do; Fri, 30 Nov 2018 15:09:28 +0000 Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gSkQ1-0001cg-I2 for linux-arm-kernel@lists.infradead.org; Fri, 30 Nov 2018 15:09:27 +0000 Received: by mail-lj1-x241.google.com with SMTP id s5-v6so5265397ljd.12 for ; Fri, 30 Nov 2018 07:09:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=cevKt/iVwCRv9xli91T/QyVSDidq+ft7LMiFzNhTbQc=; b=Awggy/OCtNUr8kqjtPE28UJFmBPZvDO48FDcUcWjDpeHWrRglJpug7qXTQQCvQ05ER 3mxRE/+7bidUJDNjqD7hHAVoV43JehZ2xsPfFjbcEKATeafqVHOrvmCANLYzYuDpH3r8 rPB9SO9J5Zarads+PxHl3nlT9XF8dBjrwROTc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=cevKt/iVwCRv9xli91T/QyVSDidq+ft7LMiFzNhTbQc=; b=U/XmL7eMg8Swk0vHBee+vNg1cGhGZXX/+SrdhPulgT9tQgCFrqT5FfDJmQOYrXbstH 3QQa1/NY4iEO6zsLuLjvHHRx14LvKXd2Z5Ass+L+IaFW/MPWLP1mm06auWtqlfv7xOBm WPxOlYrGYsnDXaJsx4t8XDYT/5n8S2iVJ0B6O4OWRn3tftY1Q44CDUVhbVFvBGcfPq9A hxovOydOqgJi6Ng/1tl+Q9C+ymf+q16F5q4CkczH7tZVXGk2lX6X0/Hz120C3MBmmZal vb3s7OnRVE+6II0iCA+V9cARIfI1hB97Qus5Zx1fUpO87J05Cwb3PWPdq8Nj6u3UD0HD vezw== X-Gm-Message-State: AA+aEWaVyHFfR10pmQmezOI4ckr8tZ9R+bTU1oJmS4XT3lIm5w44EX2j V5ybJA0J+rkpfvB7OTjoXAplWA== X-Google-Smtp-Source: AFSGD/VpYrmoJeyL8d7+PEaIv5jYwhLzngu/YEuvShEtkOCRXOuRE9OyVVKm+SuLrVdW6w4L5WrvSw== X-Received: by 2002:a2e:568b:: with SMTP id k11-v6mr4225309lje.105.1543590553021; Fri, 30 Nov 2018 07:09:13 -0800 (PST) Received: from localhost (c-732171d5.07-21-73746f28.bbcust.telenor.se. [213.113.33.115]) by smtp.gmail.com with ESMTPSA id o26sm912850lfl.18.2018.11.30.07.09.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Nov 2018 07:09:12 -0800 (PST) From: Anders Roxell To: keescook@chromium.org Subject: [PATCH 1/3] stackleak: mark stackleak_track_stack() as notrace Date: Fri, 30 Nov 2018 16:08:59 +0100 Message-Id: <20181130150859.27366-1-anders.roxell@linaro.org> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181130_070925_595120_EAE3044A X-CRM114-Status: GOOD ( 12.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anders Roxell , Arnd Bergmann , catalin.marinas@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, rostedt@goodmis.org, mingo@redhat.com, linux-arm-kernel@lists.infradead.org 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 Function graph tracing recurses into itself when stackleak is enabled, causing the ftrace graph selftest to run for up to 90 seconds and trigger the softlockup watchdog. Breakpoint 2, ftrace_graph_caller () at ../arch/arm64/kernel/entry-ftrace.S:200 200 mcount_get_lr_addr x0 // pointer to function's saved lr (gdb) bt \#0 ftrace_graph_caller () at ../arch/arm64/kernel/entry-ftrace.S:200 \#1 0xffffff80081d5280 in ftrace_caller () at ../arch/arm64/kernel/entry-ftrace.S:153 \#2 0xffffff8008555484 in stackleak_track_stack () at ../kernel/stackleak.c:106 \#3 0xffffff8008421ff8 in ftrace_ops_test (ops=0xffffff8009eaa840 , ip=18446743524091297036, regs=) at ../kernel/trace/ftrace.c:1507 \#4 0xffffff8008428770 in __ftrace_ops_list_func (regs=, ignored=, parent_ip=, ip=) at ../kernel/trace/ftrace.c:6286 \#5 ftrace_ops_no_ops (ip=18446743524091297036, parent_ip=18446743524091242824) at ../kernel/trace/ftrace.c:6321 \#6 0xffffff80081d5280 in ftrace_caller () at ../arch/arm64/kernel/entry-ftrace.S:153 \#7 0xffffff800832fd10 in irq_find_mapping (domain=0xffffffc03fc4bc80, hwirq=27) at ../kernel/irq/irqdomain.c:876 \#8 0xffffff800832294c in __handle_domain_irq (domain=0xffffffc03fc4bc80, hwirq=27, lookup=true, regs=0xffffff800814b840) at ../kernel/irq/irqdesc.c:650 \#9 0xffffff80081d52b4 in ftrace_graph_caller () at ../arch/arm64/kernel/entry-ftrace.S:205 Rework so we mark stackleak_track_stack as notrace Co-developed-by: Arnd Bergmann Signed-off-by: Arnd Bergmann Signed-off-by: Anders Roxell Acked-by: Steven Rostedt (VMware) Acked-by: Kees Cook --- kernel/stackleak.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/stackleak.c b/kernel/stackleak.c index e42892926244..5de3bf596dd7 100644 --- a/kernel/stackleak.c +++ b/kernel/stackleak.c @@ -102,7 +102,7 @@ asmlinkage void stackleak_erase(void) current->lowest_stack = current_top_of_stack() - THREAD_SIZE/64; } -void __used stackleak_track_stack(void) +void __used notrace stackleak_track_stack(void) { /* * N.B. stackleak_erase() fills the kernel stack with the poison value, From patchwork Fri Nov 30 15:09:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 10706507 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F0E2B4B7E for ; Fri, 30 Nov 2018 15:10:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DBF25301DC for ; Fri, 30 Nov 2018 15:10:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C950B301DB; Fri, 30 Nov 2018 15:10:07 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 40593301DB for ; Fri, 30 Nov 2018 15:10:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=Myj9RWllSTJvHgOJXB1/Jnc6EAaNg1iJhm5rvnMa8Iw=; b=m6XZerLx+8fX66 fQZq9YJ+MpxfTWPPFnbICeaMK7EEns3CqlAifrBYNYM5/ELX06HjkIeuTDYPhigFrZ0QPmArkEkn2 QTF8DavVOqA6Y6Gg31ZdhMu+XWtyFLooPMA1BkMbwV82TwwlEfjy5FyP9ciHvuZWb8KENsRJ9Sm6b FdTwFWaKP2HUSpadLrHyGbkYBbvTfdflG5ZQDtQziNpEEsDVmyVZ6Gm+Z8lpv37LcOBq5p8ygEYYU 9ZhCuJTJVHXS2Kn3YN7MEiG4VYhO4vOcI5VMFvnGR7sUcQSGZlPLmiL/4rtCD1V8/Ugy6KCsao50Y su9Hw4hyPuf8OWjo7pvA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gSkQZ-0001ub-Na; Fri, 30 Nov 2018 15:09:59 +0000 Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gSkQT-0001rB-Dq for linux-arm-kernel@lists.infradead.org; Fri, 30 Nov 2018 15:09:57 +0000 Received: by mail-lj1-x244.google.com with SMTP id c19-v6so5280871lja.5 for ; Fri, 30 Nov 2018 07:09:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=85KCfW3nCq0jcrH/zFnUuLUEVTX2XkKXX7xHs/xruHs=; b=WNS16U3TAIi5WGm5/3zTJ2oj/8f7Bw4KwTRN0E//6gsK3l1u34sRnv6d5ZG5z5zWQ7 PcZ0kyC6Szpe2UqHpD/LQk4EH5yKVxrozSKWpPRqkjoH8OkCZzyBcQSUUm/zNktPBV3V MTh5lTnssACP+mGsV8MK2EJAH5IBj+JFqmSg0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=85KCfW3nCq0jcrH/zFnUuLUEVTX2XkKXX7xHs/xruHs=; b=qxKrRSwVa2JeVasJq40YVgLc6kDkKl93ZbJ37kRCwKxGJdH+gLrXpOzbae6x162X6d 1RwmsY8AIhJG2dn3YmYHQh2VDpzwlzs0txg8LSkmm02DhquGbTCRvQ7W1Dsy4Qy+ivRy sLFuo2m2eIheKTNA117GY+OemHY3PS1LjLjQZ5uRb19r9eZ2yoXgbwnfRqrKf+I4xRYO NN1jasiKHgkccXxTBBtUO51BQ0ClO5HTvE9ACod4dDjhrt44o/qsN6n9XNIml9QmpHIb JiQ8Xtq0oMhnqv5h11ohjyNuPvNQ3h1AE4SN/lwKSsC/Sb3Bpvxp+1KSvFAsFZxnctqB 5h0w== X-Gm-Message-State: AA+aEWZmnJ2HYjUc4ciZzl7eaQfVN/qAWi3ptKb2WqSbtW7T4EqvN027 yERZQAkVZiy710ZLkndou5P5DQ== X-Google-Smtp-Source: AFSGD/XiXiNiOaeLEUQYh09lGs4UYroBPv8sdQvKtrB54ACrUz6h8+MIjRencTE8CpHxNyL66BEz1A== X-Received: by 2002:a2e:9ad0:: with SMTP id p16-v6mr4448681ljj.102.1543590581488; Fri, 30 Nov 2018 07:09:41 -0800 (PST) Received: from localhost (c-732171d5.07-21-73746f28.bbcust.telenor.se. [213.113.33.115]) by smtp.gmail.com with ESMTPSA id m13-v6sm858237ljg.56.2018.11.30.07.09.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Nov 2018 07:09:40 -0800 (PST) From: Anders Roxell To: rostedt@goodmis.org, mingo@redhat.com Subject: [PATCH 2/3] tracing: instruct KCOV not to track tracing files Date: Fri, 30 Nov 2018 16:09:35 +0100 Message-Id: <20181130150935.27493-1-anders.roxell@linaro.org> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181130_070953_528177_6E1F4987 X-CRM114-Status: UNSURE ( 9.48 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anders Roxell , keescook@chromium.org, Arnd Bergmann , catalin.marinas@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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 we have KCOV enabled and running ftrace startup tests we end up in a softlockup. Kcov and ftrace tracing each other makes it really slow: [ 275.141388] Testing tracer wakeup_dl: PASSED [ 304.738345] Testing tracer function_graph: [ 716.236822] watchdog: BUG: soft lockup - CPU#0 stuck for 21s! [ksoftirqd/0:9] Rework so that we don't let KCOV look at tracing files. Could probably be more selective here, but in in general letting KCOV and ftrace check each isn't the best idea. Co-developed-by: Arnd Bergmann Signed-off-by: Arnd Bergmann Signed-off-by: Anders Roxell Acked-by: Steven Rostedt (VMware) --- kernel/trace/Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/trace/Makefile b/kernel/trace/Makefile index f81dadbc7c4a..c7c73b976103 100644 --- a/kernel/trace/Makefile +++ b/kernel/trace/Makefile @@ -6,6 +6,11 @@ ifdef CONFIG_FUNCTION_TRACER ORIG_CFLAGS := $(KBUILD_CFLAGS) KBUILD_CFLAGS = $(subst $(CC_FLAGS_FTRACE),,$(ORIG_CFLAGS)) +# If instrumentation of this dir is enabled, the function tracer gets really +# slow. Probably could be more selective here, but note that files related +# to tracing.shouldn't be traced anyway. +KCOV_INSTRUMENT := n + ifdef CONFIG_FTRACE_SELFTEST # selftest needs instrumentation CFLAGS_trace_selftest_dynamic.o = $(CC_FLAGS_FTRACE) From patchwork Fri Nov 30 15:09:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 10706509 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 20D9314D6 for ; Fri, 30 Nov 2018 15:10:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1068C301A4 for ; Fri, 30 Nov 2018 15:10:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 04367301DC; Fri, 30 Nov 2018 15:10:31 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id ACAD5301A4 for ; Fri, 30 Nov 2018 15:10:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=+q17sQuySDR/q4wYk2lSywRX1d1gJgx1lwQUjnY4cOU=; b=HeTAqF1o5e3f+R iTbJA8pYfOn1mu5HFqvJwb3mLK26PEuAy2KFoB6bf7NfDgtwkkpalF4qTCpwLstu1M/sqLijlMUZf zHlxiyx8A5sGa09k3Fl5D2+wJCckWKYHCS4dBvdpPomq9JjseyznQf3J7jmISUXDrLYx2+Ui1Hbhp c7biY1nz4w6sJY+/s4w8RQOqlTtMb0FpcEdTQgvWP7/r12aD+Z3X0vK9ygbRcAcYi6+WWivXDshFq GBngIYXvflUi5IHxVq0zZBTKhzx09KDcrkxvmA6sCS59n2DnDFna8M8UX8QUBUR71/zrJMQh00M1/ 5HOtUkfsrnJ6ydHmNGEQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gSkR1-0003UD-Mj; Fri, 30 Nov 2018 15:10:27 +0000 Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gSkQq-00026x-MK for linux-arm-kernel@lists.infradead.org; Fri, 30 Nov 2018 15:10:19 +0000 Received: by mail-lj1-x244.google.com with SMTP id t9-v6so5271431ljh.6 for ; Fri, 30 Nov 2018 07:10:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Sn6e2y3hrDqC5F6PRoRA5dBPL+JkfPGNchhGjAsqyhg=; b=Hf7NYzdsmIc6gAHEOJdgMn9FEKqpFUYVf1s5w8KySpDhefcB22MF6kW3XbmiACEez1 HV2hfJXyGxMtTxhQ4QgB9N1w1TcnvBd2Cvid6LJkfE61lw8uF5dDOjj/MCu39gv5xWp+ BFKA63Mww/JBddGUnzn5SLq7D9t7SFm1wdLnY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Sn6e2y3hrDqC5F6PRoRA5dBPL+JkfPGNchhGjAsqyhg=; b=b7rc7DzCYzad2nKi8YQYkFCWhA3gnTqYvF9D8aZHDkl0Y1yWK3yLTYF0S5ZAXayplf 01KE814J7UWKrBNiDa3omI5WQTTheligJpZBv594vAa6KBRUsqplXlwhNsDT/2IzfSJI nXIFtrOszIC/isRGU00xhNfyCBsKaWKY2OhrDWp8LuvH6wPAg2ceRHMJi5L9SS9lmW4N KzOVudzkDRsZuT/DsfgMdDV4VuuFiobvd7+iOT7LD1TeaJtnV3s22AU6614MY0YvYUf2 uX/Dmq4txygVauRtk3xh5XVjPO+hTRDcvox10p8N8Ff1MV5turV3H88oyY4LQ3ojV5Vo JiCw== X-Gm-Message-State: AA+aEWbu5Ry5wep0cgVYhwskiUVNGwGgBJDhURgR41oRexbbKgLf297L Zt7aQE8whq+CO45OLu8LXZaGeg== X-Google-Smtp-Source: AFSGD/WJEpxEpyZY8TB/f9eIF5AJ1VuRqInkmOD8qy4TLDhGqq3K4SiweALxfqHhJNLP8p1a5+nn5w== X-Received: by 2002:a2e:9017:: with SMTP id h23-v6mr3612440ljg.71.1543590604769; Fri, 30 Nov 2018 07:10:04 -0800 (PST) Received: from localhost (c-732171d5.07-21-73746f28.bbcust.telenor.se. [213.113.33.115]) by smtp.gmail.com with ESMTPSA id a11sm865169lfb.68.2018.11.30.07.10.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Nov 2018 07:10:04 -0800 (PST) From: Anders Roxell To: rostedt@goodmis.org, mingo@redhat.com, catalin.marinas@arm.com, will.deacon@arm.com Subject: [PATCH 3/3] arm64: ftrace: add cond_resched() to func ftrace_make_(call|nop) Date: Fri, 30 Nov 2018 16:09:56 +0100 Message-Id: <20181130150956.27620-1-anders.roxell@linaro.org> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181130_071017_134352_12D4EEE8 X-CRM114-Status: GOOD ( 11.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnd Bergmann , Anders Roxell , keescook@chromium.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org 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 Both of those functions end up calling ftrace_modify_code(), which is expensive because it changes the page tables and flush caches. Microseconds add up because this is called in a loop for each dyn_ftrace record, and this triggers the softlockup watchdog unless we let it sleep occasionally. Rework so that we call cond_resched() before going into the ftrace_modify_code() function. Co-developed-by: Arnd Bergmann Signed-off-by: Arnd Bergmann Signed-off-by: Anders Roxell --- arch/arm64/kernel/ftrace.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c index de1a397d2d3f..9da38da58df7 100644 --- a/arch/arm64/kernel/ftrace.c +++ b/arch/arm64/kernel/ftrace.c @@ -130,6 +130,11 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) old = aarch64_insn_gen_nop(); new = aarch64_insn_gen_branch_imm(pc, addr, AARCH64_INSN_BRANCH_LINK); + /* This function can take a long time when sanitizers are enabled, so + * lets make sure we allow RCU processing. + */ + cond_resched(); + return ftrace_modify_code(pc, old, new, true); } @@ -188,6 +193,11 @@ int ftrace_make_nop(struct module *mod, struct dyn_ftrace *rec, new = aarch64_insn_gen_nop(); + /* This function can take a long time when sanitizers are enabled, so + * lets make sure we allow RCU processing. + */ + cond_resched(); + return ftrace_modify_code(pc, old, new, validate); }