From nobody Fri Dec 19 07:31:48 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A6F6619ADAE for ; Fri, 14 Jun 2024 16:30:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718382649; cv=none; b=BX3kiqMbFyXbpuV6CJhoLh33DLbYzy1dT2+0nzNS5jPX5AnDaxbBYW4oU/AGsZ3eS2JdBQNeXIJayHnwOvfRov5nAZTIy5f/JfP6Topplz9TKWsGEEqq36dZOVoOJ+jPERBTMO5ZI0xzEw9KZjbsQZoFo51e9Ya+5B1uX5JJshw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718382649; c=relaxed/simple; bh=yhZWfxQ07Xgl1GfOLtClcFtEAGRqH3tUEM+G2XMRyDc=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=WFS+hQ/JrcHcEEzN7rE+qSXtSOzW7q+/3PDGJmaLJbsJoEyjEiKcnVqpURYEkkbWsdU/ue/Vqg7cKqSQkqpy45TrUmSW5Pe54W31U6y1Bah1ErLG2jKFLpZHqcAjEMKgzmRkLc0QkfPgpWdUrhB4w4tzK61W25NZOziC4Of4r4w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 525E2C4DDE4; Fri, 14 Jun 2024 16:30:49 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1sI9pY-00000001rvQ-1mUy; Fri, 14 Jun 2024 12:31:12 -0400 Message-ID: <20240614163112.285102247@goodmis.org> User-Agent: quilt/0.68 Date: Fri, 14 Jun 2024 12:30:28 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Vincent Donnefort , Joel Fernandes , Daniel Bristot de Oliveira , Ingo Molnar , Peter Zijlstra , Thomas Gleixner , Vineeth Pillai , Youssef Esmat , Beau Belgrave , Alexander Graf , Baoquan He , Borislav Petkov , "Paul E. McKenney" , David Howells , Mike Rapoport , Dave Hansen , Tony Luck , Guenter Roeck , Ross Zwisler , Kees Cook Subject: [for-next][PATCH 13/13] tracing: Add last boot delta offset for stack traces References: <20240614163015.456541709@goodmis.org> 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: "Steven Rostedt (Google)" The addresses of a stack trace event are relative to the kallsyms. As that can change between boots, when printing the stack trace from a buffer that was from the last boot, it needs all the addresses to be added to the "text_delta" that gives the delta between the addresses of the functions for the current boot compared to the address of the last boot. Then it can be passed to kallsyms to find the function name, otherwise it just shows a useless list of addresses. Link: https://lkml.kernel.org/r/20240612232027.145807384@goodmis.org Cc: Masami Hiramatsu Cc: Mark Rutland Cc: Mathieu Desnoyers Cc: Andrew Morton Cc: Vincent Donnefort Cc: Joel Fernandes Cc: Daniel Bristot de Oliveira Cc: Ingo Molnar Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Vineeth Pillai Cc: Youssef Esmat Cc: Beau Belgrave Cc: Alexander Graf Cc: Baoquan He Cc: Borislav Petkov Cc: "Paul E. McKenney" Cc: David Howells Cc: Mike Rapoport Cc: Dave Hansen Cc: Tony Luck Cc: Guenter Roeck Cc: Ross Zwisler Cc: Kees Cook Signed-off-by: Steven Rostedt (Google) --- kernel/trace/trace_output.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c index b9d2c64c0648..48de93598897 100644 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c @@ -1233,6 +1233,7 @@ static enum print_line_t trace_stack_print(struct tra= ce_iterator *iter, struct trace_seq *s =3D &iter->seq; unsigned long *p; unsigned long *end; + long delta =3D iter->tr->text_delta; =20 trace_assign_type(field, iter->ent); end =3D (unsigned long *)((long)iter->ent + iter->ent_size); @@ -1245,7 +1246,7 @@ static enum print_line_t trace_stack_print(struct tra= ce_iterator *iter, break; =20 trace_seq_puts(s, " =3D> "); - seq_print_ip_sym(s, *p, flags); + seq_print_ip_sym(s, (*p) + delta, flags); trace_seq_putc(s, '\n'); } =20 --=20 2.43.0