From patchwork Thu Feb 18 22:21:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Jeanson X-Patchwork-Id: 12094411 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8267EC433E0 for ; Thu, 18 Feb 2021 22:22:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 30FCB64E77 for ; Thu, 18 Feb 2021 22:22:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230009AbhBRWWW (ORCPT ); Thu, 18 Feb 2021 17:22:22 -0500 Received: from mail.efficios.com ([167.114.26.124]:43544 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229577AbhBRWWS (ORCPT ); Thu, 18 Feb 2021 17:22:18 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 7867E29F10D; Thu, 18 Feb 2021 17:21:37 -0500 (EST) Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id aaGXVWSXXUP0; Thu, 18 Feb 2021 17:21:37 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 1E36B29F10C; Thu, 18 Feb 2021 17:21:37 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 1E36B29F10C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1613686897; bh=qg+TOHYRBNNDpBiTul3hZoTe6Z8G1k6/yFumHOX/SkI=; h=From:To:Date:Message-Id:MIME-Version; b=tsMcr1ksM6lxPWFKSJBC/YDUG1Etvl/SrUUqR+ZlHGXlPg7R1mBI8WDkvH1Z6xZFO 1HYPesZe1VUMBQUppkZBpWKIR2e9g827DqjN8aR9q731+7+6sIoQ99Rjl7iOdmWZS0 R3AItFeuYtzfqQqYB0h5rTaD98OJx3bQ9VLN/IIg5lTxRPeav1h8AGEbyOlrWmcwue gnKXiQgvckqgAeJeLNzoJHHNdWYLvSDYtf4yfGnfAy017RdeRL34RYh5L541DnSEYJ 2LtAEBI8AWO9392fZMktohorDKBZ4J/KECLjFAv1zoE/JsQIHHJqV/meLf8kIYKcy4 Q5IJPqnmfnHpQ== X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id f2nIccwc5G74; Thu, 18 Feb 2021 17:21:37 -0500 (EST) Received: from localhost.localdomain (96-127-212-112.qc.cable.ebox.net [96.127.212.112]) by mail.efficios.com (Postfix) with ESMTPSA id B03C929EB59; Thu, 18 Feb 2021 17:21:36 -0500 (EST) From: Michael Jeanson To: linux-kernel@vger.kernel.org Cc: Michael Jeanson , Steven Rostedt , Peter Zijlstra , Alexei Starovoitov , Yonghong Song , "Paul E . McKenney" , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Joel Fernandes , bpf@vger.kernel.org Subject: [RFC PATCH 0/6] [RFC] Faultable tracepoints (v2) Date: Thu, 18 Feb 2021 17:21:19 -0500 Message-Id: <20210218222125.46565-1-mjeanson@efficios.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org X-Patchwork-State: RFC Formerly known as “Sleepable tracepoints”. When invoked from system call enter/exit instrumentation, accessing user-space data is a common use-case for tracers. However, tracepoints currently disable preemption around iteration on the registered tracepoint probes and invocation of the probe callbacks, which prevents tracers from handling page faults. Extend the tracepoint and trace event APIs to allow specific tracer probes to take page faults. Adapt ftrace, perf, and ebpf to allow being called from sleepable context, and convert the system call enter/exit instrumentation to sleepable tracepoints. This series only implements the tracepoint infrastructure required to allow tracers to handle page faults. Modifying each tracer to handle those page faults would be a next step after we all agree on this piece of instrumentation infrastructure. This patchset is based on v5.10.15. Changes since v1 RFC: - Rename "sleepable tracepoints" to "faultable tracepoints", MAYSLEEP to MAYFAULT, and use might_fault() rather than might_sleep(), to properly convey that the tracepoints are meant to be able to take a page fault, which requires to be able to sleep *and* to hold the mmap_sem. Cc: Steven Rostedt (VMware) Cc: Peter Zijlstra Cc: Alexei Starovoitov Cc: Yonghong Song Cc: Paul E. McKenney Cc: Ingo Molnar Cc: Arnaldo Carvalho de Melo Cc: Mark Rutland Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Namhyung Kim Cc: Joel Fernandes Cc: bpf@vger.kernel.org Mathieu Desnoyers (1): tracing: use Tasks Trace RCU instead of SRCU for rcuidle tracepoints Michael Jeanson (5): tracing: introduce faultable tracepoints (v2) tracing: ftrace: add support for faultable tracepoints tracing: bpf-trace: add support for faultable tracepoints tracing: perf: add support for faultable tracepoints tracing: convert sys_enter/exit to faultable tracepoints include/linux/tracepoint-defs.h | 11 ++++ include/linux/tracepoint.h | 111 +++++++++++++++++++++----------- include/trace/bpf_probe.h | 23 ++++++- include/trace/define_trace.h | 8 +++ include/trace/events/syscalls.h | 4 +- include/trace/perf.h | 26 ++++++-- include/trace/trace_events.h | 79 +++++++++++++++++++++-- init/Kconfig | 1 + kernel/trace/bpf_trace.c | 5 +- kernel/trace/trace_events.c | 15 ++++- kernel/trace/trace_syscalls.c | 84 ++++++++++++++++-------- kernel/tracepoint.c | 104 ++++++++++++++++++++++++------ 12 files changed, 373 insertions(+), 98 deletions(-)