Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp997989imm; Fri, 27 Jul 2018 09:29:37 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfEkB6AZIzOa5z4NO5i+4HHtCPUbPMbEU9Zph3EM/kvoet2H0VWspl3sfODK2NvVNlnh18O X-Received: by 2002:a63:375b:: with SMTP id g27-v6mr6853659pgn.59.1532708977859; Fri, 27 Jul 2018 09:29:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532708977; cv=none; d=google.com; s=arc-20160816; b=oRXhBADuUNMt8+dtziUf9nMjPsWh733YIeh6Vq08chJRJuSsOZKJOFluUAckm60f8v Z5KDGILvDt3O6LcOaTBrEj9y/c+ea9EQ4YFTlA4FR7DNyMsFAnTYH35y/DofC6orbfV0 KgznM+jP30juwCeCXmlPVyuqIwxRHBjzQ5FoCpW4C4ZI3/x/i6/S+gyyD9xaa/W4Oz0a uN9+QYRShYXvtBLI5oWCJbPyHbwLP+7MCrlMM5V3NZdOdmh9AfW3dl7A2npZBHjmxQOa 7Tw+hDhWByfX5zb2gEhNRRdC+gkPNZArmBpR9EUMoNGC6HbyJ4pWJLwnB63VZkPhwfvU Wrqw== 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 :arc-authentication-results; bh=0tcBfYhP+XW/lCoeujDF4zp7HPD9rq+uyGO2NOZbZmE=; b=pcwoT5M/fA40PeiWU2qJumOkj9pPBzyN3iP+mSVeGEPzjHScVyA4bqnRirBViHL3ks W1tzibjy/GWXPdwhbnSLiAu2RcoIdhcxnDOzQi/kO+86L/UmDA9kBQxUjq+XJCepE+AW 1viCu9kkIczl1Sckeapnzy4uUW5lODOFmjTdvDMcDR78bSPJ1W3o/xrSB+NMNYpzxc/y 1Ra18kpz5HUydHQXoXARqBYssF+riIDRHnzKTDuckIF9VcZlBKuTRJTA772X8SMFqn7Y Bz8VSB/SItTTMYkiTXiNVKPTjdxWxzqD6fEHvYWVrkr3AA7K/fnRWJSqB7eidMPYNyNZ xmBA== 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 v5-v6si3790739plg.348.2018.07.27.09.29.23; Fri, 27 Jul 2018 09:29:37 -0700 (PDT) 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 S2388641AbeG0RvI (ORCPT + 99 others); Fri, 27 Jul 2018 13:51:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:44386 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732097AbeG0RvI (ORCPT ); Fri, 27 Jul 2018 13:51:08 -0400 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 602F5205C9; Fri, 27 Jul 2018 16:28:27 +0000 (UTC) Date: Fri, 27 Jul 2018 12:28:25 -0400 From: Steven Rostedt To: Joel Fernandes Cc: linux-kernel@vger.kernel.org, kernel-team@android.com, Boqun Feng , Byungchul Park , Erick Reyes , Ingo Molnar , Julia Cartwright , Masami Hiramatsu , Mathieu Desnoyers , Namhyung Kim , Paul McKenney , Peter Zijlstra , Thomas Glexiner , Todd Kjos , Tom Zanussi , Will Deacon Subject: Re: [PATCH v11 3/3] tracing: Centralize preemptirq tracepoints and unify their usage Message-ID: <20180727122825.281a3a67@gandalf.local.home> In-Reply-To: <20180726235044.10195-4-joel@joelfernandes.org> References: <20180726235044.10195-1-joel@joelfernandes.org> <20180726235044.10195-4-joel@joelfernandes.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 Thu, 26 Jul 2018 16:50:44 -0700 Joel Fernandes wrote: > From: "Joel Fernandes (Google)" > > This patch detaches the preemptirq tracepoints from the tracers and > keeps it separate. > > Advantages: > * Lockdep and irqsoff event can now run in parallel since they no longer > have their own calls. > > * This unifies the usecase of adding hooks to an irqsoff and irqson > event, and a preemptoff and preempton event. > 3 users of the events exist: > - Lockdep > - irqsoff and preemptoff tracers > - irqs and preempt trace events > > The unification cleans up several ifdefs and makes the code in preempt > tracer and irqsoff tracers simpler. It gets rid of all the horrific > ifdeferry around PROVE_LOCKING and makes configuration of the different > users of the tracepoints more easy and understandable. It also gets rid > of the time_* function calls from the lockdep hooks used to call into > the preemptirq tracer which is not needed anymore. The negative delta in > lines of code in this patch is quite large too. > > In the patch we introduce a new CONFIG option PREEMPTIRQ_TRACEPOINTS > as a single point for registering probes onto the tracepoints. With > this, > the web of config options for preempt/irq toggle tracepoints and its > users becomes: > > PREEMPT_TRACER PREEMPTIRQ_EVENTS IRQSOFF_TRACER PROVE_LOCKING > | | \ | | > \ (selects) / \ \ (selects) / > TRACE_PREEMPT_TOGGLE ----> TRACE_IRQFLAGS > \ / > \ (depends on) / > PREEMPTIRQ_TRACEPOINTS > > One note, I have to check for lockdep recursion in the code that calls > the trace events API and bail out if we're in lockdep recursion > protection to prevent something like the following case: a spin_lock is > taken. Then lockdep_acquired is called. That does a raw_local_irq_save > and then sets lockdep_recursion, and then calls __lockdep_acquired. In > this function, a call to get_lock_stats happens which calls > preempt_disable, which calls trace IRQS off somewhere which enters my > tracepoint code and sets the tracing_irq_cpu flag to prevent recursion. > This flag is then never cleared causing lockdep paths to never be > entered and thus causing splats and other bad things. > > Other than the performance tests mentioned in the previous patch, I also > ran the locking API test suite. I verified that all tests cases are > passing. > > I also injected issues by not registering lockdep probes onto the > tracepoints and I see failures to confirm that the probes are indeed > working. > > This series + lockdep probes not registered (just to inject errors): > [ 0.000000] hard-irqs-on + irq-safe-A/21: ok | ok | ok | > [ 0.000000] soft-irqs-on + irq-safe-A/21: ok | ok | ok | > [ 0.000000] sirq-safe-A => hirqs-on/12:FAILED|FAILED| ok | > [ 0.000000] sirq-safe-A => hirqs-on/21:FAILED|FAILED| ok | > [ 0.000000] hard-safe-A + irqs-on/12:FAILED|FAILED| ok | > [ 0.000000] soft-safe-A + irqs-on/12:FAILED|FAILED| ok | > [ 0.000000] hard-safe-A + irqs-on/21:FAILED|FAILED| ok | > [ 0.000000] soft-safe-A + irqs-on/21:FAILED|FAILED| ok | > [ 0.000000] hard-safe-A + unsafe-B #1/123: ok | ok | ok | > [ 0.000000] soft-safe-A + unsafe-B #1/123: ok | ok | ok | > > With this series + lockdep probes registered, all locking tests pass: > > [ 0.000000] hard-irqs-on + irq-safe-A/21: ok | ok | ok | > [ 0.000000] soft-irqs-on + irq-safe-A/21: ok | ok | ok | > [ 0.000000] sirq-safe-A => hirqs-on/12: ok | ok | ok | > [ 0.000000] sirq-safe-A => hirqs-on/21: ok | ok | ok | > [ 0.000000] hard-safe-A + irqs-on/12: ok | ok | ok | > [ 0.000000] soft-safe-A + irqs-on/12: ok | ok | ok | > [ 0.000000] hard-safe-A + irqs-on/21: ok | ok | ok | > [ 0.000000] soft-safe-A + irqs-on/21: ok | ok | ok | > [ 0.000000] hard-safe-A + unsafe-B #1/123: ok | ok | ok | > [ 0.000000] soft-safe-A + unsafe-B #1/123: ok | ok | ok | > > Reviewed-by: Namhyung Kim > Signed-off-by: Joel Fernandes (Google) > --- > include/linux/ftrace.h | 11 +- > include/linux/irqflags.h | 11 +- > include/linux/lockdep.h | 8 +- > include/linux/preempt.h | 2 +- > include/trace/events/preemptirq.h | 23 +-- > init/main.c | 5 +- > kernel/locking/lockdep.c | 35 ++--- Did Peter ever give an Acked-by for this patch? -- Steve > kernel/sched/core.c | 2 +- > kernel/trace/Kconfig | 22 ++- > kernel/trace/Makefile | 2 +- > kernel/trace/trace_irqsoff.c | 231 ++++++++---------------------- > kernel/trace/trace_preemptirq.c | 72 ++++++++++ > 12 files changed, 195 insertions(+), 229 deletions(-) > create mode 100644 kernel/trace/trace_preemptirq.c > >