Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3062309rdh; Mon, 27 Nov 2023 05:53:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IFPL3yLFsqX+O+O2jgkhdQ/ccYh/3u3x0HdWdkhXOIPN3VMkZFhKwBPtiq+k/mlUFwuLbWd X-Received: by 2002:a05:6a00:3a0b:b0:6cb:bb92:1ce6 with SMTP id fj11-20020a056a003a0b00b006cbbb921ce6mr14236845pfb.18.1701093215987; Mon, 27 Nov 2023 05:53:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701093215; cv=none; d=google.com; s=arc-20160816; b=P5UYk7lvsYdzdYqzzXTb0S4KGpz9IJD/zl8xgd9g9pTRmTxjwmqN5eX0wBCFvC7b6e UtiiIw+m58pel+Qj9wXBvL+EdAHRslb7W50Ve59nn5dKk6r/xfB7ZZbWEZ+ZKuVDytFr DZRPnQYSxI4JTzu/M6wXAQnnCtKOBK3dGwM7Bz2pnswpFJ9AWAGr6iGZspPtRyAbKZQd eAcz120dP1fmq42KncvF84J0oETvf6faAtLStb1X+xg9dHV07L34vkGI6iZuHktXHEFR Hd+/BDKKWmX9y8rT7azhr92ZhDozooM4rUv7WdJSqCtkyJp90jMn5dt7Kncoo0ePDSQP e7Mg== 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=bXvvHNbLZQC+dlRUPKblFltTSa45ss1QcpW2wYr3LPPMJ0Ok6lshD5qY1BXiFp99RR d4GQfRAjcJUsWFMaZ0THPVFvlsdbgN9QY5dXRrQvrE2KKoZmUgF4NbAS9ktCLnFa7eN6 I92oUuLi5xpHpo7KwevPe2GsbXEeWUcRgNJ6+BlyUkiRL4g3aiJ8nMesWPFX9z49WB2W Ag0voCVmhDI2io5kloaccFPn4shANN+caTXXg38UJgZ8gjD8bZikCUGWTUA1pu4nHy69 8jlHNMagD2rpYdXOGC23lIrozeQEgrJSLMmjQ+tB1DaPFRODfkwd0qi8WLApSZaymOZo QX6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uIZrQVq+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id o6-20020a056a0015c600b006c33a1bdf92si10179128pfu.307.2023.11.27.05.53.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 05:53:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uIZrQVq+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id DABD48093F41; Mon, 27 Nov 2023 05:53:31 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233276AbjK0NxK (ORCPT + 99 others); Mon, 27 Nov 2023 08:53:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233286AbjK0NxH (ORCPT ); Mon, 27 Nov 2023 08:53:07 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF3A3D56 for ; Mon, 27 Nov 2023 05:53:12 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69C9DC433C7; Mon, 27 Nov 2023 13:53:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701093192; bh=HAB8fcsYhkztOqkqxJN8HQ+Use/Y/czjonQXwZoidcQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uIZrQVq+lXnVL0iTGzyTMigq0VYprpHHea7QEp0DUwqMa/mw57jtjUHOuti+awSJI Je9LXpbgbtOLePDnB/Qz/KxfFX0yg5V4HRpbz28in5M48FLLl9mdf1LW4JVfeXuIwS WN6aWPwufQbpYnFM+zX77ASxb2IhAm9VHFafxmf7FUTMeZPiQQETk7gTUmELI16Gfb 6mFoEcALesSrJHfNdtncl1RuVu8+Eto6THI5tIWy+ss28SCcMHqCy48yIg2PPoKYUR sNGBfgYDxoGWi3j9rPKiz88S5awEMyujyg4PCrRmq8UkIbad/nrr/ThSG+BXKYUMFG QE+Aeg8ZUhFKA== 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 v3 01/33] tracing: Add a comment about ftrace_regs definition Date: Mon, 27 Nov 2023 22:53:05 +0900 Message-Id: <170109318538.343914.8426711105240287815.stgit@devnote2> X-Mailer: git-send-email 2.34.1 In-Reply-To: <170109317214.343914.4784420430328654397.stgit@devnote2> References: <170109317214.343914.4784420430328654397.stgit@devnote2> User-Agent: StGit/0.19 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit 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 groat.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 (groat.vger.email [0.0.0.0]); Mon, 27 Nov 2023 05:53:32 -0800 (PST) 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; };