Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1403492lqp; Mon, 15 Apr 2024 05:50:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWeAkgUstZls9YWJkbJPFF+1GYnvycvc2CTiUsA56+roswpE0qWkjgbpgi0aM6gzBLnjMu/Gctk7o8Y8iecpGlsD+7WgxyAGdW2+k3ITA== X-Google-Smtp-Source: AGHT+IHXxCJsKssL/6/yEFBC/BTO8peUN0BGlpLo3CVCZiSPr6pL9yhDJH8fwRLiCsNvxyrSManv X-Received: by 2002:a17:90b:1e09:b0:2a7:30f6:1aa8 with SMTP id pg9-20020a17090b1e0900b002a730f61aa8mr5327613pjb.8.1713185423637; Mon, 15 Apr 2024 05:50:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713185423; cv=pass; d=google.com; s=arc-20160816; b=Aj9VboAXnaezi+XBSlQ/Y/XoZjy+7rMqYSAw/Hqe4uFZdITQRsInQ3fJaSDhineN5c Bw9R1YXD4zN6Guq+Cbu+sOrh39Ap0bt4WtGO7tyRy9HR/2T+vxcuHXOoG+6IniXZoDWA dDXadYwf0KxsS4fxQL1101CNEvFzKdf0Lpbby8OCo1pjE3JBnqdSRUP5P29/mwhvrE1E vUiMhB0UHs4N+PTRYqPmybMEh14p54+So8N+F+t795uu0zzquyDTzDKXm5f3peV739V4 eSK60FizyuI4GQFDH9AEJDTL2f2a3+cEhMglllcgJ0kNNZ6baD/bEH7h6uJ8Q4W4y3ef VZqw== 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:user-agent:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=EobjyiIxbkA9g4UOuTsjUiXg/OAavPowcfBe7yM03Ns=; fh=SIgps5XdV0XNwjZfT2uAI7g3mrspDldK9Qs8qQAfoa4=; b=Ov4V68oy4nb5UUmdpzQ9jFjCO7SHBl/uDbG8opwY2/ON1liZOQn8kwpTu45N+4nr/3 vv5MP8nSWTZxQvI7edGMQkmeYuJFrXUyZOTHxTMKrq8e1cWCIOrYTKRKZnrl86ujUSqN xP0PdBb4A9oTZ0fmKiu3UsonH0qhpr4LCaCPdnYnbJ/U0dTxIGBJEVir7RFky7FvyvjE D9Zs79HUbVp1JacHk99HBJDX/LsGkd/yFMGaCpIiI7tQSc6mwvGlPzdFMDBlfPJbFeoW fraMgOMItc3SRcmlVRsPgR4w+dNUYF8WQZjwHVDtHOXD1ArekQ2NQZjKYJVP2tnbX1D0 vgZw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="CzWpT/NQ"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-145101-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145101-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 g8-20020a17090a640800b002a266e11459si8071793pjj.117.2024.04.15.05.50.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 05:50:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-145101-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="CzWpT/NQ"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-145101-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-145101-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 45E28284058 for ; Mon, 15 Apr 2024 12:50:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1ED8E71754; Mon, 15 Apr 2024 12:49:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CzWpT/NQ" 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 3418074BF4; Mon, 15 Apr 2024 12:49:14 +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=1713185355; cv=none; b=jrfpn9UG1AI17rUQhNcGVOffFffx/DLsAKJUqtc5xRmCQ3D4qyTcRw2W5DCyUVJba7NhRiQI6cAngd/LkWOQCMR0jVng5uybm440zdXn3KvdwOXhZQnlbSMulJg5xhJSWiMI9fZgWga9joPc4IgV/1LMjPX5XTE+wJYTc7+b7wA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713185355; c=relaxed/simple; bh=fqD5QVAVsVbGxdWnTas/lt8WA9oyYAZWgwmYw1yMGyU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=kRXfEK3QzoHQ3NTsdscQEWc8X/fWbgIU12xBqyceAHm+MHErlOpXnFBggFyEnLr4ARFeOSJ7umZjCdrdBoVdQEneZBR+xMHn46kVb+V5VHnxVUggzIAAQT0Uy7+NdtCH+eFepWA7bLSZ2qCvvFS/6Vc84Oe6PCT5VdJfw2di0V4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CzWpT/NQ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19885C4AF11; Mon, 15 Apr 2024 12:49:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713185354; bh=fqD5QVAVsVbGxdWnTas/lt8WA9oyYAZWgwmYw1yMGyU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CzWpT/NQj0HpXXH26LJs4Mac7tWLzS4dNRE/U2AT9AHsTKugIRa1L0Nkl8e8GfSQa hr2RyrBgUI2pCosnJCH7GO/mFnxK4aXv4LBQu5aUUX2GM3D+nWMBqD6sGmoL8/uflV nJKTux5jK9pXdPe1/V748UtIUUNNygcPK3uFVC49IsrSnZW2FJToOfMR2a2a6E+HA/ UZavyDuQB0DJGJaFnKoZpsPUNaA2pH15AmXw5P7vtdc4HovZb83WCv8C/L7agrLzck gQQGvWiUHiHTRBVciqQrNCIJI9GK4o4JPayIl87IH4nSdDCK4fTra7xEvjlqIQodax R0AA/zkbANNAQ== 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 v9 01/36] tracing: Add a comment about ftrace_regs definition Date: Mon, 15 Apr 2024 21:49:10 +0900 Message-Id: <171318535003.254850.2125783941049872788.stgit@devnote2> X-Mailer: git-send-email 2.34.1 In-Reply-To: <171318533841.254850.15841395205784342850.stgit@devnote2> References: <171318533841.254850.15841395205784342850.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 v8: - Update that the saved registers depends on the context. 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 54d53f345d14..b81f1afa82a1 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; };