From patchwork Fri Dec 8 10:24:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 175729 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp5362025vqy; Fri, 8 Dec 2023 02:24:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IGNOhT7iu2WgkO9Js3q/iubxhvn/y5FNlUxaFtib5lWM5OqHNrXE523s6Dd2Zcgb26bh8JD X-Received: by 2002:a17:90a:e293:b0:286:6cc1:2cc2 with SMTP id d19-20020a17090ae29300b002866cc12cc2mr3293311pjz.76.1702031087487; Fri, 08 Dec 2023 02:24:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702031087; cv=none; d=google.com; s=arc-20160816; b=eCC05BHV1Mnhh9hct3VvrlCJ8xG9vQoamPCJ+crK/EG/QTzj6S3qHiLbMgBKVXT4vD dYLC/CryZsG11kXq+9EdtaoklIdHq2jgsTnTldRg1FkMj3Xz66VQ7mJNg8N6dISGZM2b 56GEQy2hJOE+zgctRr0Hkf99sBLk64EUQsOknP8ZIzukoq3JLcqJUHjIZ1fW+K1J1Qjx UfagGPbuiD89It/9eZaVMbPuqzPd5zm7+W4rNiX5EVlIUwLfuUX0UT728ck3TQ+c3ebA rMZibYuG28s4mXizCbD9baF5Ygo2TfTa4GRq+fcr+An5VUXA+w06Wt6K4L2+TOy3rlTm fsFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=u/kik4VLGZC2GW07eIANh56Vc+hGBXm7uOb3XXHxgl4=; fh=SIgps5XdV0XNwjZfT2uAI7g3mrspDldK9Qs8qQAfoa4=; b=v9ORnIAs9AHIjOgPwxWIbQVREcPPGV4CfLw1D+y+SzcW/gaOUl10jGemScsj6PxjeP SdC2LDkv7xjYzQJN3xpHpKNy7pu/792ds5DVKpCkBCYnBTgFL6VF3C3hQLxr237F2vzb PTIXsSAv67ZPhhaeDsbVQJU6Pt4ZiSA46Zd4F086GZYpTLwStHveDimudXPwiak5lQXa y0Gw0XZoKY43vSdlinHNYnACbKgNvCj8wXNFSwEitBDKQhnXjn5YS5TQw+NWgaNCpLBg chXl0ycqQ8AYzbvRV0NyDBCzjfjuxs0pkMepEIP8YcFJpuocKfVnYnwlrp2tH1bB3NAB tICA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GKgxwFmt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id z3-20020a170903018300b001cfb4ceb73bsi1422884plg.569.2023.12.08.02.24.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 02:24:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GKgxwFmt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id C46DA80F6979; Fri, 8 Dec 2023 02:24:44 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573518AbjLHKYb (ORCPT + 99 others); Fri, 8 Dec 2023 05:24:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573512AbjLHKY2 (ORCPT ); Fri, 8 Dec 2023 05:24:28 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4DE41727 for ; Fri, 8 Dec 2023 02:24:34 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BB76C433B7; Fri, 8 Dec 2023 10:24:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702031074; bh=HAB8fcsYhkztOqkqxJN8HQ+Use/Y/czjonQXwZoidcQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GKgxwFmt6nupNw1bNem/yFo57h5McuNWSuBP6GQxThVplbHcJuHWnlU6QzOH+QjSN TMllc+YsCJffIAtbl4ZDabzD9ROAuUiXeKWEYH9h1+9ZqeuKouqD6pW91hbLbnjcRB t5JNbMzYMhefnjEfPpqVc00ezORgFZ1FqQ2xq6NWPnjrQLCqKRghDoG8V5v2K6Vu0j 4vpEWbmsG0cccQ10CqgSNfl5fX3tomBQCEtgsJFjFI1P5hcMPYLrm8yBKmoxd4VLRN whyKOrWZkLM9vEgzYZm4VTBwBeyeZKXIlSjfKdtVFXldsqkuZa91d/se7yxKvpTPTc JaFpjLo6agHbw== From: "Masami Hiramatsu (Google)" To: Alexei Starovoitov , Steven Rostedt , Florent Revest Cc: 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: [PATCH v4 01/33] tracing: Add a comment about ftrace_regs definition Date: Fri, 8 Dec 2023 19:24:28 +0900 Message-Id: <170203106761.579004.12087604586094043124.stgit@devnote2> X-Mailer: git-send-email 2.34.1 In-Reply-To: <170203105427.579004.8033550792660734570.stgit@devnote2> References: <170203105427.579004.8033550792660734570.stgit@devnote2> User-Agent: StGit/0.19 MIME-Version: 1.0 X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 08 Dec 2023 02:24:44 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784708949298532536 X-GMAIL-MSGID: 1784708949298532536 From: Masami Hiramatsu (Google) To clarify what will be expected on ftrace_regs, add a comment to the architecture independent definition of the ftrace_regs. Signed-off-by: Masami Hiramatsu (Google) --- Changes in v3: - Add instruction pointer Changes in v2: - newly added. --- include/linux/ftrace.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index e8921871ef9a..8b48fc621ea0 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h @@ -118,6 +118,32 @@ extern int ftrace_enabled; #ifndef CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS +/** + * ftrace_regs - ftrace partial/optimal register set + * + * ftrace_regs represents a group of registers which is used at the + * function entry and exit. There are three types of registers. + * + * - Registers for passing the parameters to callee, including the stack + * pointer. (e.g. rcx, rdx, rdi, rsi, r8, r9 and rsp on x86_64) + * - Registers for passing the return values to caller. + * (e.g. rax and rdx on x86_64) + * - Registers for hooking the function call and return including the + * frame pointer (the frame pointer is architecture/config dependent) + * (e.g. rip, rbp and rsp for x86_64) + * + * Also, architecture dependent fields can be used for internal process. + * (e.g. orig_ax on x86_64) + * + * On the function entry, those registers will be restored except for + * the stack pointer, so that user can change the function parameters + * and instruction pointer (e.g. live patching.) + * On the function exit, only registers which is used for return values + * are restored. + * + * NOTE: user *must not* access regs directly, only do it via APIs, because + * the member can be changed according to the architecture. + */ struct ftrace_regs { struct pt_regs regs; };