Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3878669imu; Fri, 30 Nov 2018 07:24:56 -0800 (PST) X-Google-Smtp-Source: AFSGD/UPXSdvGTcOc8Zq+JUQyqEuqbXJb4Qd2gaTJ1ByS6PNKr9v+o/yUT0LxjQsajirJ4DW7z67 X-Received: by 2002:a17:902:9a04:: with SMTP id v4mr6238509plp.34.1543591496246; Fri, 30 Nov 2018 07:24:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543591496; cv=none; d=google.com; s=arc-20160816; b=siwfs5Ptnt0F848+gsE8omfjKIhNGGIbeVHoh6umYrxU4YdtTohWIPXpmYpZbCJFWB C+m+PDZ9mE1A0P4ejFRBNzdAufwSblS6bza0O7RMOzvvsMgyaed5LViPRkpQWttExvtD uyUtewS7z/BhGIDGJq1j0rGSUHkrjxejo+l5mbiJJsEbEsjx600WQiVKL+wc2Pvw4myb NUU2sSWo699ULRcqS+0Sc7tkNYxN6PPJWPNJY0K/8WuqNwgNHEWzXiqW40Zv2V7Mv85B o1u/QK+t/4bvrPno/HyHW+cFe58TSi9J1gKHxAN14vdOBMyiECRsYeu9Reli6cZhkvij AI7Q== 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 :references:in-reply-to:message-id:subject:cc:to:from:date; bh=iyBXCHXeky3W3FS/Z5amVtDYKPoS5xj4J4JRZdzQa5M=; b=ahTj1h4aBxJ0m8kDbFE8ObCFIJHz+4SToecim3uQ5pnPCX6ocia4Xp7PZBF212M5br k9yuFE+hnkY0eQQNC91bNFKxYfnQNAHYhFREZrtWGCnxo1uDRa+zZu4TtgYykm2xumXM MpIHeyKGuoOt/2OuDYVHc6Ljr2iXkG671pYFZrOjA/Zh5pqiWVC1NkLkbwI5Bz3AODvl JSxTv1IzT25cs2aiv5Ay6p2ddPXOlA6UYCxObdDt8fLYswNrue4SWeUReWA1E9CkHwTC 2z9PbiTNCH0b9wDUtxjezYBRcihEjeohiaTWrBykt1K+L5TTZbxW70f3vNRo5Y2bPMC+ v+hA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g10si6090998plm.1.2018.11.30.07.24.34; Fri, 30 Nov 2018 07:24:56 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726857AbeLACde (ORCPT + 99 others); Fri, 30 Nov 2018 21:33:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:51692 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726624AbeLACde (ORCPT ); Fri, 30 Nov 2018 21:33:34 -0500 Received: from gandalf.local.home (cpe-66-24-56-78.stny.res.rr.com [66.24.56.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E997320868; Fri, 30 Nov 2018 15:23:52 +0000 (UTC) Date: Fri, 30 Nov 2018 10:23:51 -0500 From: Steven Rostedt To: Anders Roxell Cc: mingo@redhat.com, catalin.marinas@arm.com, will.deacon@arm.com, keescook@chromium.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Arnd Bergmann Subject: Re: [PATCH 3/3] arm64: ftrace: add cond_resched() to func ftrace_make_(call|nop) Message-ID: <20181130102351.61045b21@gandalf.local.home> In-Reply-To: <20181130150956.27620-1-anders.roxell@linaro.org> References: <20181130150956.27620-1-anders.roxell@linaro.org> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 30 Nov 2018 16:09:56 +0100 Anders Roxell wrote: > 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 I'm fine with this patch, but I'm not placing an ack on this patch just because I don't know the repercussions of such a change. I'll let you folks take full responsibility ;-) -- Steve > --- > 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); > } >