Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8511336imu; Tue, 4 Dec 2018 09:27:46 -0800 (PST) X-Google-Smtp-Source: AFSGD/Vm+d6e975TKeQajtGBSBcw6+OPdItw2QSWSkeDEOUQW3zo1jaX4mYzdsrDkzTUWZK4oXWE X-Received: by 2002:a17:902:8a8a:: with SMTP id p10mr21127891plo.50.1543944466068; Tue, 04 Dec 2018 09:27:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543944466; cv=none; d=google.com; s=arc-20160816; b=On3VWxc++s0fv3A9ygmMB79JUvU1xq0+8D4CTqm6tRHaYUqrL6vAI311pSmtzV1QHo 3cW9F2CIdUlsR+iJn+xm773B14glzg5zFxe65x+4iGw7ypaEODP7+mDBtd/Z3TTOPCcY HPAOjJhD3ub1Yp/J3dhxh2EQ0Y3qx0kBbLAAAW7Y1gWruOXwjbdns4zftxSpo+rjDeHM WbvsrXfRhpEruFqpb4I84G0G9oaVwNfb9ae+7kjbvj5lvHHS+nrGz1bnXNARjf+/aw9B t7BQGsrbUdHB16oAqvXzaY75biF08vjBd1jPtQqlqqjnGFWQdssxUpNQcuFn+94vkQan HNQA== 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=lTQgRnIdfm5Ia7Lvbmkpfk8rboZi9ZcQgdhbppIAlEI=; b=BU9znsICGXuDjXQ5vjJD7QvZhbr5Ye8ouiG5FlkQeChZm7kgsVFmrgo0LBNkdlzrMy 03PF798EElgy2GEnyBNvd4tmCqNBQBP/QJYIABLu1Pgy2KXBmTFybd+CL2+OQo63oe8a 84tkQhlEn+aDD2valrnKGZ6Wb+1W1hhhluR4m37WAxz3+8Xr0JeJnl+g1QOK1potmESl /lk1dq5l6HioCQlnCIKTc1FyvinNhobAyaMhXNvQTQ+OKGoBYVz7IOTvkOCMZKrJmt2t Ik1gnBiivuJc0X0TIn1AD9wY3qNSUrkA4LllmN4DEzqTRzGHmjRwdaT9UfXPp/vuCmK1 aiIg== 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 2si15226604pgz.395.2018.12.04.09.27.30; Tue, 04 Dec 2018 09:27: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; 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 S1727347AbeLDR0g (ORCPT + 99 others); Tue, 4 Dec 2018 12:26:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:51566 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727305AbeLDR0a (ORCPT ); Tue, 4 Dec 2018 12:26:30 -0500 Received: from vmware.local.home (unknown [208.91.3.26]) (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 ABD9A2081C; Tue, 4 Dec 2018 17:26:29 +0000 (UTC) Date: Tue, 4 Dec 2018 12:26:27 -0500 From: Steven Rostedt To: Will Deacon Cc: Arnd Bergmann , Anders Roxell , Ingo Molnar , Catalin Marinas , Kees Cook , Linux Kernel Mailing List , Linux ARM Subject: Re: [PATCH 3/3] arm64: ftrace: add cond_resched() to func ftrace_make_(call|nop) Message-ID: <20181204122627.225befaa@vmware.local.home> In-Reply-To: <20181204111242.GA32596@arm.com> References: <20181130150956.27620-1-anders.roxell@linaro.org> <20181203192228.GC29028@arm.com> <20181204005012.11f73df9@vmware.local.home> <20181204111242.GA32596@arm.com> X-Mailer: Claws Mail 3.15.1 (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 Tue, 4 Dec 2018 11:12:43 +0000 Will Deacon wrote: > > diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c > > index 8ef9fc226037..42e89397778b 100644 > > --- a/kernel/trace/ftrace.c > > +++ b/kernel/trace/ftrace.c > > @@ -2393,11 +2393,14 @@ void __weak ftrace_replace_code(int enable) > > { > > struct dyn_ftrace *rec; > > struct ftrace_page *pg; > > + bool schedulable; > > int failed; > > > > if (unlikely(ftrace_disabled)) > > return; > > > > + schedulable = !irqs_disabled() & !preempt_count(); > > Looks suspiciously like a bitwise preemptible() to me! Ah, thanks. Yeah, that should have been &&. But what did you expect. I didn't even compile this ;-) > > > + > > do_for_each_ftrace_rec(pg, rec) { > > > > if (rec->flags & FTRACE_FL_DISABLED) > > @@ -2409,6 +2412,8 @@ void __weak ftrace_replace_code(int enable) > > /* Stop processing */ > > return; > > } > > + if (schedulable) > > + cond_resched(); > > } while_for_each_ftrace_rec(); > > } > > If this solves the problem in core code, them I'm all for it. Otherwise, I > was thinking of rolling our own ftrace_replace_code() for arm64, but that's > going to involve a fair amount of duplication. > If it does, then I'll add it. Or take a patch for it ;-) My main concern is that this can be called from non schedulable context. -- Steve