Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp2194712rdd; Fri, 12 Jan 2024 02:12:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IHkMaXdoo6Q5lHaiApqzYFLoxS41TtCIDpwvq11jx0DKQ6xwpnmFY5tjqXLM0LPGqnVI8Zo X-Received: by 2002:a05:6214:f6b:b0:680:b719:8e35 with SMTP id iy11-20020a0562140f6b00b00680b7198e35mr707665qvb.60.1705054328747; Fri, 12 Jan 2024 02:12:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705054328; cv=none; d=google.com; s=arc-20160816; b=i034KsREgSRP6JCGJrciAhNFtQfaxDM8XfhF5AxvfrjK1+OxcIICnu8IXBJSGRtAkc ZuBMj0DKRLSrUn9ASSmkOiirHuD8pGDWFY5C4QX5T99NPYaXRXP0HM8IRoUDDp/x+J00 xHXdW0Gc9C5/PB13IanIdaHksFtkThZitQtv3kFj8bZDCWoKgRqwbLVwcR1VZJx77HIw cp5VovtWQDY2J52d6B6ym21n87Z7ZCfl/QsHsuI5MUghq2ouPA+GZd6WlytalLEascIG bvtuV5ys7yfR+u+l2o9rcC2HkQc1yhH4BrRk0SEzBSCAJS/gCPtc+sbKLBautUdQX9y9 oahQ== 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=pkOupataBJGsCIvcHYS0aTNEYz0mzBxc/lo+KDKHOFs=; fh=SIgps5XdV0XNwjZfT2uAI7g3mrspDldK9Qs8qQAfoa4=; b=z6ExhleRBW+uSCYJfHmlgAB+x7SQhA5/R7SggNQUeMDFASLQEdXMYnl8U6Nlfqgjv7 xC59M5R5svRuqNFEr2fdtPCgmXQeI0h+P5GeckiYiWaZYxouBxFL95wLK7ZPYstU/qwE uJvxofABXp6ofk3zFL2HpPLClOIbSqK4jIdT+2OIQGe4HU02E3vgn4ddaNSR21tmfEQB NGNAy64GlWxEZwIvuS9m82Hsdv5nVS7O8St3/RfH2WmOOt468Nq//KUXhFDLlVG0Mf1d FggiiQl92kBtCl5iKpDVcjzyjSeB7UrR7uf6EDO7Um51LQfRcQOC9pR4ObwtobXD2b3m a/Bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NxFC9jkP; spf=pass (google.com: domain of linux-kernel+bounces-24547-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24547-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id j16-20020a0cf510000000b0067f9276f8d2si2517562qvm.87.2024.01.12.02.12.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jan 2024 02:12:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-24547-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NxFC9jkP; spf=pass (google.com: domain of linux-kernel+bounces-24547-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24547-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 644E81C24C59 for ; Fri, 12 Jan 2024 10:12:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3C7D35DF3F; Fri, 12 Jan 2024 10:11:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NxFC9jkP" 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 665DD5DF2D; Fri, 12 Jan 2024 10:11:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13778C433C7; Fri, 12 Jan 2024 10:11:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705054280; bh=fXbFH1CnbhIn3DpSugbxQNOb5BcqjkwOHd00xmP9WY0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NxFC9jkPlN7an4Xdrcilr85BFyWOBxS44YIJ5+Dt9J6JLNEDC3QdtLIHFR8IT3kQN G8liurMBGobnwfTC73+AbA3lQaMeqR2DczjfaLbTS0YoZkOyDdzTZWvAoXxTskexq6 AQnxsJ50Maai1qxPXo6HrC3PW49QHGnoJj3+uH8J6orHR6qSYdygSB9U0TGmouNY1k fpnTX6XlmcSuhGki25n7J2PrIkRQ3oP1CeZFfl3ZYjZXxdtKH6ZhO8TQ/PaLlcFIAT GR5fg4IaHuvRc901FQnjrt8oP5ZWyrXvX5mAY1uOL6jc1u1GzPCVYieyb2ZELqOSCj cThgFyL8QFX9A== 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 v6 02/36] tracing: Add a comment about ftrace_regs definition Date: Fri, 12 Jan 2024 19:11:13 +0900 Message-Id: <170505427384.459169.12870691493043411135.stgit@devnote2> X-Mailer: git-send-email 2.34.1 In-Reply-To: <170505424954.459169.10630626365737237288.stgit@devnote2> References: <170505424954.459169.10630626365737237288.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) Acked-by: Mark Rutland --- 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; };