Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2146864imm; Thu, 9 Aug 2018 08:03:49 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwWR+QgdUgNke8qreTopPZIktjsY48b+EZr5TGcwGB+R9mzfP8Ry2QD9X03U0pD7OziMsT0 X-Received: by 2002:a17:902:65:: with SMTP id 92-v6mr2424319pla.318.1533827029717; Thu, 09 Aug 2018 08:03:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533827029; cv=none; d=google.com; s=arc-20160816; b=M6binZb5O8iHkCcqCAE//1L5h3psUk3n3XjR0ZU76+kr4EsZoiYDCDSJClEH83wGzi Vr+YvEgWVAsAg6QuFk/WahcF8faBYEgPYuHKt/OoIrPQwE1LlsGJkRCf7Cc5S9Kuu9CP eVSERCo0P/fZdwnzklA6N+6Ldg0F9E4TPluOsRY4/mP+xpazAabfsG1lBKmCgHcXzypW xNqAPI3KRjGfT6MBqnW7Ap6ipprO+X8nvHLSWRRgBMxjzuGkYa3yJRw/ru1lYEaSvOB8 IOAARrogM43rnsMQVDZGAc0kpWDOkA9AdBe+z/X9g/HNJfC9eB8rbsaJTd5PVTgHdiqu TjHQ== 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:arc-authentication-results; bh=9BuTaG8oj8rtliTQvc6HLak5oAaQ1YoV5t+KIzPvrr4=; b=GuP1Wzg13sXOUZEtHFG5eK3xQkPqXXrL6Q2orDmdx9BP1vBLQcRiwjap19rj3LbiAi 1iV9b+OgvXSjcom/n/lnWjDMESUqSKl+wo5RVot4HDMggWxd4pWApv8QWhxjIWC1hpLL n+8SNgsZwMpt7TvoYlpfGxnyehwEB6I6h9qlr776uk2jLP+cyd9xnHVX1F58l67SO0O1 6VTb3jO/qeXc+xQhjB/WcAe30H+NqXTkS7MYfYP/JdDgIdpgbTlOlvBkRyM23Q/21Jkx pQnegW5GZ+Du+Do7dWz0JqwHT7LavqR7BGrRNhSp6Ugx5EL2w3L2Yk30d99tVspRgIjG eFoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WQe2CTcz; 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 g87-v6si8157127pfg.225.2018.08.09.08.03.35; Thu, 09 Aug 2018 08:03:49 -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=WQe2CTcz; 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 S1733226AbeHIR1T (ORCPT + 99 others); Thu, 9 Aug 2018 13:27:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:39536 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730634AbeHIR1S (ORCPT ); Thu, 9 Aug 2018 13:27:18 -0400 Received: from jouet.infradead.org (179-240-153-38.3g.claro.net.br [179.240.153.38]) (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 3E003214FF; Thu, 9 Aug 2018 15:01:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1533826920; bh=PHpTCiIKF82VDWDQRz3Ahv8+VjcLR5iF8+G6NT8Akk0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WQe2CTcz+cw9/rOpNkyOkvDGewbdn91aRIl1ejMnqwitj2F7QRFdvW4QMeI6u9IWX LHtdasGh1kM90B/kN+xXZXDjfa5IzbOE3Wtpb+HpLhsPkvulJzAMAKaylmVN79lpd1 pjsrccxnpu7cQnUJ/G5hUMJ53lqV6E8iK1xjatpE= 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 42/44] perf trace: Wire up the augmented syscalls with the syscalls:sys_enter_FOO beautifier Date: Thu, 9 Aug 2018 11:58:20 -0300 Message-Id: <20180809145822.21391-43-acme@kernel.org> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180809145822.21391-1-acme@kernel.org> References: <20180809145822.21391-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 We just check that the evsel is the one we associated with the bpf-output event associated with the "__augmented_syscalls__" eBPF map, to show that the formatting is done properly: # perf trace -e perf/tools/perf/examples/bpf/augmented_syscalls.c,openat cat /etc/passwd > /dev/null 0.000 ( ): __augmented_syscalls__:dfd: CWD, filename: 0x43e06da8, flags: CLOEXEC 0.006 ( ): syscalls:sys_enter_openat:dfd: CWD, filename: 0x43e06da8, flags: CLOEXEC 0.007 ( 0.004 ms): cat/11486 openat(dfd: CWD, filename: 0x43e06da8, flags: CLOEXEC ) = 3 0.029 ( ): __augmented_syscalls__:dfd: CWD, filename: 0x4400ece0, flags: CLOEXEC 0.030 ( ): syscalls:sys_enter_openat:dfd: CWD, filename: 0x4400ece0, flags: CLOEXEC 0.031 ( 0.004 ms): cat/11486 openat(dfd: CWD, filename: 0x4400ece0, flags: CLOEXEC ) = 3 0.249 ( ): __augmented_syscalls__:dfd: CWD, filename: 0xc3700d6 0.250 ( ): syscalls:sys_enter_openat:dfd: CWD, filename: 0xc3700d6 0.252 ( 0.003 ms): cat/11486 openat(dfd: CWD, filename: 0xc3700d6 ) = 3 # Now we just need to get the full blown enter/exit handlers to check if the evsel being processed is the augmented_syscalls one to go pick the pointer payloads from the end of the payload. We also need to state somehow what is the layout for multi pointer arg syscalls. Also handy would be to have a BTF file with the struct definitions used in syscalls, compact, generated at kernel built time and available for use in eBPF programs. Till we get there we can go on doing some manual coupling of the most relevant syscalls with some hand built beautifiers. Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Wang Nan Link: https://lkml.kernel.org/n/tip-r6ba5izrml82nwfmwcp7jpkm@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-trace.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 06215acb1481..22ab8e67c760 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -2042,7 +2042,10 @@ static int trace__event_handler(struct trace *trace, struct perf_evsel *evsel, fprintf(trace->output, "%s:", evsel->name); if (perf_evsel__is_bpf_output(evsel)) { - bpf_output__fprintf(trace, sample); + if (evsel == trace->syscalls.events.augmented) + trace__fprintf_sys_enter(trace, evsel, sample); + else + bpf_output__fprintf(trace, sample); } else if (evsel->tp_format) { if (strncmp(evsel->tp_format->name, "sys_enter_", 10) || trace__fprintf_sys_enter(trace, evsel, sample)) { -- 2.14.4