Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp424971lqd; Wed, 24 Apr 2024 06:42:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXnHOd/vNlDDDl83gqGQH1l0v0a5l5QcBPX7kPtGxf0z7bjiZQ8DYbQyufWN+RNBfrF4JqTER9EWtFOPSAnaYWccPa9i9hDy5UPoKLa/g== X-Google-Smtp-Source: AGHT+IEGECijrYKojuegJ0QUIhqXXim5t+Jt8XdLY0BNx2ggqiNIIwdw/hRNDUP3wI9iD6tAfuSi X-Received: by 2002:a17:903:1c7:b0:1e5:c0ee:a7f9 with SMTP id e7-20020a17090301c700b001e5c0eea7f9mr3190426plh.14.1713966125259; Wed, 24 Apr 2024 06:42:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713966125; cv=pass; d=google.com; s=arc-20160816; b=WA/WxOiMboaeOleUzr3/b/1YCuudCcg69/wGyjFVr+FVT4RNAufL9ry4URJyhNIaSV ELyB2qXmfTGwWAbEoYuYIMrhebKjJGVkywLXqreFNvQu2fZVyLVTJppsIe1AFWhSrEJd ue/zJjD9kfo+gcC4jbwMrnfldqzA0/2icgLEUHwZiRE2BdIWBf2nPBxZ37WmS7bDN84i w1den6yK39kUwacvoT/sxr2nNNQGLXAuZCRBNNmWTArvtqwOI1sZwN+XIkCf3JouzPvH tzpaQCHQTf3HOxUuq2PCtetAlpAuPb0LMy9oTu8gj32I1YBnao8FsUtmZSS6WQBSY4NY F41Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=8VvHJ58Y+Q3UWAzWsSTTjuIwD8U8vgOkrH/9YIF6f+M=; fh=fR3aUOqhqbBzk4SGqYbVlenipWfIReRRREUSWoU0Bck=; b=I4D7QdzX7E5877hMghh2FsO/bc2LEDEJodry2T7gS6OePE4mhnG/QU/bWIM4IYNmAg bpr3F4d9WnL5saBHUnHDy93DlDH466WHhoS1VnspzhsWZBdO6DddHifpJvId8a6TVX6v CTjVSB06J+p58o4I8gdfseF/ZorA9Kh7s6nnA0/MezfX7wBR2qZEiekxel8ipqvptHM7 EwXnHCCZDRAR4XSyYA+I5qJ8yOKEov17Csq4WlhD0PYISjDqlhARWtyoWEE0UBTpwYSm LQvUIQJ6JHDShdkNNYNBNPLIsKX+maNfIb8fjEQ6l56eLrRo9AwxVTY0TXcTfSF7xsg3 1thg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=lHgApBrG; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-156946-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156946-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id mc15-20020a1709032b0f00b001e5893078adsi11892585plb.35.2024.04.24.06.42.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 06:42:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-156946-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=lHgApBrG; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-156946-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156946-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 5F8A9B2878F for ; Wed, 24 Apr 2024 13:20:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7601B15CD51; Wed, 24 Apr 2024 13:19:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="lHgApBrG" Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 41FBD15B562 for ; Wed, 24 Apr 2024 13:19:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713964788; cv=none; b=E/8pso4AjGhP3vFN3i8tWn5DNnuZVLnNAJ0Vw1COhGw0SLLWkkQ7sNzGaYDWsuPzE98cvVWuCHffZzdh8JKctYppgtqDn0V3OAXtYEs6W8pdA+I/ubF6UkkgwvtPQzaqJUGSHKVl7xzCCZP/179zOh0GGK3iKia5ZMDSGd9ylEI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713964788; c=relaxed/simple; bh=/GQoX1gc0yl6e/Pz8zk6L9EPOwroU4wExy1cX78SnUI=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=QyRKp3eRzczhXuUbfvbc8ZUfBP/c0zzD29oycPBqBvZe/RbpQ1HcZPj//15sM4nlR7a9ksLmyCr3uCQc6C3657yjUiDo/2bL9HrIYUYL/ZxwtnDePTbcnUXgk36jb9FLBYRToAZXaYEkn9HckliH3iuRYqZ8ipOdvWrlcPb06ZQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=lHgApBrG; arc=none smtp.client-ip=209.85.215.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pg1-f181.google.com with SMTP id 41be03b00d2f7-6082fd3e96eso120716a12.1 for ; Wed, 24 Apr 2024 06:19:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1713964786; x=1714569586; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=8VvHJ58Y+Q3UWAzWsSTTjuIwD8U8vgOkrH/9YIF6f+M=; b=lHgApBrG4E6j0tbQuXywkr1MB58N2Bx9nktuAzORtFE377i1FUVwrKNdg871OpwQvK tmBuLsubIW6D+NgNoy9IcN4PgzuKaN/7pYR36T1Bwmxfh7+2yPQn7npHwO+e/kPs2K63 WmHL37zDXk4UHA6ztqWrVCiy4aFkqIrmHZVUI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713964786; x=1714569586; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8VvHJ58Y+Q3UWAzWsSTTjuIwD8U8vgOkrH/9YIF6f+M=; b=qmDNkCdB3B84gDZ5bRA9DiIFPq3IxiCahJq7YTGyaeUYjOxhUr/ss2eMSw9TyYqR8E j0IglX9FuCdHgHxVlDwylLNl/aKiblO19OsEXcEenxL8TUlaTUOq467eoSlpw4duqKO4 mnuoQtz31eJsIVrYeJZrx4Eaq5a4lAiVYt9Kt5TJfvS7/m+ViTYhLBhtVqwjlki2aCKX +Jc9MBReTZMTNueZWiQb/Y57qCkqA4h1v+ehqQbwhTxc2KprH1mWjPZczjo2H1noNILv q6XXfQQPHzOz5XJ2NSAYlHrrp4OLLa2H+7DNIjnmEOxGvU+38+DLmURqarEbFaCrnwU9 hd2g== X-Forwarded-Encrypted: i=1; AJvYcCWeA4+uPdZ74YYpjK+iKWDEoY62/WRRG4fwCtgHtkgKFrmGJ8Yt7taeGu/gdUVSl6ior61oP0cYyBQxLla9ofJwMooZUFme42B5ZMPL X-Gm-Message-State: AOJu0YxfLLlSqjoJl9wcjtvZTz9kPSShzCCeIpfEfh0eGE39cE7/2wYY GX5yAfiiComq8rdg3EMxAWT9o7D+hzorLh4JyUGmGJm1W4eyE7zbAG/HYrBR82B9GIJWx+oBjs8 CuXpz+jY0iRCcC3emVGbY3V81ROzHLVdXQnaF X-Received: by 2002:a17:90b:4f41:b0:2a5:275c:ed with SMTP id pj1-20020a17090b4f4100b002a5275c00edmr2474867pjb.23.1713964786600; Wed, 24 Apr 2024 06:19:46 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <171318533841.254850.15841395205784342850.stgit@devnote2> <171318535003.254850.2125783941049872788.stgit@devnote2> In-Reply-To: From: Florent Revest Date: Wed, 24 Apr 2024 15:19:24 +0200 Message-ID: Subject: Re: [PATCH v9 01/36] tracing: Add a comment about ftrace_regs definition To: "Masami Hiramatsu (Google)" Cc: Alexei Starovoitov , Steven Rostedt , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Apr 24, 2024 at 2:23=E2=80=AFPM Florent Revest wrote: > > On Mon, Apr 15, 2024 at 2:49=E2=80=AFPM 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 > > --- > > 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 sta= ck > > + * 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) > > Ooc, have we ever considered skipping argument registers that are not > return value registers in the exit code paths ? For example, why would > we want to save rdi in a return handler ? > > But if we want to avoid the situation of having "sparse ftrace_regs" > all over again, we'd have to split ftrace_regs into a ftrace_args_regs > and a ftrace_ret_regs which would make this refactoring even more > painful, just to skip a few instructions. :| > > I don't necessarily think it's worth it, I just wanted to make sure > this was considered. Ah, well, I just reached patch 22 and noticed that there you add add: + * Basically, ftrace_regs stores the registers related to the context. + * On function entry, registers for function parameters and hooking the + * function call are stored, and on function exit, registers for function + * return value and frame pointers are stored. So ftrace_regs can be a a sparse structure then. That's fair enough with me= ! ;)