Received: by 2002:a05:7412:a9a3:b0:f9:327e:43ab with SMTP id o35csp87844rdh; Mon, 18 Dec 2023 05:17:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IEnK9WbibwcP5LFSGRKu1TqTSGs6ThM3+pinOCz0akec1QH3IoZ/7JUYe1H8fcw1QaAKJ/I X-Received: by 2002:a05:6a21:3284:b0:18f:fe5a:8bb7 with SMTP id yt4-20020a056a21328400b0018ffe5a8bb7mr20272151pzb.24.1702905457742; Mon, 18 Dec 2023 05:17:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702905457; cv=none; d=google.com; s=arc-20160816; b=t4KEwT/wtWRlV2+Xkj5S8LFgBEwilwpqyBmO1zm+s7scbOHOpaJcYJOE1HBuL+JQUt kAI9xLLBNTHn572AQxj8NvPdZaBg2hyFTK2377YIPVnVtrdkmJAq7iC3yHPGqEsnF7gR IeG6/5sEFr+ia7o35n/lDaD+iHYqv0KNXLKr9tnS5Jpoq46tYGksJhQke7HVdFQJmdWO Y/QB1LE2jgWqYqwufCkyIy2YKWKbkE0lWCLD18KhpamQBhrx5W/hS2K4qm5JuJqeAA2Q VnxX311f8JTE5YvVXPUj0RNbeOBxbSBfDX/0wP7xbiYwRI6ncZL9W1Z640brWey/WMam atmA== ARC-Message-Signature: i=1; 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:user-agent:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=u/kik4VLGZC2GW07eIANh56Vc+hGBXm7uOb3XXHxgl4=; fh=SIgps5XdV0XNwjZfT2uAI7g3mrspDldK9Qs8qQAfoa4=; b=Gu/XP4KB0cKgkGeSBCHD3pIX/Lx/pxmpEHdcI16Udug1RaO0VsxBic9n2MIawl6MfR n8In9+hzLjjGqncg71pyM454++CxJ+dbKaaK1IDtKuPJfE+UcxjwS28oWXH6PCJ63chw cdTF/Ui5AnNvBEfCue+bKogual0Z11VJUYAUvFedi+I0NJOXudE50gQIsw5dU75hytHP upz9/J1remQ3JtglqT09Mv20rnJ75bRCihhtH2IzxQ9hMoKgv2nnnXKw1m/m/qrZIzCI vhEefqzEaauUDbssxuSiIFsP6eS1UOAyjL765K9JIAZ33NB2u/bY5zGqTRc/+IH+gWB6 Mtsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=urBgMfpG; spf=pass (google.com: domain of linux-kernel+bounces-3704-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3704-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id f18-20020a056a0022d200b006d6778e65a7si2347164pfj.100.2023.12.18.05.17.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 05:17:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-3704-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=urBgMfpG; spf=pass (google.com: domain of linux-kernel+bounces-3704-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3704-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 70438B22C3A for ; Mon, 18 Dec 2023 13:15:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6FD7137885; Mon, 18 Dec 2023 13:11:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="urBgMfpG" X-Original-To: linux-kernel@vger.kernel.org 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 7676A3D55B; Mon, 18 Dec 2023 13:11:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC6EFC433C8; Mon, 18 Dec 2023 13:11:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702905110; bh=HAB8fcsYhkztOqkqxJN8HQ+Use/Y/czjonQXwZoidcQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=urBgMfpGrY+s01wqgzm2l/QZu9CJ/ZPp3rxkCXKTVFd52xXIG7+i62qvW14PT3XBP lXEstftk0hjItrksB+PXkx9ba+4nDAnPSM7UwLo1Z5SAigtoDZHzAu5VNvzd+w8xcw ikR7Kt3yJZw6rYBnM6W8Pz12Bi4dzXUoJhmBh8czKkDN40JBcq3gBg4uKsrEuQ1GPh DYeIS14AGUoQL9j6H5yBiG6Aj5fJyhZXQwo5PauZBA3tHoO5FztHJWGdwGfB34Qjsc r07GnAxtejzHAtnH8WwF1rAiKxPtvKU6SMmlm7Rn07psCDqr/ao6OeSIAzsms3XXfa t8cnDEc4I+bKg== 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 v5 01/34] tracing: Add a comment about ftrace_regs definition Date: Mon, 18 Dec 2023 22:11:44 +0900 Message-Id: <170290510399.220107.17645951919819438730.stgit@devnote2> X-Mailer: git-send-email 2.34.1 In-Reply-To: <170290509018.220107.1347127510564358608.stgit@devnote2> References: <170290509018.220107.1347127510564358608.stgit@devnote2> User-Agent: StGit/0.19 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="utf-8" Content-Transfer-Encoding: 8bit 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; };