From patchwork Thu Nov 30 23:50:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Song Liu X-Patchwork-Id: 843255 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=fb.com header.i=@fb.com header.b="BTqlqPZN"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3ynvR11jRFz9sNV for ; Fri, 1 Dec 2017 10:55:09 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752290AbdK3Xx0 (ORCPT ); Thu, 30 Nov 2017 18:53:26 -0500 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:59090 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750994AbdK3Xu2 (ORCPT ); Thu, 30 Nov 2017 18:50:28 -0500 Received: from pps.filterd (m0001255.ppops.net [127.0.0.1]) by mx0b-00082601.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vAUNkl3f016949 for ; Thu, 30 Nov 2017 15:50:28 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=U6LpiJhATBauGkt/DXeVupc7pdWpAXiuXrqw3spQZ/E=; b=BTqlqPZNNIP+Ur+T95/Ol1cQvnc5jDCJuu9hr/EGRCfFvMolVhaFReTxGzkyk+p9H0n+ MKkXcQuPDILoU2v98IzpJbwjifuehDyB3GJ3vlq+2xc1+aic46xP0HeCyznobFWwYU7s renWu6y2foioZBEgnucgscF2eYKkC2c+MSU= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0b-00082601.pphosted.com with ESMTP id 2ejtffr90g-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Thu, 30 Nov 2017 15:50:28 -0800 Received: from mx-out.facebook.com (192.168.52.123) by PRN-CHUB01.TheFacebook.com (192.168.16.11) with Microsoft SMTP Server id 14.3.361.1; Thu, 30 Nov 2017 15:50:26 -0800 Received: by devbig102.frc2.facebook.com (Postfix, from userid 4523) id D0677428285D; Thu, 30 Nov 2017 15:50:26 -0800 (PST) Smtp-Origin-Hostprefix: devbig From: Song Liu Smtp-Origin-Hostname: devbig102.frc2.facebook.com To: , , , , , , CC: , Song Liu Smtp-Origin-Cluster: frc2c02 Subject: [PATCH v3] perf_event_open.2: add type kprobe and uprobe Date: Thu, 30 Nov 2017 15:50:17 -0800 Message-ID: <20171130235023.1414663-3-songliubraving@fb.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20171130235023.1414663-1-songliubraving@fb.com> References: <20171130235023.1414663-1-songliubraving@fb.com> X-FB-Internal: Safe MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-11-30_07:, , signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Two new types kprobe and uprobe are being added to perf_event_open, which allow creating kprobe or uprobe with perf_event_open. This patch adds information about these types. Signed-off-by: Song Liu --- man2/perf_event_open.2 | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/man2/perf_event_open.2 b/man2/perf_event_open.2 index c91da3f..e80050f 100644 --- a/man2/perf_event_open.2 +++ b/man2/perf_event_open.2 @@ -256,11 +256,15 @@ struct perf_event_attr { union { __u64 bp_addr; /* breakpoint address */ + __u64 kprobe_func; /* for perf_kprobe */ + __u64 uprobe_path; /* for perf_uprobe */ __u64 config1; /* extension of config */ }; union { __u64 bp_len; /* breakpoint length */ + __u64 kprobe_addr; /* with kprobe_func == NULL */ + __u64 probe_offset; /* for perf_[k,u]probe */ __u64 config2; /* extension of config1 */ }; __u64 branch_sample_type; /* enum perf_branch_sample_type */ @@ -336,6 +340,13 @@ field. For instance, .I /sys/bus/event_source/devices/cpu/type contains the value for the core CPU PMU, which is usually 4. +.TP +.BR kprobe " and " uprobe " (since Linux 4.TBD)" +These two dynamic PMU creates kprobe or uprobe with perf_event_open and +attaches it to the file descriptor. +See fields +.IR kprobe_func ", " uprobe_path ", " kprobe_addr ", and " probe_offset +for more details. .RE .TP .I "size" @@ -627,6 +638,43 @@ then leave .I config set to zero. Its parameters are set in other places. +.PP +If +.I type +is +.BR kprobe +or +.BR uprobe , +.I config +of 0 means kprobe/uprobe, while +.I config +of 1 means kretprobe/uretprobe. See fields +.IR kprobe_func ", " uprobe_path ", " kprobe_addr ", and " probe_offset +for more details. +.RE +.TP +.IR kprobe_func ", " uprobe_path ", " kprobe_addr ", and " probe_offset +.EE +These fields describes the kprobe/uprobe for dynamic PMU +.BR kprobe +and +.BR uprobe . +For +.BR kprobe ": " +use +.I kprobe_func +and +.IR probe_offset , +or use +.I kprobe_addr +and leave +.I kprobe_func +as NULL. For +.BR uprobe ": " +use +.I uprobe_path +and +.IR probe_offset . .RE .TP .IR sample_period ", " sample_freq