Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp70515imm; Wed, 5 Sep 2018 15:10:18 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda2jAoCTmhBmUC7AwfGE9lTVmoU2UzfRQPYK5uJzf3eSCPB8IE4ZAY1ZC7NEuUR/q2NMkkC X-Received: by 2002:a63:91c2:: with SMTP id l185-v6mr39466330pge.321.1536185417887; Wed, 05 Sep 2018 15:10:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536185417; cv=none; d=google.com; s=arc-20160816; b=hJ6dMDWeT1s4aIyyuHmzohVIU20tZkT9ctHmLRqYb1hxSnyVO3RlRIeksh8yDPMg/g JpHt0tSRFTRZIVc0hMqo8zsLzF+znOsn26SP5eyBTduqK20/3KDYEjTxYpkv1R60hMcV kabCmT3jj0Z8WXvk7GLc5vq3koO6bk4gFE9ddVMggxUsw0aaTViYDb0kRICLQHuqmmdM 8Y5jynskOv5DoFU8UZ3uIB86SsIbT6ubZAxjzmNLMr2I7X8jd3d8cgURB9TyCg7ggq9A CbobCa2DZGkb4faES6UqwNzEqJ71S7TiayCQYpLpAmV38gFa0S1HOaGEZt/1zf96EhG7 rB+Q== 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=GETiUP0f050cmgZbeocAyITtSgdmz7efQnBcnYWmLyM=; b=FS2yzevkhaG9MXkd0L9WUo7n/leEqq0S0/FHIr/8EBIAxVt33ng33rlUmuLd8L931q phNW0jAU5A3zs7gBWfTnb5ch13YUbxATV3UDn8PAx4U8Z4wcrtX1NIDxFfR49tgJVtQ9 lqqdv2OLQTt/wZfwQTQgKI2Sf2KxXWfhSnKor91NFJG4Hp1WlmvAEHja5xgNpcDtLhpL d1u09WHFrAPuLubV0m6LySMHQUz5ud2LDVRhpd730zd8p/TlVK5SbatwkVsb/d6vROHU 1S8PEh48kqPEApzU7bp5+YW+WPtHaRbbTPkbnPAOoVal2OzLb58ZJDpdMeSrvhNeCLnd xc9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lRFt6nCY; 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 e7-v6si3469622plk.122.2018.09.05.15.10.02; Wed, 05 Sep 2018 15:10:17 -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=lRFt6nCY; 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 S1729082AbeIFCkc (ORCPT + 99 others); Wed, 5 Sep 2018 22:40:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:55650 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727843AbeIFCkc (ORCPT ); Wed, 5 Sep 2018 22:40:32 -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 1F8AD2083E; Wed, 5 Sep 2018 22:08:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1536185299; bh=pAtyq/37Avr5F79cPT1Z7YjGINcTewnoeLYXOur+Ob0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lRFt6nCYX7XaUNhP7XhHvaNyfZrJ3c/GrzRfd1iaudtsI+Sw9wSIOGe4LqQop7HwP uiT3FrK9Z6iw9YSilQIrAfc/HJNvwhEM2lvy9sdlsVNaoPxnnLy/p/DyUPZ2V5o85M dXlWQkjC2H9xlb9IRMvle5NIgeesshSCyPAuN6yY= 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 74/77] perf trace: Setup augmented_args in the raw_syscalls:sys_enter handler Date: Wed, 5 Sep 2018 19:04:37 -0300 Message-Id: <20180905220440.20256-75-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 Without using something to augment the raw_syscalls:sys_enter tracepoint payload with the pointer contents, this will work just like before, i.e. the augmented_args arg will be NULL and the augmented_args_size will be 0. This just paves the way for the next cset where we will associate the trace__sys_enter tracepoint handler with the augmented "bpf-output" event named "__augmented_args__". Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Wang Nan Link: https://lkml.kernel.org/n/tip-p8uvt2a6ug3uwlhja3cno4la@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-trace.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 12356deb6046..2b99a02355cf 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -1697,6 +1697,8 @@ static int trace__sys_enter(struct trace *trace, struct perf_evsel *evsel, size_t printed = 0; struct thread *thread; int id = perf_evsel__sc_tp_uint(evsel, id, sample), err = -1; + int augmented_args_size = 0; + void *augmented_args = NULL; struct syscall *sc = trace__syscall_info(trace, evsel, id); struct thread_trace *ttrace; @@ -1720,13 +1722,24 @@ static int trace__sys_enter(struct trace *trace, struct perf_evsel *evsel, if (!(trace->duration_filter || trace->summary_only || trace->min_stack)) trace__printf_interrupted_entry(trace); - + /* + * If this is raw_syscalls.sys_enter, then it always comes with the 6 possible + * arguments, even if the syscall being handled, say "openat", uses only 4 arguments + * this breaks syscall__augmented_args() check for augmented args, as we calculate + * syscall->args_size using each syscalls:sys_enter_NAME tracefs format file, + * so when handling, say the openat syscall, we end up getting 6 args for the + * raw_syscalls:sys_enter event, when we expected just 4, we end up mistakenly + * thinking that the extra 2 u64 args are the augmented filename, so just check + * here and avoid using augmented syscalls when the evsel is the raw_syscalls one. + */ + if (evsel != trace->syscalls.events.sys_enter) + augmented_args = syscall__augmented_args(sc, sample, &augmented_args_size); ttrace->entry_time = sample->time; msg = ttrace->entry_str; printed += scnprintf(msg + printed, trace__entry_str_size - printed, "%s(", sc->name); printed += syscall__scnprintf_args(sc, msg + printed, trace__entry_str_size - printed, - args, NULL, 0, trace, thread); + args, augmented_args, augmented_args_size, trace, thread); if (sc->is_exit) { if (!(trace->duration_filter || trace->summary_only || trace->failure_only || trace->min_stack)) { -- 2.14.4