Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp67026imm; Wed, 5 Sep 2018 15:06:54 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYBHVCM7AjzROM0TcLjf0SW2j+yHZGjZ/H+23XYFl6kftrdeB11hGiTUXcIO3QFRr4ccRaq X-Received: by 2002:a63:a35f:: with SMTP id v31-v6mr39004292pgn.261.1536185214128; Wed, 05 Sep 2018 15:06:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536185214; cv=none; d=google.com; s=arc-20160816; b=EgHrBZ9iRclUTspJzirNJ7jh44zyqKEFiSILpwlOrViUOJlS7WE8SPiGnDSbvke0fs j+wIYx4NRcQ7X2oqyPSe8IutF9q12f/EjSL+/lk7Pszb8YXEXDWP+6ABisO5+myxsSKi EbF5a1/2j56uo2vx9xlom+HgOOrhmq+UUPma/zp5XqEkFfK5xpWJXbcd7mWx/nbgOquc JD01OeOgbcGOOCqBKuXrinJsXJsy/XhQf4tR73jIzDWHagK9RKiXy3EuJk2D+n+xNv58 Z03Pvxc2jAMc2sSvz5M/SR02xKVmSDHWKtMTXxQM7g06rnYBh7GfC4/VBiYr9NW2sv1b ctqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=HyIJC7jyMnA9rfea2GKbboV2Un7lrerSuY94JbVoQKc=; b=ahLbQLJjQu0E5Hy0AOzIGSJkO9rQ/u5pnAMFW3iWLj+b+Y3/s+wQdo4Ep9cRIriuvo 8bGYPsn+Od1I6wf1hrgFEFrjZRUUS4gW/exz8JeqibAxGQoocWXJMjV1D7BvR890hi4a +ScQQH+coM76NgH0r6XO6gE6RaYhzLNnqXO7PvarbxwhLb31Yq5mMgCNghkvJtp7GHMU rlWUNhhP9H2CWbPzNzDzhrZkXroT0Rf+SfIYCNm3aaJoY4jStxIbxL+12uxbsvBprjiO MavFE4ruOBKPNntur410qa9Gp/j3P3lEeh6qz2RySf576j9w8nAjA/0SvVkNoD/icMi1 zpFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QbsN2UzL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c10-v6si3190032pgb.638.2018.09.05.15.06.38; Wed, 05 Sep 2018 15:06:54 -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=@kernel.org header.s=default header.b=QbsN2UzL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728064AbeIFCh0 (ORCPT + 99 others); Wed, 5 Sep 2018 22:37:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:51486 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727518AbeIFCh0 (ORCPT ); Wed, 5 Sep 2018 22:37:26 -0400 Received: from jouet.infradead.org (unknown [179.97.41.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 52B362073D; Wed, 5 Sep 2018 22:05:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1536185114; bh=+nJuvvoQebIqCBYCcECJp3QOxyRmK5K0DwLlS2ei+AM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QbsN2UzL4liULQga5rXlW402jOf6Ybn07o+Z1Z35zB7xhvb5V22l/Gi7Nk2ABwWG/ ZGhEBWm2aOZyNm2rvz/HQkqjmSAa03Q2WFOH4hzzbv8b3VLtIokbwz0h15pIRm/SO6 pTxy1Scwmzs2SXwZjCudsRHrergazbIlD21RcMS8= From: Arnaldo Carvalho de Melo To: Ingo Molnar Cc: Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Arnaldo Carvalho de Melo , Adrian Hunter , David Ahern , Jiri Olsa , Namhyung Kim , Wang Nan Subject: [PATCH 08/77] perf trace: Augment inotify_add_watch pathname syscall arg Date: Wed, 5 Sep 2018 19:03:31 -0300 Message-Id: <20180905220440.20256-9-acme@kernel.org> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180905220440.20256-1-acme@kernel.org> References: <20180905220440.20256-1-acme@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnaldo Carvalho de Melo Again, just changing tools/perf/examples/bpf/augmented_syscalls.c, that is starting to have too much boilerplate, some macro will come to the rescue. # perf trace -e tools/perf/examples/bpf/augmented_syscalls.c 0.000 gmain/2590 inotify_add_watch(fd: 3, pathname: /var/cache/app-info/yaml, mask: 16789454) 0.023 gmain/2590 inotify_add_watch(fd: 3, pathname: /var/lib/app-info/xmls, mask: 16789454) 0.028 gmain/2590 inotify_add_watch(fd: 3, pathname: /var/lib/app-info/yaml, mask: 16789454) 0.032 gmain/2590 inotify_add_watch(fd: 3, pathname: /usr/share/app-info/yaml, mask: 16789454) 0.039 gmain/2590 inotify_add_watch(fd: 3, pathname: /usr/local/share/app-info/xmls, mask: 16789454) 0.045 gmain/2590 inotify_add_watch(fd: 3, pathname: /usr/local/share/app-info/yaml, mask: 16789454) 0.049 gmain/2590 inotify_add_watch(fd: 3, pathname: /home/acme/.local/share/app-info/yaml, mask: 16789454) 0.056 gmain/2590 inotify_add_watch(fd: 3, pathname: , mask: 16789454) 0.010 gmain/2245 inotify_add_watch(fd: 7, pathname: /home/acme/~, mask: 16789454) 0.087 perf/20116 openat(dfd: CWD, filename: /sys/kernel/debug/tracing/events/syscalls/sys_enter_inotify_add) 0.436 perf/20116 openat(dfd: CWD, filename: /sys/kernel/debug/tracing/events/syscalls/sys_enter_openat/form) 56.042 gmain/2791 inotify_add_watch(fd: 4, pathname: /var/lib/fwupd/remotes.d/lvfs-testing, mask: 16789454) 113.986 gmain/1721 inotify_add_watch(fd: 3, pathname: /var/lib/gdm/~, mask: 16789454) 3777.265 gsd-color/2408 openat(dfd: CWD, filename: /etc/localtime) 3777.550 gsd-color/2408 openat(dfd: CWD, filename: /etc/localtime) ^C[root@jouet perf]# Still not combining raw_syscalls:sys_enter + raw_syscalls:sys_exit, to get it strace-like, but that probably will come very naturally with some more wiring up... Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Wang Nan Link: https://lkml.kernel.org/n/tip-ol83juin2cht9vzquynec5hz@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/examples/bpf/augmented_syscalls.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tools/perf/examples/bpf/augmented_syscalls.c b/tools/perf/examples/bpf/augmented_syscalls.c index 154379463c95..6ec327850a15 100644 --- a/tools/perf/examples/bpf/augmented_syscalls.c +++ b/tools/perf/examples/bpf/augmented_syscalls.c @@ -88,4 +88,31 @@ int syscall_enter(open)(struct syscall_enter_open_args *args) return 0; } +struct syscall_enter_inotify_add_watch_args { + unsigned long long common_tp_fields; + long syscall_nr; + long fd; + char *pathname_ptr; + long mask; +}; + +struct augmented_enter_inotify_add_watch_args { + struct syscall_enter_inotify_add_watch_args args; + struct augmented_filename pathname; +}; + +int syscall_enter(inotify_add_watch)(struct syscall_enter_inotify_add_watch_args *args) +{ + struct augmented_enter_inotify_add_watch_args augmented_args = { .pathname.reserved = 0, }; + + probe_read(&augmented_args.args, sizeof(augmented_args.args), args); + augmented_args.pathname.size = probe_read_str(&augmented_args.pathname.value, + sizeof(augmented_args.pathname.value), + args->pathname_ptr); + perf_event_output(args, &__augmented_syscalls__, BPF_F_CURRENT_CPU, + &augmented_args, + sizeof(augmented_args) - sizeof(augmented_args.pathname.value) + augmented_args.pathname.size); + return 0; +} + license(GPL); -- 2.14.4