From patchwork Thu Oct 3 15:16:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 13821135 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DCC4F8286A; Thu, 3 Oct 2024 15:18:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=167.114.26.122 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727968728; cv=none; b=ssvwvB4bFZb2Ni7g+ZFAaxJTkapKeSsMeduA027Se43XmqEu1HU9nCVNVNFRGvUud4NDwnEe9fa05X4tIPIwZLrNUwoO9ED89/1+CG2zXsGygDLdo9+kAmA90kCTAkbNxotswzDqLAwEaR2ZidPrbUFhIgzf1ekxE7+MydX4oU0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727968728; c=relaxed/simple; bh=WwB3VDOeGHvQJGcXKLuEG8OTMh8msNB+Csvq2kbvg0o=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=udY0je9ld2T2Q6PV4MocAmFOI1wUxdA5O9Lvl+2vEu/xxxyU9sFrMqZAbSS+Zri4UT6Vtf1sZuB1JmVVjbhzOIsKrMLq7AZdvTH6R3d1svgWMUdtpjpDm5DyhE8uoem3kJs0HlKThr2qmdb0GjPhqQDFdtY2WAvA00QOwe7y7AM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com; spf=pass smtp.mailfrom=efficios.com; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b=JwBf4ywS; arc=none smtp.client-ip=167.114.26.122 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=efficios.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="JwBf4ywS" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1727968723; bh=WwB3VDOeGHvQJGcXKLuEG8OTMh8msNB+Csvq2kbvg0o=; h=From:To:Cc:Subject:Date:From; b=JwBf4ywSwMXPPg+Ha3ITARTCo+8eqctYd6vXVEyimvz+a5FUgPFoD5RlLwL09HFu+ zIFbHFbOYad/7PrQJlmaa4Iw3OWjI+ZWpguBaL2EUVzTXCE4h4fx5jP+aMiST6sG/q /cOkz9cyrwb2uDV5xa2go95JKa2Wl2NgNJvjg5Ry8hiO+nNHn5Pd+zH99xhT+TGQhp +Rz3wyEcPJNqtxlIoIodfscDm8FOEOUctA49Y+1Cf+W9BTm86JnmLLb6rQO30fPK5n BZwUwUfv0Jti8YAGNjsWQV+XxqM4qeBjFPm0CE9Fp6mq1wHBfeIaK3C0iMxxBk8KzU ZPBnGrMiG9TMw== Received: from thinkos.internal.efficios.com (96-127-217-162.qc.cable.ebox.net [96.127.217.162]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4XKFgk5wXjz5t1; Thu, 3 Oct 2024 11:18:42 -0400 (EDT) From: Mathieu Desnoyers To: Steven Rostedt , Masami Hiramatsu Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , Peter Zijlstra , Alexei Starovoitov , Yonghong Song , "Paul E . McKenney" , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Namhyung Kim , Andrii Nakryiko , bpf@vger.kernel.org, Joel Fernandes , linux-trace-kernel@vger.kernel.org Subject: [PATCH v1 0/8] tracing: Allow system call tracepoints to handle page faults Date: Thu, 3 Oct 2024 11:16:30 -0400 Message-Id: <20241003151638.1608537-1-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Wire up the system call tracepoints with Tasks Trace RCU to allow the ftrace, perf, and eBPF tracers to handle page faults. This series does the initial wire-up allowing tracers to handle page faults, but leaves out the actual handling of said page faults as future work. This series was compile and runtime tested with ftrace and perf syscall tracing and raw syscall tracing, adding a WARN_ON_ONCE() in the generated code to validate that the intended probes are used for raw syscall tracing. The might_fault() added within those probes validate that they are called from a context where handling a page fault is OK. This series replaces the "Faultable Tracepoints v6" series found at [1]. This has been rebased on v6.12-rc1, without any conflicts. I have fixed the build bot warnings, those were caused by build error with CONFIG_TRACING=n. I've added the Acked-by and Tested-by tags to relevant commits. Steven, can you merge it through the tracing tree ? Thanks, Mathieu Link: https://lore.kernel.org/lkml/20240828144153.829582-1-mathieu.desnoyers@efficios.com/ # [1] 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: Namhyung Kim Cc: Andrii Nakryiko Cc: bpf@vger.kernel.org Cc: Joel Fernandes Cc: linux-trace-kernel@vger.kernel.org Mathieu Desnoyers (8): tracing: Declare system call tracepoints with TRACE_EVENT_SYSCALL tracing/ftrace: guard syscall probe with preempt_notrace tracing/perf: guard syscall probe with preempt_notrace tracing/bpf: guard syscall probe with preempt_notrace tracing: Allow system call tracepoints to handle page faults tracing/ftrace: Add might_fault check to syscall probes tracing/perf: Add might_fault check to syscall probes tracing/bpf: Add might_fault check to syscall probes include/linux/tracepoint.h | 104 ++++++++++++++++++++++++++++---- include/trace/bpf_probe.h | 13 ++++ include/trace/define_trace.h | 5 ++ include/trace/events/syscalls.h | 4 +- include/trace/perf.h | 43 ++++++++++++- include/trace/trace_events.h | 61 +++++++++++++++++-- init/Kconfig | 1 + kernel/entry/common.c | 4 +- kernel/trace/trace_syscalls.c | 44 +++++++++++--- 9 files changed, 247 insertions(+), 32 deletions(-)