Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp510736rdb; Thu, 15 Feb 2024 07:02:53 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWd41Nu5MZ8zVyFptlxGVq/FbUQdK3+cOGJtvAa0nDN05TM09tRupScebvuV/XSg83Z4B4RILaKgyomfJXCZe1AhmRxCdcHCkeMyIDNNg== X-Google-Smtp-Source: AGHT+IGfdgPuEWBSUBJo5W/O4l+yEtspMpCMnv3j05CVv6X++L4/+x/YHmi4lL9v5g853LELqqYI X-Received: by 2002:a05:6402:5178:b0:562:f95:ef61 with SMTP id d24-20020a056402517800b005620f95ef61mr2024151ede.1.1708009373350; Thu, 15 Feb 2024 07:02:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708009373; cv=pass; d=google.com; s=arc-20160816; b=AzJ+pRIUXhl8FG2eMJF5W4YTswWAuvRuKCPi2lA1JKoLCs4t5YOrmO0LtXpy7BnFLW uQl76wP9X34u1iA1rT+DeNcyPj7rZaWQ2SgSLRCwKRVBmhkch5swRbgwiGKzWmnpkzxD +6RmpvxFNqw6IgpKPvFilAg4blXu5J8IHV0I6Qq40jthtgztYyEEguy17ZqGtvk4dZmA WnLp/FxW587J7wuYARmCuT3O0K3D7nhASGVHVXYInUoJ1R2VPxkDQXtA6FB3OzOjCFzJ bIgkjMOXZ7Why8gXi8lsU3QZzUk23rIt3p57vEvx7CHgyI8+IH38q5d26wTfUvcUM9jv 1cKw== 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; bh=cgU8gxvGta2spcCo9O1aDAUAixHG5NzyKQFMmUCFBRQ=; fh=VaF/w+FGpk/prTFLJfCoV+GJDmV0Sd6dt8EMZrBTbz0=; b=GkFMLXOG5I2q9H6r7XuBInZ1j1zPMWfp1NgpNMpcKe9ZlRiHhKhjz37hMp7xlka3ym mN50JO9CLu/z3psNV4WEjQewQy0AiPmKKFcPXgDhWefrgRRzEedTHcTAt00Vva9d2AQR aa/V9cbCmb5m10b8jgY6ryn4OFriR6Y57/bjV0p/LDC9J9es+xat3Z6aB0Is9Cfg601i npVEfMzmqqKo6H6+lN//ZkurBfgaZQ1vsl1Mreq3zuqrLB9TprU8a+VMAxS2IrvjaUEK /pA9t4aXk7djm20oP0jNPRByaYLVFThSmX1EuE0q9UX2X+A5L1AWqS26HubYVw9OPyaW Zl5Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-67133-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67133-linux.lists.archive=gmail.com@vger.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 j21-20020aa7c0d5000000b00562165e160fsi690250edp.659.2024.02.15.07.02.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 07:02:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67133-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; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-67133-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67133-linux.lists.archive=gmail.com@vger.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 1AA4C1F220A9 for ; Thu, 15 Feb 2024 15:02:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 91E6F13329E; Thu, 15 Feb 2024 15:01:23 +0000 (UTC) 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 0F947131E3D; Thu, 15 Feb 2024 15:01:22 +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=1708009283; cv=none; b=qJten8rPfNtTil7J6xT6AwRjUL3NyiSXj8q1/8Iz2wtG/HoFiKUTslrnjcebcxKZLSfqtjaG5NH2tlzFH+RcvJuCBKDBVhGZYTY6zoj9JOt8r/spuz2FKABA/oGeshO//ikcCgmROkPOxjLCeglGYfgJ4A8bYE5kagpJ7tzaBes= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708009283; c=relaxed/simple; bh=idPar8TnYrcn1/ehunJjNHy7HB5Glf8ubsjkXlG3MF4=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Q7GVdUPhoW1MZ3jxQayIwDJnuCy3VtlaOaOvhhxuAPnfqMeP00mq58Ln5pZT9PpOO6CYmBOYP2ZG7tb32kaA8C1yrMrfVGXOM2Q1yP8XNSKJyA9EYdzvx04xfYMKh08Y0F+AyETv/7IJ0lB1mxD0P6hmVg30N05C68nYd22mJHo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9CB4C433F1; Thu, 15 Feb 2024 15:01:20 +0000 (UTC) Date: Thu, 15 Feb 2024 10:02:54 -0500 From: Steven Rostedt To: "Masami Hiramatsu (Google)" 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: <20240215100254.2891c5da@gandalf.local.home> In-Reply-To: <170723228217.502590.6615001674278328094.stgit@devnote2> References: <170723204881.502590.11906735097521170661.stgit@devnote2> <170723228217.502590.6615001674278328094.stgit@devnote2> X-Mailer: Claws Mail 3.19.1 (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 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. -- Steve > + return 1; > +} > +