linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Thomas Richter <tmricht@linux.ibm.com>
Cc: acme@kernel.org, Namhyung Kim <namhyung@kernel.org>,
	linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org,
	linux-perf-users@vger.kernel.org, agordeev@linux.ibm.com,
	gor@linux.ibm.com, sumanthk@linux.ibm.com, hca@linux.ibm.com,
	japo@linux.ibm.com
Subject: Re: [PATCH Linux-next] perf test: Fix test case perf trace BTF general tests
Date: Wed, 26 Nov 2025 12:37:55 -0500	[thread overview]
Message-ID: <20251126123755.47aa3f11@gandalf.local.home> (raw)
In-Reply-To: <20251126121229.0638407b@gandalf.local.home>

On Wed, 26 Nov 2025 12:12:29 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:

> Arnaldo,
> 
> How can I make perf trace not confused by the extra fields in the system
> call trace events?
> 
> Ftrace can now show the contents of the system call user space buffers, but
> it appears that this breaks perf!!!
> 
> system: syscalls
> name: sys_enter_write
> ID: 791
> format:
> 	field:unsigned short common_type;	offset:0;	size:2;	signed:0;
> 	field:unsigned char common_flags;	offset:2;	size:1;	signed:0;
> 	field:unsigned char common_preempt_count;	offset:3;	size:1;	signed:0;
> 	field:int common_pid;	offset:4;	size:4;	signed:1;
> 
> 	field:int __syscall_nr;	offset:8;	size:4;	signed:1;
> 	field:unsigned int fd;	offset:16;	size:8;	signed:0;
> 	field:const char * buf;	offset:24;	size:8;	signed:0;
> 	field:size_t count;	offset:32;	size:8;	signed:0;
> 	field:__data_loc char[] __buf_val;	offset:40;	size:4;	signed:0;
> 
> That new __buf_val appears to confuse perf, but I'm having a hell of a time
> trying to figure out where it reads it!
> 

Hmm, it gets less confused (at least it doesn't crash), when I don't have
perf read the extra values.

Thomas, if you add the below patch, does it fix things for you?

-- Steve

diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c
index e96d0063cbcf..add809d226dc 100644
--- a/kernel/trace/trace_syscalls.c
+++ b/kernel/trace/trace_syscalls.c
@@ -1403,7 +1403,6 @@ static void perf_syscall_enter(void *ignore, struct pt_regs *regs, long id)
 	struct hlist_head *head;
 	unsigned long args[6];
 	bool valid_prog_array;
-	bool mayfault;
 	char *user_ptr;
 	int user_sizes[SYSCALL_FAULT_MAX_CNT] = {};
 	int buf_size = CONFIG_TRACE_SYSCALL_BUF_SIZE_DEFAULT;
@@ -1431,15 +1430,6 @@ static void perf_syscall_enter(void *ignore, struct pt_regs *regs, long id)
 
 	syscall_get_arguments(current, regs, args);
 
-	/* Check if this syscall event faults in user space memory */
-	mayfault = sys_data->user_mask != 0;
-
-	if (mayfault) {
-		if (syscall_get_data(sys_data, args, &user_ptr,
-				     &size, user_sizes, &uargs, buf_size) < 0)
-			return;
-	}
-
 	head = this_cpu_ptr(sys_data->enter_event->perf_events);
 	valid_prog_array = bpf_prog_array_valid(sys_data->enter_event);
 	if (!valid_prog_array && hlist_empty(head))
@@ -1457,9 +1447,6 @@ static void perf_syscall_enter(void *ignore, struct pt_regs *regs, long id)
 	rec->nr = syscall_nr;
 	memcpy(&rec->args, args, sizeof(unsigned long) * sys_data->nb_args);
 
-	if (mayfault)
-		syscall_put_data(sys_data, rec, user_ptr, size, user_sizes, uargs);
-
 	if ((valid_prog_array &&
 	     !perf_call_bpf_enter(sys_data->enter_event, fake_regs, sys_data, rec)) ||
 	    hlist_empty(head)) {

  reply	other threads:[~2025-11-26 17:37 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-17 12:43 [PATCH Linux-next] perf test: Fix test case perf trace BTF general tests Thomas Richter
2025-11-18  1:58 ` Namhyung Kim
2025-11-18  6:15   ` Thomas Richter
2025-11-18  6:43     ` Namhyung Kim
2025-11-18 18:24       ` Steven Rostedt
2025-11-19  4:36         ` Namhyung Kim
2025-11-19 17:59           ` Steven Rostedt
2025-11-20  0:52             ` Namhyung Kim
2025-11-26  7:13               ` Thomas Richter
2025-11-26 15:24                 ` Steven Rostedt
2025-11-26 17:12                   ` Steven Rostedt
2025-11-26 17:37                     ` Steven Rostedt [this message]
2025-11-26 18:57                     ` Namhyung Kim
2025-11-26 19:01                       ` Howard Chu
2025-11-27  6:28                   ` Thomas Richter
2025-11-18 18:30 ` Jan Polensky
2025-11-19  7:55   ` Thomas Richter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251126123755.47aa3f11@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=acme@kernel.org \
    --cc=agordeev@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=japo@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=namhyung@kernel.org \
    --cc=sumanthk@linux.ibm.com \
    --cc=tmricht@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).