Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp501445ybl; Wed, 4 Dec 2019 06:22:08 -0800 (PST) X-Google-Smtp-Source: APXvYqwi2dl2XbX5GVuR8/pe+nygi1SNWgIhhNJjUmh8A1a+P5tKnwbFiTSCxWf892NpOLrkPNw3 X-Received: by 2002:a05:6830:14d5:: with SMTP id t21mr1635741otq.324.1575469328243; Wed, 04 Dec 2019 06:22:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575469328; cv=none; d=google.com; s=arc-20160816; b=CZrDgHQTcGkKFiea47HFhIFwzpE0nWbicSgNW//c07CDWmrT3PU4zEftDYQwRoDEHs sBs4u2E/F10A4GBypAf1iqvAnnKYwfurMCgRxKXLExgpXcKSZBEuFig2Mtl4x/Vrb38b YsdFJKnIleRl65fKUG///9aNfnV8hRf3q+bkTHk3+K1mKPrWjyMkdFW+9r4zrLP8pejc wQnklI2cX8JMQVxCwEB9nI/UZi+I0emg0rXtK/gavcrbhEOGchMKtSPef4T/4h+TT6Na hFx495JrlGKZajP0K3vfDN2cyqb/Yi7mooL5kWvXc0TeGjHdjuw4tHtAzyHtMYZksjIa kUBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=WQ+SAdqBY4obAtehmU88igPPsp3UHRB7g2sOjtG3I5E=; b=AxqRFZdqSFlFkBF8YidoztlW98csvBbWEQC2ILUyQ2CTqvCMpbvTm4XRPaTG9Iagx2 Q71IQ6H4bzFNI1yXQgsJrr+V087c2/STIcXb8RvC5Cd2hd2a3bj7Og7qhXqEKESj5iAB e2wK3IqG884aQ7U1/0NZ1S07ax6givBkJCZGsU9k6CmLaPwkYz0C0Ijp0iTWy+4JJ3jU NXCDD/y9w0vxtBNHmZks5ffJ569Iyg7pfW4TExrXd3vl3Vcp/Qh9xsgU/Xuk3LZrFWDj +z55iz0aQ71u0ZaXMKhJ7UNKo09EURBrbd1+5vQB+k6asZGLdB7ifg0bH9Ofh+iCHCfK 1hSg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e74si3119295ote.14.2019.12.04.06.21.54; Wed, 04 Dec 2019 06:22:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727912AbfLDOVS (ORCPT + 99 others); Wed, 4 Dec 2019 09:21:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:56982 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727828AbfLDOVS (ORCPT ); Wed, 4 Dec 2019 09:21:18 -0500 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3CE58206DF; Wed, 4 Dec 2019 14:21:17 +0000 (UTC) Date: Wed, 4 Dec 2019 09:21:15 -0500 From: Steven Rostedt To: Antonio Borneo Cc: Ingo Molnar , Joel Fernandes , Joel Fernandes , , Subject: Re: [PATCH] tracing: Fix printing ptrs in preempt/irq enable/disable events Message-ID: <20191204092115.30ef75c9@gandalf.local.home> In-Reply-To: <20191127154428.191095-1-antonio.borneo@st.com> References: <20191127154428.191095-1-antonio.borneo@st.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Joel, Any comments on this patch? -- Steve On Wed, 27 Nov 2019 16:44:28 +0100 Antonio Borneo wrote: > This tracing event class is the only instance in kernel that logs > in the trace buffer the instruction pointer as offset to _stext, > instead of logging the full pointer. > This looks like a nice optimization for 64 bits platforms, where a > 32 bit offset can take less space than a full 64 bits pointer. But > the symbol _stext is incorrectly resolved as zero in the expansion > of TP_printk(), which then prints only the hex offset instead of > the name of the caller function. Plus, on arm arch the kernel > modules are loaded at address lower than _stext, causing the u32 > offset arithmetics to overflow and wrap at 32 bits. > I did not identified a 64 bit arch where the modules are loaded at > offset from _stext that exceed u32 range, but I also did not > identified any constraint to feel safe with a u32 offset. > > Log directly the instruction pointer instead of the offset to > _stext. > > Signed-off-by: Antonio Borneo > Fixes: d59158162e03 ("tracing: Add support for preempt and irq enable/disable events") > --- > include/trace/events/preemptirq.h | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/include/trace/events/preemptirq.h b/include/trace/events/preemptirq.h > index 95fba0471e5b..d548a6aafa18 100644 > --- a/include/trace/events/preemptirq.h > +++ b/include/trace/events/preemptirq.h > @@ -18,18 +18,18 @@ DECLARE_EVENT_CLASS(preemptirq_template, > TP_ARGS(ip, parent_ip), > > TP_STRUCT__entry( > - __field(u32, caller_offs) > - __field(u32, parent_offs) > + __field(unsigned long, caller_ip) > + __field(unsigned long, parent_ip) > ), > > TP_fast_assign( > - __entry->caller_offs = (u32)(ip - (unsigned long)_stext); > - __entry->parent_offs = (u32)(parent_ip - (unsigned long)_stext); > + __entry->caller_ip = ip; > + __entry->parent_ip = parent_ip; > ), > > TP_printk("caller=%pS parent=%pS", > - (void *)((unsigned long)(_stext) + __entry->caller_offs), > - (void *)((unsigned long)(_stext) + __entry->parent_offs)) > + (void *)__entry->caller_ip, > + (void *)__entry->parent_ip) > ); > > #ifdef CONFIG_TRACE_IRQFLAGS