Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1160047rdb; Mon, 19 Feb 2024 06:17:03 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUuiGqP873RJ2zJUff6Bb36SJWIx7913ku8j2s3KCTIPNi+ruutsHPyMNZW232gidGyNGA+oauJGIZTt8YDrJzGbao68mN/5jy9ocu1xg== X-Google-Smtp-Source: AGHT+IEkQdy1HZr7f/McRrs8D95rJ6KgnAUB4MVDWXozYzw0KzdM4ShXvf/8ZRWvGWANcwK70wjv X-Received: by 2002:a17:902:7ed7:b0:1db:f696:b09 with SMTP id p23-20020a1709027ed700b001dbf6960b09mr2807224plb.14.1708352223380; Mon, 19 Feb 2024 06:17:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708352223; cv=pass; d=google.com; s=arc-20160816; b=pMEY6tmzJP16YTrlfPAnkdbg9dt7UFeMTTkYe3w+WGXKwAZ1yTU6op99GCLWfd3Wc8 3t1DqOo1/Q24Z5VxstRyiEzNry+Kj2I4pHGSa7ji2k0g28Yysjw9YQLJvPKGRF66x74q txbbK9FtUt4yel0678DhbX4QX5fe1MOSP2GtaQzR4LKVRZf6JcHI+++ZUILFRkBgtLu6 AcPq5QTWynkb1zxXkn340911IfmBZGTjp0ew9lYnmjjzauWIOKDvixzohc2DWueGafT2 ACX9TRfCI4hI+4wko4gZi3Ak5gObDQdO+KjTXwUykEBlS2TT7siHlIEGe8RjO1oZgOLC LDFQ== 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=pBWC1AEd/PuNG3CTo9INMifPGnJ/6eYkSwQ0MICH7Ig=; fh=JbhdnWdlHkuwEPiZq0/TbZJ4Zl3MiS+T6WvHc/34lPM=; b=NPanx8zfjYDV4ig6WoQAoGObFje2URlsIeBRojXZaGrmfMGjLUKe5rFu1xoyyxetkI ymqOX24I8CnPRAVU3JReMuKynep+I084QIho1XkBzUesX+O4Udyrn5ffuUkZ85neWflv Rxo+Q3YK+JUonlcob4pWRvmfAwiqSAtAZQysh/rTWS8FaUFLv2S3iwKYhg0cXZktMHLq M3ytADUmzvaBq4+7m3ifFcYZclRDDicuh6r3j3t9IL+kIduuQektmPMkUV5WHxSfyK3c tHcv2B3yoY8+2nOX3RvSPiUm3w2ggocjwdsGuY+pNmm/VeiZzzJXLt+yRtIyA5/Wxhw8 ruKA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jedCcVnU; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-71446-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71446-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id kd16-20020a17090313d000b001db44359989si4471057plb.62.2024.02.19.06.17.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 06:17:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71446-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jedCcVnU; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-71446-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71446-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 834AE285799 for ; Mon, 19 Feb 2024 14:04:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B7F11374C3; Mon, 19 Feb 2024 14:04:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jedCcVnU" 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 D7380374CB; Mon, 19 Feb 2024 14:04:42 +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=1708351483; cv=none; b=d3Zcq2zeX/op1fV0TYyKBhgP1We4ldPGk6ax4eDOOaFBKzey/QetTzhJGuuBN7fJk56LelK3oq/AoXoAe2S5Cno+K87db8EDD97B5lLUKQPraBZNY0+9lUbtFIUBeE8GCpvb+TDUP7aM3/prMBfJOhDd7Pza33ackTZJM9Ejp2s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708351483; c=relaxed/simple; bh=MIUwjUjiAAu1+q/+I/qDOmSpFjx0udf6D1AQ0UhEV0k=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=Moko6YmUs9VBaJe3gswYATlz21uLWzHzJd6tGzdnuR2BppuRkoK3FoAFu/0C04n3/yikxEIfBBG9xXmCoTq8wRyPz5mjx/pdA0ZRnHjlbpK3PbGCJ2QRIUGTHk1qQCNXu1komn4YBTWZrIFAvupLeXd83BFax2Yvz9i+KLLeLLQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jedCcVnU; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69997C433F1; Mon, 19 Feb 2024 14:04:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708351482; bh=MIUwjUjiAAu1+q/+I/qDOmSpFjx0udf6D1AQ0UhEV0k=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=jedCcVnUuRu7WsgBTsb7EkozXwzEc3q772jGzsuk/FFQmz1tgYk50Mc2U2wZx/91y WbyV4CYns7fJxNb3T8sbT12ZpsxAvz2UMK8HNJHAexd4YIf8Hs2kCUnCPh9LjJA5i9 +hn23n7mOO5tHgEfkBrZgFCR2JEFmex5DzGDmSxO+YbV1llrm+6ORSDZrT3eMEfBRX agBkU5jq7zX0iCu9JbIUWEkodqBPYXRWjjT9cerlSRJrTQNy15NwcypdqVWi+pqJ0s garRRcf/WFr8bICdloI03C9IvteoR/FOsb4rhi1IkfFqsHafVmJeun6ny9xToBXma0 5+xmyVcvS+AFA== Date: Mon, 19 Feb 2024 23:04:35 +0900 From: Masami Hiramatsu (Google) To: Masami Hiramatsu (Google) Cc: Steven Rostedt , 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 23/36] function_graph: Add a new exit handler with parent_ip and ftrace_regs Message-Id: <20240219230435.3158a36f60c20dcf2112cf0f@kernel.org> In-Reply-To: <20240218115328.c95bfe7001b7260071e6b674@kernel.org> References: <170723204881.502590.11906735097521170661.stgit@devnote2> <170723230476.502590.16817817024423790038.stgit@devnote2> <20240215110404.4e8c5a94@gandalf.local.home> <20240216175108.79a256a20c89ed1d672c7e14@kernel.org> <20240218115328.c95bfe7001b7260071e6b674@kernel.org> 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 Hi Steve, On Sun, 18 Feb 2024 11:53:28 +0900 Masami Hiramatsu (Google) wrote: > On Fri, 16 Feb 2024 17:51:08 +0900 > Masami Hiramatsu (Google) wrote: > > > > > @@ -798,10 +798,6 @@ ftrace_pop_return_trace(struct ftrace_graph_ret *trace, unsigned long *ret, > > > > > > > > *index += FGRAPH_RET_INDEX; > > > > *ret = ret_stack->ret; > > > > - trace->func = ret_stack->func; > > > > - trace->calltime = ret_stack->calltime; > > > > - trace->overrun = atomic_read(¤t->trace_overrun); > > > > - trace->depth = current->curr_ret_depth; > > > > > > There's a lot of information stored in the trace structure. Why not pass > > > that to the new retregfunc? > > > > > > Then you don't need to separate this code out. > > > > Sorry, I couldn't catch what you meant, Would you mean to call > > ftrace_pop_return_trace() before calling retregfunc()?? because some of the > > information are found from ret_stack, which is poped from shadow stack. > > Ah, sorry I got what you said. I think this `trace` is not usable for the new > interface. Most of the information is only used for the function-graph tracer. > For example, trace->calltime and trace->overrun, trace->depth are used only > for the function-graph tracer, but not for the other tracers. > > But yeah, this idea is considerable. It also allows us to just update > entryfunc() and retfunc() to pass fgraph_regs and return address. The reason why I didn't use the those for *regfunc() is not only those have unused information, but those does not have some params. - ftrace_graph_ent only have current `func`, but entryregfunc() needs `parent_ip` (== return address) - ftrace_graph_ret only have current `func`, but retregfunc() needs `ret` (== return address) too. If I update the ftrace_graph_ent/ret to add 'retaddr', we can just pass ftrace_graph_ent/ret, ftrace_regs, and fgraph_ops to *regfunc(). Moreover, maybe we don't need *regfunc, but just update entryfunc/retfunc to pass ftrace_regs *, which will be NULL if it is not supported. Thank you, -- Masami Hiramatsu (Google)