Received: by 2002:a05:7208:c250:b0:86:f851:443 with SMTP id w16csp45928rbd; Tue, 11 Jun 2024 12:31:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXqKuoYYjLc6KL5Bb/Ygvq1MrDlQKpN4/kE0uuR48OZNffkj/Y9ir8zt7fE0PPGTrg9rc1D/x2dohkbM2e0HaEUiNJ3qn8A1wrP/72dww== X-Google-Smtp-Source: AGHT+IE2Y/fod1QS6y2BccN99ic1oPbpTixSd2gHV9O7H1iPVIG4cUxKqXQKulby3270U5APwwIF X-Received: by 2002:a50:bb07:0:b0:578:6c19:4801 with SMTP id 4fb4d7f45d1cf-57c81afdca1mr4108570a12.22.1718134301166; Tue, 11 Jun 2024 12:31:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718134301; cv=pass; d=google.com; s=arc-20160816; b=p5+hj1HFr3CkrNPbKngrUELKNtlxxi+Rhxet7zDE8NFA4Qa1ys2OtQ/E+jC/8fS9lB VywyyfzeAk/AWoyypjNYqEGQSgrrQl80Iz2QcCmUiqWns161xmFi/cP3cd/6vhNGJFod RxGArhu9iNAcyccSET0PRb66Lrbb5hc31+DEVXNWBoxzDHAQu5L4y81wTp1bQJrOf+eG 9Bm8N2nasBfLUcX5VTg5SE6FYhR2HRJVkwlaqw8byh5QXRi3q1/XRSv6YUOBwGX5n4wS 1/jzuOvou6/AhLEsFYdrw61XF5nxvErbxLRlWbBc+SLohNl2uNSRTiN43wWqm4zf7r8c U9Ug== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:subject:cc:to:from:date:user-agent:message-id; bh=LOpfYHaJiBdCXVhEX4C2/jc5/RcduUrQviah1CbqdQc=; fh=VQi8WXJrSHXxsfwqC9oAfi6LEiQC0Qv/w+aqrHCHJLs=; b=ICAkyDu7sTiGm9+buvOWd2cPBL9xgLBmEgWIij2g1MvptkzUpcsUuh7TxKyDCnX/a2 aFMHyOmrTzg5//j5/g/QklOreYbBU546E1XPs+kGfcj9PkCx1rIHSsBveb7nPfQjXtaH HnFg8Zp/AciJTzkv1yFn0nh6UmbiCgoavahMbiGpGEjF+y21heYSBaBUvxg29DrAxEEH tf5lKaqHW0GNzp3DeIJ/XdYbWZz2lgRQRNVqH+vnl4WqQy214P2wRByDMsHFZKBxPD5U OegGt9xu3R3SMSPG1COoKYqGTDGi+yduKT8cnsI2YeyNtm4nBPQdWrx/AXq2lSIftM/U D1GA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-210511-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210511-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57c742aac89si3352354a12.408.2024.06.11.12.31.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 12:31:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-210511-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-210511-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210511-linux.lists.archive=gmail.com@vger.kernel.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 am.mirrors.kernel.org (Postfix) with ESMTPS id E66E91F248F4 for ; Tue, 11 Jun 2024 19:31:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2BAC2156243; Tue, 11 Jun 2024 19:28:57 +0000 (UTC) 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 26ACE152DF1; Tue, 11 Jun 2024 19:28:53 +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=1718134133; cv=none; b=J/0Ex3PrY2apdjGOnUcowYHy8ktdTkvgJkmLvaMtXm5qYDy4+RwxFVJxoElsoyEeIOjX6lAVhgk25Gdnnk4nHbMrZtPdw/eKD6PZsN523swqy3thgU/7G7WelkzcLh+MAMvuYfFaQvNeyTkCevS14hZoQKITCwuC/c1N4WqEwsM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718134133; c=relaxed/simple; bh=5vY8upmAWCSCeuI23auVBMfapEFPUJFegpBwQdZuq6o=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=AY4KtWNnNyGz6eWl2rWwosdX1+rEntkx4ardpqYMpTc/giXZtXmtmgO46Khk4XwzW4gts9OLtdsS5lpu4OQjHf1Zn2J9fuuXIP3/WOSDt+5juix2z945F64/SkIooFucEs9twUXiM05lY/D3DtNqKaEQ9oTqJzLXkqUJdWk2R+g= 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 DE75AC4AF49; Tue, 11 Jun 2024 19:28:52 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1sH7B7-00000001Tvw-1s67; Tue, 11 Jun 2024 15:29:09 -0400 Message-ID: <20240611192909.310647031@goodmis.org> User-Agent: quilt/0.68 Date: Tue, 11 Jun 2024 15:28:41 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org, linux-trace-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 , suleiman@google.com, 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: [PATCH v4 13/13] tracing: Add last boot delta offset for stack traces References: <20240611192828.691638177@goodmis.org> 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=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. 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 trace_iterator *iter, struct trace_seq *s = &iter->seq; unsigned long *p; unsigned long *end; + long delta = iter->tr->text_delta; trace_assign_type(field, iter->ent); end = (unsigned long *)((long)iter->ent + iter->ent_size); @@ -1245,7 +1246,7 @@ static enum print_line_t trace_stack_print(struct trace_iterator *iter, break; trace_seq_puts(s, " => "); - seq_print_ip_sym(s, *p, flags); + seq_print_ip_sym(s, (*p) + delta, flags); trace_seq_putc(s, '\n'); } -- 2.43.0