Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8554406imu; Tue, 4 Dec 2018 10:08:33 -0800 (PST) X-Google-Smtp-Source: AFSGD/U5+4q84NGDR1S9Seo3V9pSWcBJz5v6lPyOQdaGWObUcM2v5NFd7Up+POC1lhkhdm5bTbW9 X-Received: by 2002:a63:1d1d:: with SMTP id d29mr17771538pgd.49.1543946913001; Tue, 04 Dec 2018 10:08:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543946912; cv=none; d=google.com; s=arc-20160816; b=P1LF7R2KfuKk+ZkwQJlTMjrj8U4jFfkA/0xre1Rb3nn/OkmOU1EmQovUTserVuqfy4 cK5z4bumEPjDfZYmBxf9fRK/1iHIt9CRiSWPqxn8rB1LZHIX4+gCq2IU53PJFnWzyuJY YzFLbNOxU4yPYEkKeEyZnN5fJvtUySx0uhKHXAYYWU/cDnwhk6ua1Bce7kHihFWBnpmU lVglF49+l4DRaybGe+SnvjPOzKsDF7aLjdFaAGMGqZRbBP98E5Ar0NvKD6YIEwzGT7eO D9h4BO6Qgb9qtpC5tVwHZoALsfTSZ5dDkTpT6ZKuAtAEwyklPAijRo9xB73piSsXPsqT oZRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=P7Q+6Q7EQjFQY2Xk7dt5+mUPd/Z6udMs7VDUul38GiA=; b=hGt+B/MNDbdrAAcZXkuwylWFE4e4PRarFnZVLy4KkxCGhXNroFQo2GsoG2n7qiPf6k /ZaYYCcHe/FoaGe0qCwti2nXgWwwUCgtIfatu0vJwArmzV9vzpiU9wndKSsWURg17kdj sZZ0gXo8fCTX/v36NP2K8fusNON8sxvLjMlmpAuzYf6a/RX/JbtpYp9yebXq14PALTi9 SzZjpkVCoihuuUz6o1P/aF2vGL0eEBnhRHOD8W3Euhf2cVmJeJPJdB7AoX3UhfDM379y j9HdLNAZ5lpavxSGfT33qtIkgbvj5uroaoXRPJ/Yznt7Q5M/lgkrYaoK+Qj3djG60GjH FBTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bbVhzyWI; 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 f11si17144738plo.254.2018.12.04.10.08.17; Tue, 04 Dec 2018 10:08:32 -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=bbVhzyWI; 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 S1725976AbeLDSH3 (ORCPT + 99 others); Tue, 4 Dec 2018 13:07:29 -0500 Received: from mail-yw1-f66.google.com ([209.85.161.66]:37739 "EHLO mail-yw1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725839AbeLDSH3 (ORCPT ); Tue, 4 Dec 2018 13:07:29 -0500 Received: by mail-yw1-f66.google.com with SMTP id h193so7354557ywc.4 for ; Tue, 04 Dec 2018 10:07:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=P7Q+6Q7EQjFQY2Xk7dt5+mUPd/Z6udMs7VDUul38GiA=; b=bbVhzyWIY8kUQeSTevtql7ECZm5YFj1+oHdNuuaWPu2Lt4+YuwyCtXs+Y2yrkhCMtP g+Odg3xrPj27rE+JCE4oRyCyWMLQTxHckyX8Qvcjl+fqnlxi368OXyzD7PXymIqqc/CC Wu2m8CBfn9e5XP4Gt6lttWEpS3qBII1ntA8g8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=P7Q+6Q7EQjFQY2Xk7dt5+mUPd/Z6udMs7VDUul38GiA=; b=rz47kIzcGQ2doh5wBzO7MkrexZEIb3lfVnc+uZk7T7PZ8DViKYstVn2OLWz6Tg6xxU xb6DUWqShondfcnHYMjtezHd48NcoHcTdnknvDf32iU+J+OJSLzi9iJD5Y3bEnpuHEA4 RsSktzMs3hZFDCvkXQxiIxY7tCVSBxef9Uj0jCE9EA6oPZquIy26IDpDJvEjk+kX2uPI 7SoSvNQ/fFeHp+soDjv7e/hMHH3iZsEaxfLSzclueOfQr+BxF8lRHNODBSfYgs2nYdnk lfCNAX+HrVBeEWKYQ7ADqA5dyXwnadzqi/68YNcbJXJNbZY6cci1CcLZjwfU6Bh+6VJn +mRA== X-Gm-Message-State: AA+aEWamz/R2UFQ0EWCAN8R+DXujZril9YXGZ9EWEe+bqLrLJ3Xk3h4z e/aIGFozuHXMD/Ml/ustdclXyQzP0phzlteyrx4bGA== X-Received: by 2002:a81:9b8e:: with SMTP id s136mr20423301ywg.85.1543946848163; Tue, 04 Dec 2018 10:07:28 -0800 (PST) MIME-Version: 1.0 References: <20181130150956.27620-1-anders.roxell@linaro.org> <20181203192228.GC29028@arm.com> <20181204005012.11f73df9@vmware.local.home> <20181204111242.GA32596@arm.com> <20181204122627.225befaa@vmware.local.home> In-Reply-To: <20181204122627.225befaa@vmware.local.home> From: Anders Roxell Date: Tue, 4 Dec 2018 19:07:16 +0100 Message-ID: Subject: Re: [PATCH 3/3] arm64: ftrace: add cond_resched() to func ftrace_make_(call|nop) To: rostedt@goodmis.org Cc: Will Deacon , Arnd Bergmann , mingo@redhat.com, Catalin Marinas , Kees Cook , Linux Kernel Mailing List , Linux ARM Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 4 Dec 2018 at 18:26, Steven Rostedt wrote: > > 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 ;-) I tested your patch. it worked. I'll send a patch shortly. Cheers, Anders