From patchwork Sun Dec 15 19:34:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 13908953 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 47F601CDA19; Sun, 15 Dec 2024 19:35:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734291339; cv=none; b=mYN3v/G2lHAExs6GwdfvNJgANDazY98yDwRQ3gDNS+RXoRl4lZQqZrY6znMulmQkmjGh/+HDAVBvHxDB/90Q6KDxFoeom2TLE06gcRxle184HB6TbxywBXngAmUtwIq6/c5zQT1U79LCVxI0s40BoBMzFlWdQRMPrPQ/x/Bg1zM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734291339; c=relaxed/simple; bh=Fd2GobHfEpLqdvdlqx0gZDYTPeJt7bpEiJ+djgTtVP4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=lLRsucuekyImwa0Sb6w9GpnPaf8laOj96OCHXivg6nLPxWOVbkl8tQZCGALGS53f3oJX1+KlcQYZ8/5J0Hnmut9oSa/aTWj5CrFy8wHgHkSF4AYgnwhxI0gi0N29ObgiezJKJ+yOycaTwvCaOGRmzsBQNxasN7NtjyvcTaO+1Hk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AD3CC1A32; Sun, 15 Dec 2024 11:36:05 -0800 (PST) Received: from e132581.cambridge.arm.com (e132581.arm.com [10.2.76.71]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B3D203F528; Sun, 15 Dec 2024 11:35:33 -0800 (PST) From: Leo Yan To: Arnaldo Carvalho de Melo , Adrian Hunter , Namhyung Kim , Jiri Olsa , Ian Rogers , James Clark , "Liang, Kan" , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Matt Bobrowski , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, bpf@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Suzuki K Poulose , Mike Leach Cc: Leo Yan Subject: [PATCH v1 7/7] perf docs: Document AUX pause with BPF Date: Sun, 15 Dec 2024 19:34:36 +0000 Message-Id: <20241215193436.275278-8-leo.yan@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241215193436.275278-1-leo.yan@arm.com> References: <20241215193436.275278-1-leo.yan@arm.com> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Documents the usage of the --bpf-aux-pause option and provides examples. Signed-off-by: Leo Yan --- tools/perf/Documentation/perf-record.txt | 40 ++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt index 80686d590de2..25cf993b7a50 100644 --- a/tools/perf/Documentation/perf-record.txt +++ b/tools/perf/Documentation/perf-record.txt @@ -535,6 +535,46 @@ must be an AUX area event. Samples on other events will be created containing data from the AUX area. Optionally sample size may be specified, otherwise it defaults to 4KiB. +--bpf-aux-pause=[=OPTIONS]:: +Specify trace events for triggering AUX pause with a BPF program. A trace event +can be a kprobe, kretprobe or tracepoint. This option must be enabled in +combination with the "aux-action=start-paused" configuration in an AUX event. + +For attaching a kprobe or kretprobe event, the format is: + + {kprobe|kretprobe}:function_name:{p|r} + +For attaching a tracepoint, the format is: + + {tp|tracepoint}:category:tracepint_name:{p|r} + +The first field is for the trace event type. It supports three types: kprobe, +kretprobe, and tracepoint ('tp' is also supported as an abbreviation for +"tracepoint"). The last field specifies whether the action is pause ("p") or +resume ("r"). + +For kprobe and kretprobe, the "function_name" field is for specifying a kernel +function name. In the case of a tracepoint, the "category" and "tracepoint_name" +fields are used together for providing complete tracepoint info. + +The '--bpf-aux-pause' option does not support inherit mode. In the default +trace mode or per-thread mode, it needs to be combined with the '-i' or +'--no-inherit' option to disable inherit mode. + +The syntax supports multiple trace events, with each separated by a comma (,). +For example, users can set up AUX pause on a kernel function with kretprobe and +AUX resume on a tracepoint with the syntax below: + + For default trace mode (with inherit mode disabled): + perf record -e cs_etm/aux-action=start-paused/ \ + --bpf-aux-pause="kretprobe:__arm64_sys_openat:p,tp:sched:sched_switch:r" \ + -i ... + + For system wide trace mode: + perf record -e cs_etm/aux-action=start-paused/ \ + --bpf-aux-pause="kretprobe:__arm64_sys_openat:p,tp:sched:sched_switch:r" \ + -a ... + --proc-map-timeout:: When processing pre-existing threads /proc/XXX/mmap, it may take a long time, because the file may be huge. A time out is needed in such cases.