Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp145621imm; Thu, 21 Jun 2018 15:36:12 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKrEo/5cS0/qkLTHmGrjXw1cGvETxX4L3QpXnNuK3Axez3RdPFKPZ+NrpW1WBP5XXjvekPg X-Received: by 2002:a62:484d:: with SMTP id v74-v6mr29523126pfa.256.1529620572670; Thu, 21 Jun 2018 15:36:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529620572; cv=none; d=google.com; s=arc-20160816; b=Yp+RBnFTz0NbD9bUc2y3aYDx+g6+2nTJBbILwAoHJBhFze2gjwT3uAjyZnGCc8C1Kw wJtVSmqFARcVIbCii/30PmMEZ1TJo3BSM6bk6fxOkdoyeJZa8XWGO/701WjrMVmNciRU f+4CyaNfcBi6SSUr5/86tTUBqv6lpOKV+wRBu0VZd9pCrqUjIbW8ADBg2AgQSrGUHkhz 0ik/MFKGYV+vvCICoGmNP8cuC/WVphE+GQpqYTSTJasmfoPal9HOvHy00XKqbWf/izN4 u6y6PyU9Z5yaO06bqcGAb1LZK4y7FRQrsLB3GcwjfuXiN/eBfw+0LensbVI3AEJg1BEQ 2VDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=y8KEp0r6n018OkQCFpfKMB1S5eQLFOrINRhm16WXZpk=; b=ECpKfXdrbPSGqroHJMX1/yaxL6jfDYyV4r/WoyJbad6xPZmo1B+AxI1WYMfFOAlMzi D/3gLUHzfnMMRLYET3nSz5ALvGW/lmPvNS1QgYn9KZnFYsjsew/+JXDBjvSa6gQheblb yc4PWyCqE/OjmQIk4TgQGBDVgFOLJTc09rMUFwulbCz/vxOGU4qpG9CtIoo/JQUwQ9qS Qh3Do64ax3LpuCxrxbvukN9N2mDQCWP78qEr1PN5NGOoH7F1ItzCtHJ6RFCpZzCU/5KR NAYu4+xUGJAoAv90irP3OipCJgP6AFQgE75XS6vRqpiqH8s8uXqy9xuC4usACzYx9hKp h1+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=To3RnL1P; 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 x15-v6si4717265pgv.389.2018.06.21.15.35.58; Thu, 21 Jun 2018 15:36:12 -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; dkim=pass header.i=@joelfernandes.org header.s=google header.b=To3RnL1P; 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 S933775AbeFUWd2 (ORCPT + 99 others); Thu, 21 Jun 2018 18:33:28 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:45755 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933622AbeFUWd0 (ORCPT ); Thu, 21 Jun 2018 18:33:26 -0400 Received: by mail-pg0-f65.google.com with SMTP id z1-v6so2038841pgv.12 for ; Thu, 21 Jun 2018 15:33:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=from:to:cc:subject:date:message-id; bh=y8KEp0r6n018OkQCFpfKMB1S5eQLFOrINRhm16WXZpk=; b=To3RnL1Pjbf2QpBMevWm3HPNkAkz71VWaWH6VMo7GlayFOHrqoN579zlPC2/oyIvYl WLgf8too08/4Vtrv5G4W9gsCfq9oYG3N2lMZ/w5bGlTEkd7Sr4jpjdiIzWE21Sbvhy3C cfiEsYGTOfbL15iqh92XOkE9ZEsfLz7Q4Nwfc= 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; bh=y8KEp0r6n018OkQCFpfKMB1S5eQLFOrINRhm16WXZpk=; b=RPxcnAVEIL/d0tBqD/3x7muH2l/VgZeGvCTtlRaklsPrXx7PFZbLQbmoindIWes5um 6ix6EXiN8xnBDsSomst0bzM9/Ej0tjy+DwS06u+PxdqVcTqpPdCuKxSnsRu7YWZcVCrB l8MR2YTcGbKtRbp70K8Nh456c/S4TzHw5gK3gUhWBIdryPtPNtl2cMLTt3EpEQ2nOoLi WwJgT/ou0DxXQsziOAEB77o6LkhYluCSFXPMb8E4AlQcQYv/zdlhZUdquz5sb0f+3kgX i1c6Q2ltaj5PQwg+yuuSuulc7hAMCQiz4MMyOl9N8P0OX0oUPIdvhFk1QEzBVyZ4AJZh sejA== X-Gm-Message-State: APt69E2KKE62fRJ7psb/dMMHA21iMM23a5ySceswJomKs95jNn/P5hIf NMXBHTiIF6kwWlZH/+1bGprAHOns5ys= X-Received: by 2002:a62:ccdc:: with SMTP id j89-v6mr29067613pfk.232.1529620405512; Thu, 21 Jun 2018 15:33:25 -0700 (PDT) Received: from joelaf.mtv.corp.google.com ([2620:0:1000:1600:3122:ea9c:d178:eb]) by smtp.gmail.com with ESMTPSA id x19-v6sm11060824pfi.5.2018.06.21.15.33.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Jun 2018 15:33:24 -0700 (PDT) From: Joel Fernandes To: linux-kernel@vger.kernel.org Cc: kernel-team@android.com, "Joel Fernandes (Google)" , Boqun Feng , Byungchul Park , Erick Reyes , Ingo Molnar , Julia Cartwright , linux-kselftest@vger.kernel.org, Masami Hiramatsu , Mathieu Desnoyers , Namhyung Kim , Paul McKenney , Peter Zijlstra , Shuah Khan , Steven Rostedt , Thomas Glexiner , Todd Kjos , Tom Zanussi , Will Deacon Subject: [PATCH v9 0/7] Centralize and unify usage of preempt/irq tracepoints Date: Thu, 21 Jun 2018 15:32:29 -0700 Message-Id: <20180621223236.211495-1-joel@joelfernandes.org> X-Mailer: git-send-email 2.18.0.rc2.346.g013aa6912e-goog Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Joel Fernandes (Google)" This is a posting of v9 preempt/irq tracepoint clean up series rebased onto v4.18-rc1. No changes in the series, just a rebase + repost. Maintainers, this series has been well tested and is a simplification/ refactoring of existing code, along with giving a speed-up for tracepoints using the rcu-idle API. I'm hoping for your consideration of this series for the kernel. I am also eager for this so that our users will find it easier to use tools depending on existing preempt tracepoints since it simplifies the configuration for them. All patches now have a Reviewed-by tag except for the kselftest script (7/7). Peter, Ingo, Steve, others, your feedback and Acks are welcomed. Introduction to the series: The preempt/irq tracepoints exist but not everything in the kernel is using it whenever they need to be notified that a preempt disable/enable or an irq disable/enable has occurred. This makes things not work simultaneously (for example, only either lockdep or irqsoff trace-events can be used at a time). This is particularly painful to deal with, since turning on lockdep breaks tracers that install probes on IRQ events, such as the BCC atomic critical section tracer [2]. This constraint also makes it not possible to use synthetic events to trace irqsoff sections with lockdep simulataneously turned on. This series solves that, and also results in a nice clean up of relevant parts of the kernel. Several ifdefs are simpler, and the design is more unified and better. Also as a result of this, we also speeded performance all rcuidle tracepoints since their handling is simpler. [1] https://lkml.org/lkml/2018/6/7/1135 [2] https://github.com/iovisor/bcc/pull/1801/ v8->v9: - Small style changes to tracepoint code (Mathieu) - Minor style fix to use PTR_ERR_OR_ZERO (0-day bot) - Minor fix to test_atomic_sections to use unsigned long. - Added Namhyung's, Mathieu's Reviewed-by to some patches. v7->v8: - Refactored irqsoff tracer probe defines (Namhyung) v6->v7: - Added a module to simulate an atomic section, a kselftest to load and and trigger it which verifies the preempt-tracer and this series. - Fixed a new warning after I rebased in early boot, this is because early_boot_irqs_disabled was set too early, I moved it after the lockdep initialization. - added back the softirq fix since it appears it wasn't picked up. - Ran Ingo's locking API selftest suite which are passing with this series. - Mathieu suggested ifdef'ing the tracepoint_synchronize_unregister function incase tracepoints aren't enabled, did that. Joel Fernandes (Google) (6): srcu: Add notrace variant of srcu_dereference trace/irqsoff: Split reset into separate functions tracepoint: Make rcuidle tracepoint callers use SRCU tracing: Centralize preemptirq tracepoints and unify their usage lib: Add module to simulate atomic sections for testing preemptoff tracers kselftests: Add tests for the preemptoff and irqsoff tracers Paul McKenney (1): srcu: Add notrace variants of srcu_read_{lock,unlock} include/linux/ftrace.h | 11 +- include/linux/irqflags.h | 11 +- include/linux/lockdep.h | 8 +- include/linux/preempt.h | 2 +- include/linux/srcu.h | 22 ++ include/linux/tracepoint.h | 49 +++- include/trace/events/preemptirq.h | 23 +- init/main.c | 5 +- kernel/locking/lockdep.c | 35 +-- kernel/sched/core.c | 2 +- kernel/trace/Kconfig | 22 +- kernel/trace/Makefile | 2 +- kernel/trace/trace_irqsoff.c | 253 ++++++------------ kernel/trace/trace_preemptirq.c | 71 +++++ kernel/tracepoint.c | 16 +- lib/Kconfig.debug | 8 + lib/Makefile | 1 + lib/test_atomic_sections.c | 77 ++++++ tools/testing/selftests/ftrace/config | 3 + .../test.d/preemptirq/irqsoff_tracer.tc | 74 +++++ 20 files changed, 454 insertions(+), 241 deletions(-) create mode 100644 kernel/trace/trace_preemptirq.c create mode 100644 lib/test_atomic_sections.c create mode 100644 tools/testing/selftests/ftrace/test.d/preemptirq/irqsoff_tracer.tc -- 2.18.0.rc2.346.g013aa6912e-goog