From nobody Thu Nov 28 12:46:57 2024 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 577CF1CDFB8 for ; Tue, 1 Oct 2024 21:42:17 +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=1727818937; cv=none; b=gZE/pWd4kNwfIsnQTe8v7/zfcwCK1YpRWbTf1Zvg0JQ18wo+w4KiaUS6gEN7Bg24n6rDcwH5N1Kl06IPpPtMRqdgsY7m/09nsf4881FPJxvptVxyzELIvmBK+ZNivvkggtAj+ziAxM6VfjmLG/ZMrcgTcyTDAkh47saViOkHwwU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727818937; c=relaxed/simple; bh=/lpA0CNPze4Ctr/3p3uEcP3TvtHCUn9gAzEx06/NOPk=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=kU/YTrswpX3YrBgMa1tHjnQSrD6CNGps3Nr0Q5vJsJZbJ3kw1scg7m66t2dlqjjPC+QqVVppS1kuN81H2bLHK8GFkk9MYpb6uwaedyqQS3Z3BHFWd1VaVy/zpogm5kYoSKOgRGvM9Cao3DB568ZqxP2WEOantmLbnbkkWgEFuLg= 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 E9E3DC4CED2; Tue, 1 Oct 2024 21:42:16 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.98) (envelope-from ) id 1svkeB-00000004ct6-10oa; Tue, 01 Oct 2024 17:43:07 -0400 Message-ID: <20241001214307.105844677@goodmis.org> User-Agent: quilt/0.68 Date: Tue, 01 Oct 2024 17:42:43 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton Subject: [for-next][PATCH 2/5] tracing: Add a comment about ftrace_regs definition References: <20241001214241.688116616@goodmis.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Signed-off-by: Steven Rostedt (Google) --- include/linux/ftrace.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index fd5e84d0ec47..42106b3de396 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h @@ -117,6 +117,32 @@ extern int ftrace_enabled; =20 #ifndef CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS =20 +/** + * 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; }; --=20 2.45.2