From patchwork Mon Nov 27 13:53:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 170142 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp3127086vqx; Mon, 27 Nov 2023 05:53:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IHDIHhBCJAyPIa7eKfT56aWp8yLzRU8EVWUVfnkimDDJV721o5tJRWcCUVPdiaVXT2EqNJq X-Received: by 2002:a17:902:db06:b0:1cf:c376:6d7f with SMTP id m6-20020a170902db0600b001cfc3766d7fmr7413175plx.42.1701093211438; Mon, 27 Nov 2023 05:53:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701093211; cv=none; d=google.com; s=arc-20160816; b=fL+dEDgDuvBN7D5KENyG9k4wBf5PVp0tvlpDj4OG4RYzsRWsbgpwoOkaI0/ZYYheN3 BpLYCr5orYEA34rQsL6KcSDEWwUVcRR8owlnVzlvdT+RsqBQEZGpdzxq8hvyLHwpt+dS ETX6s5Tv76NJ+FUjbgeWREgh+wnUYpFFetjtS7luQU1V6PXq5NiE73mxezILR2fggT+D 5ILTTjhRHVxVCwexuPjTuvLFXYvZvre+Lad96Sjay+UKGVm7/qhW5fMBC+Qx0ftaKXP2 RdXmyxdN3RPe0PZgXARRWhLeD/yN+WMx4C9hbCuXR1BT35CnZ9J1eInaJF1FpcxIZMB8 wTaQ== 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 2620:137:e000::3:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id j18-20020a170902da9200b001cf9d88a0desi8793298plx.242.2023.11.27.05.53.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 05:53:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; 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 2620:137:e000::3:5 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 244A18093F41; Mon, 27 Nov 2023 05:53:28 -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 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:28 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783725515040974212 X-GMAIL-MSGID: 1783725515040974212 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; };