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: 152546 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp3769736ljp; Fri, 30 Nov 2018 07:09:25 -0800 (PST) X-Google-Smtp-Source: AFSGD/U+oMxTHX7sqpX2nI2/Zqx1jGT2jx5eIP9RPa6A01Ok3G76K/aPFWpdtGEnP8SgXi6i48t7 X-Received: by 2002:a17:902:ba8b:: with SMTP id k11mr5988072pls.177.1543590565335; Fri, 30 Nov 2018 07:09:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543590565; cv=none; d=google.com; s=arc-20160816; b=WHVbMossi5fCv50pet5vXQ7iw3j2nzS2wViqK7f3ikJXlQi68H+IR89AmSXExAZlae 9iekcbeLk9QWKf4oaLkfvfnPUjVIMa40s9aAfR8sgDMZWe6j/BthxbIB6sKA3LjZU602 FbSySxqpXzt0ofhBH85cXuBLG/OzkCxKmCKtUJv9BIfL3/KyJUXiMHSlkVcm8iRenIwo zcDFOPAqDcMQnhNthUcLX29hUV6S9DdN1AM2sKJOWzeSJq8Wq/GjgovrSPwsV0JX9/9Y B3PHIw2P8yMrPS9RGdkhYwHPnmugduyRN75n6IANhurMU8LvJgw7gsxJeMiCG92Y5mWE 8yEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=cevKt/iVwCRv9xli91T/QyVSDidq+ft7LMiFzNhTbQc=; b=n0qg5uXxyPXpecJV2fHBOcAz+dJGsh891k+4SPHh83sevjZsl6gzeSORXNmMAuIgdR TLt84RihcG9XOGRv7E8s/tmerL9BG+rHFDUAtEimdUi8SOc9SVjrpM4IvjP1QJ6Y42Jh td0nBUC+ivrNMpZDaxflz+EXPuRxNmdWiR5UO2lL1gaa+20aH8RtbscyL6ftc0Ma4i+y tcM7zTRNK18RS4uCq1rhHbmrW3l2i5fBdKb0DaVadzvth8Ty0ZZEGeCh2ovFmhua75of CUIVFzGoMlMF549pPTeStnc3F5/eMH7M2RfJiIiIQG2243nf04izNeNuwUK8kFcam64e SyrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Awggy/OC"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r7si5367514pfb.237.2018.11.30.07.09.18; Fri, 30 Nov 2018 07:09:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Awggy/OC"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727100AbeLACSw (ORCPT + 32 others); Fri, 30 Nov 2018 21:18:52 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:44229 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726616AbeLACSw (ORCPT ); Fri, 30 Nov 2018 21:18:52 -0500 Received: by mail-lj1-f193.google.com with SMTP id k19-v6so5258732lji.11 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=Yevo2sukd7UB+jOY1fCTKTwN2tZlHoN5bXoyRUaghAYpoAer9m+ESB6jLCHC8Q8LYG ykOZpXqNelxuKE1aH+xKfhzF+SVRrlUrQRxkkGarEVWw3AZK24m1wMrJbl+lAIJ32OHl r1DFah7AmyfgTOeuI6mNkBMqxYx953ACq7mRVQDGCwgpZd/q3Wb4ymn/wi3SvgBKzDOU XLktI8Su/fD5PASwL3jNEwwG/t1GUSVH+OOCuHUazckcdP0+W4Xmdrq9Ts2AeB6/UYp5 PetGyc5TKBuEgSLxEwyrB48yGRbcHhPqd+NXZJiMeZjQUJb6u0AzUtBeZ1Sshcr/zczl jkTw== X-Gm-Message-State: AA+aEWYcvsbJglj2870DOpjgWyEM1tilCkXj1kvzTqnhGVFuofYOhibk OyP3BwgRZ8MQ1Gedac/crKEpwQ== 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 Cc: rostedt@goodmis.org, mingo@redhat.com, catalin.marinas@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Anders Roxell , Arnd Bergmann 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- kernel/stackleak.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.19.2 Acked-by: Steven Rostedt (VMware) Acked-by: Kees Cook 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: 152547 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp3770181ljp; Fri, 30 Nov 2018 07:09:46 -0800 (PST) X-Google-Smtp-Source: AFSGD/VYEOQUdpfbyz3r1zWpFr/ggei9BytK62RVeMVtgX03OJ/TaZXGO4cOFGZt5yHOOxnHKj2C X-Received: by 2002:a62:68c5:: with SMTP id d188mr6164419pfc.194.1543590586027; Fri, 30 Nov 2018 07:09:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543590586; cv=none; d=google.com; s=arc-20160816; b=yXBVxs5BhixHpbol368oTSH3xGV003wvvRUTLEnUmpDq38ZMtkHgHemfSEO0vKCEdg 2wDUoq0tb9STUrmA5sJ3xVotOec6Dfo9k6zsB+M9p13Gmc1VgR1APZpUJqltD6VJoYxE YePIDC3+6ZPBMA7mr0q8sJpib2jyu9laly6WU4bBVk9Fyj9dWEvlb+tuCDukLmZhMqt0 BucJwvDEhUwN2VY2rW0Jw5YyseP6l7srQB/l3CMLLnU2QKSyCcfbnIuTO60JEv17qxNP jHQDtUqplk96LK5+BPjz780mYViZ9KzybquAHOASDrk5C8sAOXO+z7KiomjFBLmw+pJ0 dbsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=85KCfW3nCq0jcrH/zFnUuLUEVTX2XkKXX7xHs/xruHs=; b=wJy7f2tfLjksqD+iypYYPwY5FdWBygbbGDWJgzjdi6Y49wCgQOtDbhOa0SN3Zeztkq Y7ILgefoNmrYA5daJFwmQ9lPbSA/i4CfAqcB1rGQnSmvFovhmCSpoSWCZvYpzZR9XVdz J/a35x8EoBmZo4783mfkRD/yC4QlyluWK/92WNb++uO26XYjyEc8ZkIN6UkjOI1jy1By cs43aoKbj8W8cky5xnfpbLazJZvbkY4CzrpuUADBytrGa8rp24GjGYrvHbeprzCDNTj/ x0836jKm+iP3FGboTc9PD/fxBBvg/lMmsy6sqbZNOVUfpJgIdZVHoXoZAwSzhV/65v2D kvtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WNS16U3T; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a3si6038804pld.252.2018.11.30.07.09.45; Fri, 30 Nov 2018 07:09:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WNS16U3T; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727133AbeLACTU (ORCPT + 32 others); Fri, 30 Nov 2018 21:19:20 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:39790 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726609AbeLACTT (ORCPT ); Fri, 30 Nov 2018 21:19:19 -0500 Received: by mail-lj1-f195.google.com with SMTP id t9-v6so5270247ljh.6 for ; Fri, 30 Nov 2018 07:09:42 -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=sYWyLdqTNbPUPYh3IC/n8eFjlzOCXYFm9FyjK1koqN/U51Is90FXUNDzGmjJ5jqhF7 6Tp5l25Fzeb++OMNSNdFxoEV3j58PHZx5OaF9E7LZ6j/glATOX7GxNFka6l78DJvrKkL LYXaM3EkXNMENkPLWXapRPQSvF4vZCuK7E/9B8IjkOcDjpshY0akEGeV+o9/ui/TujCI meqYWU0KBB7uIHP2tsxfTzCpF4ZETBGVeJ9zhskpCAzc2Z5lnhZK93S+Qk7qAOe6q/GK AHnrwcjAIOJtpuKzRxxPimbhg4jZmCWeCT9Kt+ewTLzqnCP5ejk6RvK6vW8sS6Ddgd3C x5Qw== X-Gm-Message-State: AA+aEWaj2XUUid9f9Qf94hcBymAeVDNf3/Rg2HdzBTBiJe8uGdF2C8CF JHoOBFBHTmvGKusSCrdEsQL+MA== 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 Cc: keescook@chromium.org, catalin.marinas@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Anders Roxell , Arnd Bergmann 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- kernel/trace/Makefile | 5 +++++ 1 file changed, 5 insertions(+) -- 2.19.2 Acked-by: Steven Rostedt (VMware) 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: 152548 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp3770677ljp; Fri, 30 Nov 2018 07:10:12 -0800 (PST) X-Google-Smtp-Source: AFSGD/UWqaxGBy4S3n8GzdGR7l4ZIeR/+VgK5FNQDwaBs3lyNmk6HUjKD0IkJJcUxOyur+waVumN X-Received: by 2002:a63:a35c:: with SMTP id v28mr5113236pgn.205.1543590612288; Fri, 30 Nov 2018 07:10:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543590612; cv=none; d=google.com; s=arc-20160816; b=R4IUAewwD8q1p+fsZAaeWZ7rm3pLX6LBCXuugQh6cnAh/ST0BB7bvIheuHlt+tTUhj qS8Us9bcyiAlYB7MWD1Yhr+h40G/fIvSuquscm1uY8IfshnaNYTsEedcfttzQ1u0kZXV c/oZtki2Am0fpvtSor+DBwoYbl/aamHaiG92EmoO4ExLecADTiNJj+kOMV1Q4cvHh2v/ 1xNPpqGONY4baV78ZQlz4Ga4NtF22rAppuQb8ITfRAqL8bFif7jJVQh0t30U/rg8Lcjb ke2RK9vznV9kjrBFzIbgL+wHzgRQu4MP1uDhx/O/JTyiU6xcTzK+sru4Sitml+ljr4je j+Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Sn6e2y3hrDqC5F6PRoRA5dBPL+JkfPGNchhGjAsqyhg=; b=wIPEqiPlazKxLiq3EbONET3V27BJFThe3aJmzY7u4GpoFJX0d/XsGeZxAcNootLMB7 ShgF6kUY1oeiYRjq/DUg51wG6GTlc7xd/FkmbzHpKybN0OjtwsYNk/Oxh2SXk9gAZiBT EvLjKbpYvEf2i4lNOh1+mWv6S+8LdS7V7Fywiuw31u71fq0ROewOkJ2AG6nYWyvVUnnh N1pvkH9GCE05bZVx7IXjghF2lAzl0k3edG+Zz0ltZ9qUa5ZceUrJBSBmMDJ4Qxeqip4C S8wqNOn7+6DqZOl/CAmjRcpSH2bsCub4JVSzf+63Va5EKAJxyq2rSN48OdmA/TsVBGkD y2kQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Hf7NYzds; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b14si5710672pfc.156.2018.11.30.07.10.11; Fri, 30 Nov 2018 07:10:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Hf7NYzds; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727214AbeLACTq (ORCPT + 32 others); Fri, 30 Nov 2018 21:19:46 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:41870 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726609AbeLACTo (ORCPT ); Fri, 30 Nov 2018 21:19:44 -0500 Received: by mail-lj1-f196.google.com with SMTP id z80-v6so5273770ljb.8 for ; Fri, 30 Nov 2018 07:10:05 -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=ctieoURxUym6Bg4OIpXYbfLiB+GYA2jXZ/DH8M3SpQRvWLhPTCL3PIDvhOrVDh+JnL h2OLUvSfxYOPPuC/1dnzWVBn+/qWgJKLLaCBzStL4sdO3PgNK5YtzKF0DkFz6l/GlVJz R84W/Mwpg8j6HKRsrtB7S4Aj4MgUu3MuqEjCG6H98ZTA/d/JgBGv2JuFXefF4NXSUImh j5QNzZdXbnrL9tKWzDZakwOao5dM+/N4rGPXAhtD+tIncE8NIH/RUQ29k0/te+XCwZ65 pZbzrzVRbyJO627eQkY0jXEl4NX9NVwlw2PG+ofkeAB7hnENZgabNq0bkkmK5L8cZ+2r 7XmQ== X-Gm-Message-State: AA+aEWanRjAiINrxeldINJ+6GzDx65OdUmLRJopcWAPgvTvSTsN51zev YWO0mhQT5IU8TbmqJ38KemvQqw== 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 Cc: keescook@chromium.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Anders Roxell , Arnd Bergmann 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(+) -- 2.19.2 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); }