Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp968660rdb; Fri, 16 Feb 2024 00:46:39 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWjGh29tCLPUXuCxig+8f/hiynnWeD6439IhcCwRjku5DwZ6XUPYN16tRDAEjTNtBzaZ/UjIieK/T+b/+B3fc+03B0JgOiL9/Qa9faZTw== X-Google-Smtp-Source: AGHT+IEhvNOh08SjunFHS0ghRxSME9fQTx9GNP0eEnitPx/annwf57WXdFF8XS4mCjwOu7CRCASq X-Received: by 2002:a17:907:940f:b0:a3c:c13f:a1d9 with SMTP id dk15-20020a170907940f00b00a3cc13fa1d9mr7757927ejc.38.1708073199705; Fri, 16 Feb 2024 00:46:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708073199; cv=pass; d=google.com; s=arc-20160816; b=KlFxY2uXKAUO7JkUL8/kXPwG/Aarv4Gyo2md7I7DG3dTR/P2dpY03bIuVhR4mspUov AuqZPWuzKgXGWD5a0HssXVsOsTnVcMrP86LLngt4SiJxqx4kT6H8uM/qPT/w6dOnV9zV AmlyTsdQmHsBUH5yPfEMZS2nGn3wTSasWQjSHKADSywxF+CjJcDPLYr1JkqEIBCiXe88 gVn7nIxFc6RrOHvKMH9i4CipvS/4XA6G2/nIzMBEtcdxeb8/QW2ZNMo3cwnYB4BLUJV2 7WQmrR+6SfOqw7iJQMowGX71N5JVj/tul1OVl5CC3Rahr1wC2jhNMKM/1o4KGnr1S40c 8d2g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=Ofh+gQcatf/NCXAjsYiyGLwYkgcKa8Ly+9iGHxFoePM=; fh=Ub95fBsiseQVLo56fdyDA2zH9Ec5p8qFryhFaIE+jLo=; b=BIqCoxqBIR+hxVTi+s8jOeyYkYpni9i2WEwOUkKpXXs0duP4KTtYhVYGAp7Rc14q5L u9OHH7NX8GijkoZjA7Xhn5ZOYwv7BY+xa1DPLbFAirlEUTPEMk4sYzQJi3EAwI6o5Qf7 BgTle4AiQNj0i5ugGtDupAEVBj5t+5LY51pBer0O9grGW44+j7LcK/jyS52nz7VP2KE2 ZatwV2lm9q4++LHFaNDztaI+uFuwbtn5vSxSlTVQxB6dHMbLh7HhoOWaMaBAWPcozXfz sb9NMPnC5A70R4B5wOPpL0Cc4N0beZCnUTjSFGVZ2ZdmDMJUXRkAZFSGx3rCGPvlEeMm A26A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QIyKWQZy; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-68254-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68254-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id dk7-20020a170907940700b00a3d6f1ccea1si1533460ejc.854.2024.02.16.00.46.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 00:46:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-68254-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QIyKWQZy; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-68254-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68254-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 484C11F2192A for ; Fri, 16 Feb 2024 08:46:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3BFAE1C29F; Fri, 16 Feb 2024 08:41:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="QIyKWQZy" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B1A11C68C; Fri, 16 Feb 2024 08:41:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708072868; cv=none; b=D2PUcUjp6vwg8HPikGyjiiht+WFAUULdc3z6QhvwOesbrx3RaJCP7jSMe/BXVngFJJK2eB9uaIIhnYy67Ox9PvewBbnb18D+xkDarjZGHhF4r34S6BjmhsD9Zb7YQxeHVJ0nR+5VeNTeYbqX/M9JD1LBG+hHSddBxFh+b2Wmlrg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708072868; c=relaxed/simple; bh=wZvqkkB1tvM0qT7Zjonl08Zz23unYjSrGtBfMOx3z84=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=I4HXX4EgAuUKumU8dTd3+ctadyklikxxdsqCjUu89H8KDK/0dq/2JKH/IMU4H5GNGKBItN+ukC3xpaWBrl1o7UZfUeu3C8aC6GJMZf3+PofipXYW2L90meHvzRcEwWYBFjC1hsn7oiMxSvP8899FO50NAt30LfGx0tNgTRFTCp0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QIyKWQZy; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1BA29C433F1; Fri, 16 Feb 2024 08:41:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708072867; bh=wZvqkkB1tvM0qT7Zjonl08Zz23unYjSrGtBfMOx3z84=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=QIyKWQZy97QNoYLS2HFfBQL3l9noxnfyWzsod9pJNgjZW4LcYOhLsWdHTeyw4TWfv Lrfae77Vhn8tQO2Q8w6uk7jiCRO1xbiwVf9k9DFXKwGCyBqBqgpDd1b/Ya03l6Th3E PzIpSbPg1pD1+jFEubNfnXoX3h57WrjhvXBTJTFv1pl7y5+O9rF3y42HoEj+cCn4GV pHYpX3ygmCjtyVaIKnqUq1wSekoverdcEVq2St8b0SfJ0OjpVl88DftniBy4jwSBIM a3H7CucAu/R3IBk29M18Cd6AB7cJCLX5SuFrGVr/YuhBOnvozin/fP6jH2bjIjeHek a9d/tYlN+1VRA== Date: Fri, 16 Feb 2024 17:41:01 +0900 From: Masami Hiramatsu (Google) To: Steven Rostedt Cc: Alexei Starovoitov , Florent Revest , linux-trace-kernel@vger.kernel.org, LKML , Martin KaFai Lau , bpf , Sven Schnelle , Alexei Starovoitov , Jiri Olsa , Arnaldo Carvalho de Melo , Daniel Borkmann , Alan Maguire , Mark Rutland , Peter Zijlstra , Thomas Gleixner , Guo Ren Subject: Re: [PATCH v7 21/36] function_graph: Add selftest for passing local variables Message-Id: <20240216174101.57c4e61a0d6b4ed21c2a22bd@kernel.org> In-Reply-To: <20240215100254.2891c5da@gandalf.local.home> References: <170723204881.502590.11906735097521170661.stgit@devnote2> <170723228217.502590.6615001674278328094.stgit@devnote2> <20240215100254.2891c5da@gandalf.local.home> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 15 Feb 2024 10:02:54 -0500 Steven Rostedt wrote: > On Wed, 7 Feb 2024 00:11:22 +0900 > "Masami Hiramatsu (Google)" wrote: > > > From: Steven Rostedt (VMware) > > > > Add boot up selftest that passes variables from a function entry to a > > function exit, and make sure that they do get passed around. > > > > Signed-off-by: Steven Rostedt (VMware) > > Signed-off-by: Masami Hiramatsu (Google) > > --- > > Changes in v2: > > - Add reserved size test. > > - Use pr_*() instead of printk(KERN_*). > > --- > > kernel/trace/trace_selftest.c | 169 +++++++++++++++++++++++++++++++++++++++++ > > 1 file changed, 169 insertions(+) > > > > diff --git a/kernel/trace/trace_selftest.c b/kernel/trace/trace_selftest.c > > index f0758afa2f7d..4d86cd4c8c8c 100644 > > --- a/kernel/trace/trace_selftest.c > > +++ b/kernel/trace/trace_selftest.c > > @@ -756,6 +756,173 @@ trace_selftest_startup_function(struct tracer *trace, struct trace_array *tr) > > > > #ifdef CONFIG_FUNCTION_GRAPH_TRACER > > > > +#ifdef CONFIG_DYNAMIC_FTRACE > > + > > +#define BYTE_NUMBER 123 > > +#define SHORT_NUMBER 12345 > > +#define WORD_NUMBER 1234567890 > > +#define LONG_NUMBER 1234567890123456789LL > > + > > +static int fgraph_store_size __initdata; > > +static const char *fgraph_store_type_name __initdata; > > +static char *fgraph_error_str __initdata; > > +static char fgraph_error_str_buf[128] __initdata; > > + > > +static __init int store_entry(struct ftrace_graph_ent *trace, > > + struct fgraph_ops *gops) > > +{ > > + const char *type = fgraph_store_type_name; > > + int size = fgraph_store_size; > > + void *p; > > + > > + p = fgraph_reserve_data(gops->idx, size); > > + if (!p) { > > + snprintf(fgraph_error_str_buf, sizeof(fgraph_error_str_buf), > > + "Failed to reserve %s\n", type); > > + fgraph_error_str = fgraph_error_str_buf; > > + return 0; > > + } > > + > > + switch (fgraph_store_size) { > > + case 1: > > + *(char *)p = BYTE_NUMBER; > > + break; > > + case 2: > > + *(short *)p = SHORT_NUMBER; > > + break; > > + case 4: > > + *(int *)p = WORD_NUMBER; > > + break; > > + case 8: > > + *(long long *)p = LONG_NUMBER; > > + break; > > + } > > + > > What would be an interesting test is to run all versions together. That is, > to attach a callback that stores a byte, a callback that stores a short, a > callback that stores a word and a callback that stores a long, and attach > them all to the same function. > > I guess we can add that as a separate patch. Would you mean we should have different callbacks which stores the different size of data instead of using switch()? Thank you, > > -- Steve > > > > + return 1; > > +} > > + -- Masami Hiramatsu (Google)