Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp270204rdb; Fri, 5 Jan 2024 09:12:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IFXnZp9/9jKg1L2XO+zeMPZzjJFPcw6CVx/H7uE6uknaZjRrvynRw0bMtUcU7uHRFgyACqQ X-Received: by 2002:a17:906:4090:b0:a28:fd70:1a1d with SMTP id u16-20020a170906409000b00a28fd701a1dmr995164ejj.78.1704474749168; Fri, 05 Jan 2024 09:12:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704474749; cv=none; d=google.com; s=arc-20160816; b=ngu+CgAmoUIRW0xyKbyO8d2YVPN2XDmj9YTNkXBbXFmsR7JO9/Ra+7MFLdzY6YHxM+ +LO7c8XMhORU6XKFdW00qJvV9/ewQmukTmwLyNqcG7/5YcIIveFdbu9e4N3GWUby/W2G qs+sRD7dlKAKZrFx5Qr5C4H8wPYMA3j69N5YZNT1v66IvXZLisXoI80p7DJsa39/WP33 2dGisxuCD5XAYVZpCzbN3rxTwZiSCiqoEJAZnbYNDgYOcRQvQFXgfIwTUQJ3/EESPRtn MSIBayVyyx0qAamIZ/1HyaBSWTJpl7XumVfrw8n9Im6oLEYJKASyi78qZ6d2YTeZ9Bxr yAww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=Thd3XBnFY2vVhnUEGFNkNCb3tLAGxN1qS3qME6js85I=; fh=ARklDNOudkay1dyEW8/5oP92fON22SNqpW6KgMhE3BU=; b=WYxZJ91S0XmFcVbB00to5zuiNkshYm7WMHpGIn7HpFjzCJELWeBEccIoFU2Grklmtg Z3b/Rqzd/baLL2jg8zIFiKSRtcq/FFhJ+zCrxLOklzyqZ3eZfzBbuu/Nmpx1KEj+NXVl hOlTg/sat6Ib2VyF+W7M1PCe5Yfnj1oHjUnCEoOebiAUlxmHP6we6eL2nHPtcdPGf/P6 P/D4POE/5/+uyRePCp+in6x8AJyljpEhyM0WiXSjrbiprrcqGmvcQkEZ66DQnIZclVYq yIgvJ+ZuQLR5OXs7QJcPZ8QgpqtqPuSaTUUNShpSjrD3HN083IQSnXSxc+Uvx4coDa1t gqmw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-18098-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18098-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id o22-20020a17090637d600b00a1c7b1115d8si714092ejc.263.2024.01.05.09.12.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 09:12:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-18098-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-18098-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18098-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id E3BE11F23DFB for ; Fri, 5 Jan 2024 17:12:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 87AF13219A; Fri, 5 Jan 2024 17:12:18 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 81D0331A8A; Fri, 5 Jan 2024 17:12:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5763EC15; Fri, 5 Jan 2024 09:13:02 -0800 (PST) Received: from FVFF77S0Q05N (unknown [10.57.85.228]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 58DD13F64C; Fri, 5 Jan 2024 09:12:13 -0800 (PST) Date: Fri, 5 Jan 2024 17:12:10 +0000 From: Mark Rutland To: "Masami Hiramatsu (Google)" Cc: Alexei Starovoitov , Steven Rostedt , Florent Revest , 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 , Peter Zijlstra , Thomas Gleixner , Guo Ren Subject: Re: [PATCH v5 01/34] tracing: Add a comment about ftrace_regs definition Message-ID: References: <170290509018.220107.1347127510564358608.stgit@devnote2> <170290510399.220107.17645951919819438730.stgit@devnote2> 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=us-ascii Content-Disposition: inline In-Reply-To: <170290510399.220107.17645951919819438730.stgit@devnote2> On Mon, Dec 18, 2023 at 10:11:44PM +0900, Masami Hiramatsu (Google) wrote: > 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 Mark. > --- > 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; > }; >