From nobody Fri Dec 19 11:44:56 2025 Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) (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 A70A5220F3A for ; Sun, 7 Dec 2025 14:27:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765117677; cv=none; b=MI6YR9Tt4vLWUlf6dgxiCimpSoV3q0cmKqvXwoslwxdzy3UtkmNKI4q4nlFUhLFmrnK/ORFjXbacWvnnBqu00JGqRvVwWA5+PfiqnkkZbt0iJlqiTkQJqQGvlNl+slGE/0PUod4+NQXrqlwDUwxkquMfnZCITXwZHgJWyhJOXpE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765117677; c=relaxed/simple; bh=30o7EXsT+3UE9XemGnLUmRBLG1W6L02/uoH/F43nEZc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ni0OYliHc/Ak1QMIRvUa5DPe2kvit3zonBPCh43YHBL7bCfTOzclJ3Rn3ZQsbdul1DJZxnbqqlzYXKZAKAyBA+8GIJWCfJlIUJIaZ9otTZJjgbsvhGp+Ezk1MZMJiJ/hNiEyWIeko0Xt7m7y/GOpFxw4RlaYMpuY1H/oy23tem4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=f/f+c+Xu; arc=none smtp.client-ip=209.85.216.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="f/f+c+Xu" Received: by mail-pj1-f46.google.com with SMTP id 98e67ed59e1d1-349ff18445aso99987a91.3 for ; Sun, 07 Dec 2025 06:27:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765117671; x=1765722471; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lZnyUry+1w8xao5+MHyxhYILKDa1nn4nE9blPajp6gw=; b=f/f+c+XuZqgkMEXPAy1kmWFMbvXsQ4xErsuAjK5f43O/Eh6s72iB3qhtqE+p2i1lgK TY5Bd681ke2tB2GYFFQmKTHlxjumkGsS5qxj5irM98b128seCDdKKy4fvbIx4au6NGtU YozjzPykK209V1yW5H7WQKT6UJVZjGF1T08RuoGnavrTU1zGptT6GKGcWgt5ciOv6ehK +OjKssIuE9HUH6YgVIPfUyE4T/uUKgxXd44pO65EwvsgHZz4yPnuQy+GNF8ikctztMGE nxd5BvHwka0JzUijOQQUIEq050A4d9ZBoM7lN6aZoBzh7FDvcGigIJAFEoHIiXLKVzEC IB8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765117671; x=1765722471; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=lZnyUry+1w8xao5+MHyxhYILKDa1nn4nE9blPajp6gw=; b=RPp0OKfmBhR6M1nCnfBofBV5xsN18npMsDbvzWlON73AIh0ouZYM2yISm9oUlp51bU kMrXzwSmsxzVH79BlyjGVkzp+vpxK9yzzw/5UFSSAJL58ZP3dHfittLf/neZ/eQyVf+c ML7HqS5d0bOtPOSjR+MYkaUTLY+oq5mdrtgXZIblYooMlm0uRCtJ2tOkVaJ0pUIbz2ZE 7JQ0gihfg5u1TeQo0YPSufhkOtV9QKVB92vVqNKDW8C0IviF2h3KLHqFgBsNh1QXWQuL /1MxFpVCJcYCeznjA1cefrok3lDVkGFIUalxvz9bKxE3sbWC2WdfRGTn1uD8ptKFLJev akmQ== X-Forwarded-Encrypted: i=1; AJvYcCUd3SlKGmZFYio8sp+y3ZZhDyYl1UGCfYTF3FUGbbkUY/WsDQ6wfztpt+WkiPyS9WJR1ERxz2Qz/f5cBY0=@vger.kernel.org X-Gm-Message-State: AOJu0Yy1ufEoYhKVrO+i8hsBQ11Glzar+V3qQoY74/vgr/FN3BMCqQLZ MqkNKb4DHCznXzFsgw9CDMC+v7nKssnNexE2HS32/ZBgBijVwCYfgzlH X-Gm-Gg: ASbGnctl5ZpdFrEYlIkSkrmT9R04FJD8Ag22/a/yHCNZCvNCAKBKinIYOXTbTpMjB1L PDCFpE5fcvK1jyhQm+4GYEqEkd4esQm7X2eNHve3PmaZmenp+jHOdEjcf7W2UDn6iOj/jmOYy5K 7nOz2rk207TusdG5buk0UFacU1z89l3U0+uUSlN52LN4o530QQaZGbSgLMAME75w7XZ3maeBBFc b6rQE94esPGEppuadiN3ARnE6VdGgHkAOpQlkHsEpkjU54Wic0NS0OtIlRci1bTq1SrukRHTq7R pWVzPjfxEWq/A5UIb3WhdFaGvlmWCS+XlqcNyFLG94q7qyxzVmaX+1mKDXpGI61AH56Cv+4i7lH 8Q+ndn013wP8GxM755WFvkdiRESQiS/e5ihWhUOjXpiGY2lTkGqFYVBEloENwUXKaChg04n6mk8 vCbQyXzjfE+YxLtT+alWmBe71adR8= X-Google-Smtp-Source: AGHT+IH9mYL+8pQfNgZ4r8ZFqW+QSWz3AKdRwbEmCblz9taenxcf6eaYppGqEuojMUEJzBiNafSuyw== X-Received: by 2002:a17:90b:5546:b0:343:eb40:8e01 with SMTP id 98e67ed59e1d1-349a26223e5mr3565025a91.27.1765117670867; Sun, 07 Dec 2025 06:27:50 -0800 (PST) Received: from pengdl-pc.mioffice.cn ([43.224.245.249]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-bf686c32deesm9514792a12.13.2025.12.07.06.27.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Dec 2025 06:27:49 -0800 (PST) From: Donglin Peng To: rostedt@goodmis.org Cc: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, pengdonglin , Masami Hiramatsu , Xiaoqin Zhang Subject: [PATCH v1 1/2] fgraph: use BTF to trim and filter return values Date: Sun, 7 Dec 2025 22:27:41 +0800 Message-Id: <20251207142742.229924-2-dolinux.peng@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251207142742.229924-1-dolinux.peng@gmail.com> References: <20251207142742.229924-1-dolinux.peng@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: pengdonglin The current funcgraph-retval implementation has two limitations: 1. It prints a return value even when the traced function returns void. 2. When the return type is narrower than a register, the printed value may be incorrect because high bits can contain undefined data. Both issues are addressed by using BTF to obtain the precise return type of each traced function: - Return values are now printed only for functions whose return type is not void. - The value is truncated to the actual width of the return type, ensuring correct representation. These changes make the funcgraph-retval output more accurate and remove noise from void functions. Cc: Steven Rostedt (Google) Cc: Masami Hiramatsu Cc: Xiaoqin Zhang Signed-off-by: pengdonglin --- kernel/trace/trace_functions_graph.c | 64 +++++++++++++++++++++++----- 1 file changed, 54 insertions(+), 10 deletions(-) diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_func= tions_graph.c index 17c75cf2348e..9e63665c81e2 100644 --- a/kernel/trace/trace_functions_graph.c +++ b/kernel/trace/trace_functions_graph.c @@ -15,6 +15,7 @@ =20 #include "trace.h" #include "trace_output.h" +#include "trace_btf.h" =20 /* When set, irq functions might be ignored */ static int ftrace_graph_skip_irqs; @@ -865,6 +866,46 @@ static void print_graph_retaddr(struct trace_seq *s, s= truct fgraph_retaddr_ent_e =20 #if defined(CONFIG_FUNCTION_GRAPH_RETVAL) || defined(CONFIG_FUNCTION_GRAPH= _RETADDR) =20 +static void trim_retval(unsigned long func, unsigned long *retval, bool *p= rint_retval) +{ + const struct btf_type *t; + char name[KSYM_NAME_LEN]; + struct btf *btf; + u32 v, msb; + + if (!IS_ENABLED(CONFIG_DEBUG_INFO_BTF)) + return; + + if (lookup_symbol_name(func, name)) + return; + + t =3D btf_find_func_proto(name, &btf); + if (IS_ERR_OR_NULL(t)) + return; + + t =3D btf_type_skip_modifiers(btf, t->type, NULL); + switch (t ? BTF_INFO_KIND(t->info) : BTF_KIND_UNKN) { + case BTF_KIND_UNKN: + *print_retval =3D false; + break; + case BTF_KIND_ENUM: + case BTF_KIND_ENUM64: + msb =3D BITS_PER_BYTE * t->size - 1; + *retval &=3D GENMASK(msb, 0); + break; + case BTF_KIND_INT: + v =3D *(u32 *)(t + 1); + if (BTF_INT_ENCODING(v) =3D=3D BTF_INT_BOOL) + msb =3D 0; + else + msb =3D BTF_INT_BITS(v) - 1; + *retval &=3D GENMASK(msb, 0); + break; + default: + break; + } +} + static void print_graph_retval(struct trace_seq *s, struct ftrace_graph_en= t_entry *entry, struct ftrace_graph_ret *graph_ret, void *func, u32 opt_flags, u32 trace_flags, int args_size) @@ -884,17 +925,20 @@ static void print_graph_retval(struct trace_seq *s, s= truct ftrace_graph_ent_entr print_retaddr =3D !!(opt_flags & TRACE_GRAPH_PRINT_RETADDR); #endif =20 - if (print_retval && retval && !hex_format) { - /* Check if the return value matches the negative format */ - if (IS_ENABLED(CONFIG_64BIT) && (retval & BIT(31)) && - (((u64)retval) >> 32) =3D=3D 0) { - err_code =3D sign_extend64(retval, 31); - } else { - err_code =3D retval; + if (print_retval) { + trim_retval((unsigned long)func, &retval, &print_retval); + if (print_retval && retval && !hex_format) { + /* Check if the return value matches the negative format */ + if (IS_ENABLED(CONFIG_64BIT) && (retval & BIT(31)) && + (((u64)retval) >> 32) =3D=3D 0) { + err_code =3D sign_extend64(retval, 31); + } else { + err_code =3D retval; + } + + if (!IS_ERR_VALUE(err_code)) + err_code =3D 0; } - - if (!IS_ERR_VALUE(err_code)) - err_code =3D 0; } =20 if (entry) { --=20 2.34.1 From nobody Fri Dec 19 11:44:56 2025 Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) (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 AEFC32E2DFB for ; Sun, 7 Dec 2025 14:27:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765117677; cv=none; b=Rktzea+P++DFTlWuuXAbIYr32RNbVJZq8vbznTzNGBjuQF5O+AtHazWUdjwGMSAJwrpcDPDDJexiZQwW4izkbCIPSyIIyw6ZmgNqBd7HZtcvRrk/HymN65/sInnQ8ptPta28VoAl5tdyooDjUwotREueh60VskIwjzTVOijRcEY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765117677; c=relaxed/simple; bh=Kwz/i/ToDupsWxXvYUeC2N41dqM/je07XCbIeJOAi3k=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BU0oXf3f90GDZlehMba+wUfS+SsSBvwD0O2AcHD5f3oI9JW42/MUU3gM4gKmQwpOhaS+WVMgYwFMGhoLBsv0l8162S1ighgqgi9sUYxeab00E/Syw/YKsfl0FKGHr8MHiY8QSDBLwf2uRqCgLROEPx2MqiBxPVPIIHJ6Yc9HjrM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=SXaGq34C; arc=none smtp.client-ip=209.85.210.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SXaGq34C" Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-7aab061e7cbso4382397b3a.1 for ; Sun, 07 Dec 2025 06:27:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765117674; x=1765722474; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Mim4L7D6RiJD0Xfk3ctgRLF/8EuUIkjvDV4bArvMP3Q=; b=SXaGq34CXlpeoNBDzbUGPiHuL3CU04HqnpfziHqQ/QjOcq7/gvHhefaZl3ZDVI7Epj tXDs2cqvmjv3wKSLum04JL0DJIIaVX9GGBtFrACstU0Xi3q/WsoYGGw8dCwfjhacePJt IqvJGleKv+1e4l5BU+wpyx1xgE/KU41BvlSqWmTetvgmw8vtcty4qSWjejJ0cRtNA7np W02iVs3p1ZNPKzMXOVw94rqrCyy/5DWWtHgO8Apwvw1CW/ztsPxWS+IItl0L7sM0NSJf AIMWKlRMlirZrOD/S3+HSL2VztYH3S8KIoEYLq7aHgID9KEM+JYzY50R6fxNE2Tv+Lto sjAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765117674; x=1765722474; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Mim4L7D6RiJD0Xfk3ctgRLF/8EuUIkjvDV4bArvMP3Q=; b=Olh7T4wcV345ecYJNqNTzOyeZQnwWcMw31Xa3bF/bE91b/XsVIQ7GJIuo1TEHadhNE bEgz1G0GoqdvME2914UoU0FeDKTwSRCznsvaNYWVTugRCqM/ne+LkZyRSTtT6+5EIwmS zfdy0M2AXxVOh514uVP4xLH1jnK7cI9SLauoaP9I9SUbTNfPPuwTTXMvZ2TeT3J6F7ZB HVgUnxmuG9FFSuUJdejHPL/vCYQtTxLPqBU8EeR3sJMZYS+4E1qZGsFyU+q8VLZslp4J 7OGtSpj+pCVfjCvgwhyiNDQwEMro5IQ8nNaJ7Wy0Ma4sTpLBsJBbtUfmBdu7ZGeOeBGK 39dw== X-Forwarded-Encrypted: i=1; AJvYcCVPrP3Eiol24LZOAvJLmQT+dqqf2NPT/qE6JXIdJQHPzCLqNt8Y1Ek2jp6ex5oKKiQXayZ363DHITyEAz0=@vger.kernel.org X-Gm-Message-State: AOJu0YxieZ3guuByuTETSVAD9/QCzt2FtT1OYC83MRwDAmN/QLTyJzoO AINcWG/pYXZasmEs4fkW5xkIZ7Y6s5feP7xPRUhRcWSllS9dqK7VM/gb X-Gm-Gg: ASbGnctBRcgfQhJSIIz7/6QI73e5lZdU15x2Dad5FeACB+zkg0ZKYD7vWg+v7gei3Yl 5SfpHcnLhi7JYSt9f09YuoqQz6omu7UP0pvo0cZdrFw/zFoGmzKpyRUfWI3ySKjtu8jSoq/w4gl moI8eRf/lcDcSjDQ4oaECOo5r5kkH5v5GLGmM6ZSBEOqTjQJ9e3mGk/7EZBpk8CtxtluCFI7JlI NGcQWk6FKRoz5lrymYA2vd90TD+hwklPbiYSUH+xoslPg/Vfw2VbisIkUpA2R1FDBhinBb0m4k4 /yfNqK/nZ0rl/SHvUP71qXyq01uLTUxS1CecUXqnNShE8PiBVMH78eQ8yYg7MWF8Gg5UENlhb7Q gUM0bLpuHHRdSM/phIiWBGtVoPoHCs8W+hczSQWxE+XBOMLJRYVvq0TgRP2tDPzppXlMO87JoIP yaiU74dQwhCd0/YwH5c0cG1kS8GMU= X-Google-Smtp-Source: AGHT+IEVUhB8KEX4xXFxWmTBAiOJNAYgHsDvlU9jrkKUE/cQ/kDX+/4BFflD9NpwiP62P5/AXuU/kQ== X-Received: by 2002:a05:6a20:3d87:b0:334:8d1f:fa8d with SMTP id adf61e73a8af0-36617e74cfemr4778913637.18.1765117673713; Sun, 07 Dec 2025 06:27:53 -0800 (PST) Received: from pengdl-pc.mioffice.cn ([43.224.245.249]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-bf686c32deesm9514792a12.13.2025.12.07.06.27.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Dec 2025 06:27:52 -0800 (PST) From: Donglin Peng To: rostedt@goodmis.org Cc: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, pengdonglin , Masami Hiramatsu , Xiaoqin Zhang Subject: [PATCH v1 2/2] tracing: Update funcgraph-retval documentation Date: Sun, 7 Dec 2025 22:27:42 +0800 Message-Id: <20251207142742.229924-3-dolinux.peng@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251207142742.229924-1-dolinux.peng@gmail.com> References: <20251207142742.229924-1-dolinux.peng@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: pengdonglin The existing documentation for funcgraph-retval is outdated and partially incorrect, as it describes limitations that have now been resolved. Recent changes (e.g., using BTF to obtain function return types) have addressed key issues: 1. Return values are now printed only for non-void functions. 2. Values are trimmed to the correct width of the return type, avoiding garbage data from high bits. Cc: Steven Rostedt (Google) Cc: Masami Hiramatsu Cc: Xiaoqin Zhang Signed-off-by: pengdonglin --- Documentation/trace/ftrace.rst | 74 ++++++++++++++++++---------------- 1 file changed, 40 insertions(+), 34 deletions(-) diff --git a/Documentation/trace/ftrace.rst b/Documentation/trace/ftrace.rst index d1f313a5f4ad..de97b65433cc 100644 --- a/Documentation/trace/ftrace.rst +++ b/Documentation/trace/ftrace.rst @@ -1454,6 +1454,10 @@ Options for function_graph tracer: printed in hexadecimal format. By default, this option is off. =20 + funcgraph-retaddr + When set, the return address will always be printed. + By default, this option is off. + sleep-time When running function graph tracer, to include the time a task schedules out in its function. @@ -2800,7 +2804,7 @@ It is default disabled. 0) 2.861 us | } /* putname() */ =20 The return value of each traced function can be displayed after -an equal sign "=3D". When encountering system call failures, it +an equal sign "ret =3D". When encountering system call failures, it can be very helpful to quickly locate the function that first returns an error code. =20 @@ -2810,16 +2814,16 @@ returns an error code. Example with funcgraph-retval:: =20 1) | cgroup_migrate() { - 1) 0.651 us | cgroup_migrate_add_task(); /* =3D 0xffff93fcfd= 346c00 */ + 1) 0.651 us | cgroup_migrate_add_task(); /* ret=3D0xffff93fc= fd346c00 */ 1) | cgroup_migrate_execute() { 1) | cpu_cgroup_can_attach() { 1) | cgroup_taskset_first() { - 1) 0.732 us | cgroup_taskset_next(); /* =3D 0xffff93fc= 8fb20000 */ - 1) 1.232 us | } /* cgroup_taskset_first =3D 0xffff93fc8f= b20000 */ - 1) 0.380 us | sched_rt_can_attach(); /* =3D 0x0 */ - 1) 2.335 us | } /* cpu_cgroup_can_attach =3D -22 */ - 1) 4.369 us | } /* cgroup_migrate_execute =3D -22 */ - 1) 7.143 us | } /* cgroup_migrate =3D -22 */ + 1) 0.732 us | cgroup_taskset_next(); /* ret=3D0xffff93= fc8fb20000 */ + 1) 1.232 us | } /* cgroup_taskset_first ret=3D0xffff93fc= 8fb20000 */ + 1) 0.380 us | sched_rt_can_attach(); /* ret=3D0x0 */ + 1) 2.335 us | } /* cpu_cgroup_can_attach ret=3D-22 */ + 1) 4.369 us | } /* cgroup_migrate_execute ret=3D-22 */ + 1) 7.143 us | } /* cgroup_migrate ret=3D-22 */ =20 The above example shows that the function cpu_cgroup_can_attach returned the error code -22 firstly, then we can read the code @@ -2836,37 +2840,39 @@ printed in hexadecimal format. Example with funcgraph-retval-hex:: =20 1) | cgroup_migrate() { - 1) 0.651 us | cgroup_migrate_add_task(); /* =3D 0xffff93fc= fd346c00 */ + 1) 0.651 us | cgroup_migrate_add_task(); /* ret=3D0xffff93= fcfd346c00 */ 1) | cgroup_migrate_execute() { 1) | cpu_cgroup_can_attach() { 1) | cgroup_taskset_first() { - 1) 0.732 us | cgroup_taskset_next(); /* =3D 0xffff93= fc8fb20000 */ - 1) 1.232 us | } /* cgroup_taskset_first =3D 0xffff93fc= 8fb20000 */ - 1) 0.380 us | sched_rt_can_attach(); /* =3D 0x0 */ - 1) 2.335 us | } /* cpu_cgroup_can_attach =3D 0xffffffea = */ - 1) 4.369 us | } /* cgroup_migrate_execute =3D 0xffffffea */ + 1) 0.732 us | cgroup_taskset_next(); /* ret=3D0xffff= 93fc8fb20000 */ + 1) 1.232 us | } /* cgroup_taskset_first ret=3D0xffff93= fc8fb20000 */ + 1) 0.380 us | sched_rt_can_attach(); /* ret=3D0x0 */ + 1) 2.335 us | } /* cpu_cgroup_can_attach ret=3D0xffffffe= a */ + 1) 4.369 us | } /* cgroup_migrate_execute ret=3D0xffffffea= */ 1) 7.143 us | } /* cgroup_migrate =3D 0xffffffea */ =20 -At present, there are some limitations when using the funcgraph-retval -option, and these limitations will be eliminated in the future: - -- Even if the function return type is void, a return value will still - be printed, and you can just ignore it. - -- Even if return values are stored in multiple registers, only the - value contained in the first register will be recorded and printed. - To illustrate, in the x86 architecture, eax and edx are used to store - a 64-bit return value, with the lower 32 bits saved in eax and the - upper 32 bits saved in edx. However, only the value stored in eax - will be recorded and printed. - -- In certain procedure call standards, such as arm64's AAPCS64, when a - type is smaller than a GPR, it is the responsibility of the consumer - to perform the narrowing, and the upper bits may contain UNKNOWN values. - Therefore, it is advisable to check the code for such cases. For instanc= e, - when using a u8 in a 64-bit GPR, bits [63:8] may contain arbitrary value= s, - especially when larger types are truncated, whether explicitly or implic= itly. - Here are some specific cases to illustrate this point: +Note that there are some limitations when using the funcgraph-retval +option: + +- If CONFIG_DEBUG_INFO_BTF is disabled (n), a return value is printed even= for + functions with a void return type. When CONFIG_DEBUG_INFO_BTF is enabled= (y), + the return value is printed only for non-void functions. + +- If a return value occupies multiple registers, only the value in the fir= st + register is recorded and printed. For example, on the x86 architecture, a + 64-bit return value is stored across eax (lower 32 bits) and edx (upper = 32 bits), + but only the contents of eax are captured. + +- Under certain procedure-call standards (e.g., arm64's AAPCS64), when the= return + type is smaller than a general-purpose register (GPR), the caller is res= ponsible + for narrowing the value; the upper bits of the register may contain unde= fined data. + For instance, when a u8 is returned in 64-bit GPR, bits [63:8] can hold = arbitrary + values, especially when larger types are truncated (explicitly or implic= itly). It + is therefore advisable to inspect the code in such cases. If CONFIG_DEBU= G_INFO_BTF + is enabled (y), the return value is automatically trimmed to the width o= f the return + type. + + The following examples illustrate the behavior: =20 **Case One**: =20 --=20 2.34.1