Received: by 2002:ab2:6f44:0:b0:1fd:c486:4f03 with SMTP id l4csp49518lqq; Wed, 12 Jun 2024 16:22:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUGPCZUueYpIE5NYGKfkXB6RlgdEKAZR7MUVy8xMZCn2ceEepnt3TAhXLri41ze/eWTzjG52mSY8VMXitQFq/Z7c2Zq18RKbj4EJi+u8g== X-Google-Smtp-Source: AGHT+IGfeWEY5Re6exhz+xVEvY3nk6hY5sgQd20CzKru/LwCqx+iCjqC8fYn+S+n/c3q99+/wBLb X-Received: by 2002:a05:6512:138d:b0:52c:9bb3:6656 with SMTP id 2adb3069b0e04-52c9bb367f4mr2380955e87.44.1718234570115; Wed, 12 Jun 2024 16:22:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718234570; cv=pass; d=google.com; s=arc-20160816; b=oLFBtk20oHdCfVnRQ0h3+uWGmvicjDd+Hi9kbE3V4afHNzmIbhtRv0KBJKe4jBDCQQ juJShAplbS44DzCddd0sQVXtTLl0xUTtTv36T8dgHBKP/v/QXzyr879+az3AUOwfL8ij qZ8867mA5J7XAwjLAWfd/e48MQadAEeNM1ddvCLM2i6KM3gmR/W8YvGrbusDnz3Jp0qI 1HDM2CRrVpPjokXHTAYZpJymQaWlVfsG4aqjkpa7w5ipdrse2u/E0Hn3tTHk18WEeoZH 9nbUZRODuUrq6onuEzVmwtyoJ+KJ3X1j5CpCbNW8C+0pFsdaZ8kiPckZoEHUyllCPr/B NZsA== 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=zeFENsnm8xR960CKY/7mctmMvYbDQ/atevQlD9sKvacpslYaMHJRkupfWoiYmk89hn SpM7ZyCgiRlGSZq3e8uBUbMbP+8hw9e0/1wF49ChvbSkknusxyxrNmNFtCgGHUodwOLh wwTmTvoV0NpU32asnOu1AQUlRm6afq64KBXbKV4OC2pUcRlEmAkbINZ0W5v7d0CsohBq Wh04qQKL6Mhw1FApYk1Em3ICBWqZRjyf9liYglSiGhmLwlhe1VnGRvC+P5oqXppDHNO5 wNnV1WX18hWKXIifF5Q+YHENSovmUlGbsG7C0Hvk7aRY5VXZ/w/7Q++WW3FLQWR3lOx8 /CrA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-212373-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212373-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 a640c23a62f3a-a6f56dd6955si4998666b.476.2024.06.12.16.22.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 16:22:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-212373-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-212373-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212373-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 C2AEE1F246F7 for ; Wed, 12 Jun 2024 23:22:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A4C56137761; Wed, 12 Jun 2024 23:20:12 +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 3A17812E1DE; Wed, 12 Jun 2024 23:20:08 +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=1718234408; cv=none; b=cK2cuBGBAxRTq6fD5A+rj7V9EuGSHVlOA+LTxry3/73YrRTrneM53D4l6bToReYJNPmJnbKvTih4QoWOu1aeU4RARp9Getcxkg1hMxMvDYZSm2g0QIgN2mt1lMNsgt6c+b0Z7/lyynHf9fpvMfAle0Mn7EZ7pwTOfIgBdn2FDFQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718234408; c=relaxed/simple; bh=5vY8upmAWCSCeuI23auVBMfapEFPUJFegpBwQdZuq6o=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=ZBRPnknHOKKOb6xdjNOzkXJiKBPm7QKpudmU/ODDePz4c6b7XDc1mIzshmKAahTnhixIfhrlS55PKGVT+LHkkNAyYgy/DKuI91a5CltLHXRTQUxCUMfdPZ4ju7Xj7wCuSikV+xduEv1gkoW0BP73cMQfRNg0NVsv78/+sTzTiTc= 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 1E28EC4AF1D; Wed, 12 Jun 2024 23:20:08 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.97) (envelope-from ) id 1sHXGV-00000001dgR-1Bkb; Wed, 12 Jun 2024 19:20:27 -0400 Message-ID: <20240612232027.145807384@goodmis.org> User-Agent: quilt/0.68 Date: Wed, 12 Jun 2024 19:19:47 -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 v6 13/13] tracing: Add last boot delta offset for stack traces References: <20240612231934.608252486@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