Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp68154imm; Wed, 5 Sep 2018 15:07:58 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdbi6vPeOn2Y0+h/xQdr2BRM13OmfrYC+2pHWcqYO4h1fgF4G/jjCZbqfsiYI6xPSErPsUcz X-Received: by 2002:a63:a5c:: with SMTP id z28-v6mr23419461pgk.209.1536185278591; Wed, 05 Sep 2018 15:07:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536185278; cv=none; d=google.com; s=arc-20160816; b=IVvc3btH7jeneiJ2oKTxu4c0gJpOzUqsSYDrpXzstLd01fF3E6ErYh24FoWBIyKEtd AWOywJUgVs7SgMaTbT9q+Zp2GEdrU2wNS1pnGfxO1y7P1GCL3yvzHryOmDvCy6kXu9Yu +tO7wy7lCyQe2fEZG6UHIwPorrpq5+a1kEcaZ1oGdd1PwNoyDD9LVLF5XIj9JNnf7uQJ 0Oin5Wjrmuq2uDEhvhwHm8nc+s82AUuahar7oczdZd18VOWtcBgP4TtF2cpVuAPOfpNm UroUAELjTquKpLISou3i9EHWh6Re9yT4OykBLAFoIpXulbdIXiJpOMASA3oIbsOdB6KB sVRA== 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=RW31DCN2PopCpyjLe+5pACwDjmp1JV6E1gdun3F66ng=; b=aDNhigaAHljFLmjvVQZvu8oiqB2/XYEvZkcQAIYIo7sJve0YbdwZnjvuDgTfDv22RM 8Tygdvg4lhbN7ZM8/Rz8x7NCRIrtBlx0HQGb8+A6tCB4yHbwj/15gPgCk6oNJ/mUlT0J PeHnSMyAaG+xNdJ1d58tHKt82eHT/IcbrcWOamCDPIGQ8nSYG1h4dCxoMiRBp+sNNu8a i+TXYF3jh96rWbM26+8u/3t8f+SmNfIptjddHCO6cj5sY1tMzKEajyPY4EByFqGsk9+V xFowmj2HAw/ph/1M+5XZLRQZ+vOR/QZNID42LY5knMxTxHMDNLa72OIwX5p22jfUb2pX dSbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ru10YoPt; 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 l62-v6si2983109pgd.30.2018.09.05.15.07.42; Wed, 05 Sep 2018 15:07:58 -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=ru10YoPt; 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 S1728417AbeIFCiI (ORCPT + 99 others); Wed, 5 Sep 2018 22:38:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:52538 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728389AbeIFCiH (ORCPT ); Wed, 5 Sep 2018 22:38:07 -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 725D220839; Wed, 5 Sep 2018 22:05:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1536185156; bh=F4C+Qi61thimwcPF9Qxw3qtwaRdg/vl7+pINY+Mykf4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ru10YoPtDII3rmnyiiXfKdXpLJNDCR/N0bUv2HelpD8wqbm8vjNyvC5xXKRB9cDl5 5ieHyVAxvRCDIOdXGbImlfm2aIQrz5Yg9ALZWftLwqv7i1l4ge4HUx43NRRS9CMUX3 VzZzfGHOB8qX0JluhYR/KrcX4JakGvJQt+VQSyhQ= 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 24/77] perf trace augmented_syscalls: Hook into syscalls:sys_exit_SYSCALL too Date: Wed, 5 Sep 2018 19:03:47 -0300 Message-Id: <20180905220440.20256-25-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 Hook the pair enter/exit when using augmented_{filename,sockaddr,etc}_syscall(), this way we'll be able to see what entries are in the ELF sections generated from augmented_syscalls.c and filter them out from the main raw_syscalls:* tracepoints used by 'perf trace'. Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Wang Nan Link: https://lkml.kernel.org/n/tip-cyav42qj5yylolw4attcw99z@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/examples/bpf/augmented_syscalls.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tools/perf/examples/bpf/augmented_syscalls.c b/tools/perf/examples/bpf/augmented_syscalls.c index 253b3ccbd17d..1419a9186937 100644 --- a/tools/perf/examples/bpf/augmented_syscalls.c +++ b/tools/perf/examples/bpf/augmented_syscalls.c @@ -26,6 +26,12 @@ struct bpf_map SEC("maps") __augmented_syscalls__ = { .max_entries = __NR_CPUS__, }; +struct syscall_exit_args { + unsigned long long common_tp_fields; + long syscall_nr; + long ret; +}; + struct augmented_filename { int size; int reserved; @@ -49,6 +55,10 @@ int syscall_enter(syscall)(struct syscall_enter_##syscall##_args *args) \ (sizeof(augmented_args) - sizeof(augmented_args.filename.value) + \ augmented_args.filename.size)); \ return 0; \ +} \ +int syscall_exit(syscall)(struct syscall_exit_args *args) \ +{ \ + return 1; /* 0 as soon as we start copying data returned by the kernel, e.g. 'read' */ \ } struct syscall_enter_openat_args { @@ -116,6 +126,10 @@ int syscall_enter(syscall)(struct syscall_enter_##syscall##_args *args) \ &augmented_args, \ sizeof(augmented_args) - sizeof(augmented_args.addr) + addrlen); \ return 0; \ +} \ +int syscall_exit(syscall)(struct syscall_exit_args *args) \ +{ \ + return 1; /* 0 as soon as we start copying data returned by the kernel, e.g. 'read' */ \ } struct sockaddr; -- 2.14.4