From patchwork Wed Nov 8 14:24:32 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: 163035 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:aa0b:0:b0:403:3b70:6f57 with SMTP id k11csp947674vqo; Wed, 8 Nov 2023 06:24:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IFyeYtMPzwrTuGrkDWJsCidiKeoCHZPTtvzjCrtb2ixC0sjc9vSSgSRpQSybWw06zSnOzH7 X-Received: by 2002:a17:90b:3b4c:b0:280:23e1:e4dd with SMTP id ot12-20020a17090b3b4c00b0028023e1e4ddmr3080056pjb.17.1699453485277; Wed, 08 Nov 2023 06:24:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699453485; cv=none; d=google.com; s=arc-20160816; b=JnVxh0UP0BHOvlVlWyd+1TNSuXxTi/SfOwYgtOGGuyqV5gKM9nVQMrp3bhLoK71I14 nXghDVlDSp2vDeqVx4LKYIYsiKfnc3mu7u5xBushy8JeQJ8gXsPmBj4F4d0kngVSoaOg 3/KEQhr8HnRSr37clCJQdCjYAA3b3hft7Ya1D9kRHBdcDazKeEaIJQK8kl7pJMq7DC3b 8PdPDoJZjJYX5Z6BAcaEkSucN3XSMku773jIa56dYxR+/KPCCUQLvj9LbWklbfn+M9/g rxPfIwaZFz50Lfd/cC7HNaQuvgV9y8xyWOYXgSF0FY6k78TJvuxXEC0pfRX3mKpmK/oT VZaA== 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=a8BsRNUycvUtC2SNXWVqvezlz4N29hAwJgvgEofM1A4=; fh=SIgps5XdV0XNwjZfT2uAI7g3mrspDldK9Qs8qQAfoa4=; b=z87elJ9WCTJFey50aqEwBXSb9Xmtw81dzcOKQUCxTEj3ighYG00neQrwfWm0Wrg9DW 6JjZy6WQl5rjKkgC1WF1qy29xpQoWzG11UYRHLcIXSRGxb5POoSiaSZQxh6Kvu8u8fMx OwyLntmO8FeLv9zSI7N98GD9f0FPgVjhYOtWTl2wu01XzcHJOKhkxLNl3G+fXBRoVH0a vy7pM2dUH3tybn5Ya6wiR4uWWkoBn4vsfJExfpOVHyYDAUSYPjoCeKM49Csul83CQPod PuRlDujbFWaF+79fwP3hiK1oyGQZwDxPSjdGQJM4iQsghwcRZR9q56GQWjhLJr4ye9k+ AJOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=F2uVbebR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id o15-20020a17090ab88f00b00280203592dbsi2284369pjr.90.2023.11.08.06.24.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Nov 2023 06:24:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=F2uVbebR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 8C8B2832AF58; Wed, 8 Nov 2023 06:24:44 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232498AbjKHOYl (ORCPT + 32 others); Wed, 8 Nov 2023 09:24:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232538AbjKHOYk (ORCPT ); Wed, 8 Nov 2023 09:24:40 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3111D1FC2 for ; Wed, 8 Nov 2023 06:24:38 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37F78C433C9; Wed, 8 Nov 2023 14:24:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1699453477; bh=n4E0j8qzABvMFqw3IzKBJQSoLeU/goeaPocNkQ11XcM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F2uVbebRxB1ylSqQ+t2SN5QROmqMPIEbhnk6ue4Qptu9V2AUiYTKdQzHkbX62FwaO u2KyezDq8u4weG+TMuchcAPQh4uxsEjZRCpyq6K/T0QFMONZbq8kiUPhzKCRLwWpiJ dz35a+3226RvbHYlgfR2j6DIEpTtQVBFZ6lYJ3PIup9iWhTMUtfGrFnort9P92eWKI 0QcnS8msS4bdMDUYzVSHyknYYurSNMZ2iCuCZIlX0nEvgCbYI/IfMeTZrdCEj2N6pH sMXig9A9lUqHaREe3hkU3okeoMS+cVg0unevvOSjiZ+2qibn+n3yeAqclnDPdDiDOD srXFhtl+Ifq7Q== 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: [RFC PATCH v2 01/31] tracing: Add a comment about ftrace_regs definition Date: Wed, 8 Nov 2023 23:24:32 +0900 Message-Id: <169945347160.55307.1488323435914144870.stgit@devnote2> X-Mailer: git-send-email 2.34.1 In-Reply-To: <169945345785.55307.5003201137843449313.stgit@devnote2> References: <169945345785.55307.5003201137843449313.stgit@devnote2> User-Agent: StGit/0.19 MIME-Version: 1.0 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 (snail.vger.email [0.0.0.0]); Wed, 08 Nov 2023 06:24:44 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782006137631308329 X-GMAIL-MSGID: 1782006137631308329 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 v2: - newly added. --- include/linux/ftrace.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index e8921871ef9a..b174af91d8be 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h @@ -118,6 +118,31 @@ 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 return including the frame pointer + * (the frame pointer is architecture/config dependent) + * (e.g. 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. + * On the function exit, onlu 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; };