Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752655AbcDZTPr (ORCPT ); Tue, 26 Apr 2016 15:15:47 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:55252 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752236AbcDZTPo (ORCPT ); Tue, 26 Apr 2016 15:15:44 -0400 From: Arnd Bergmann To: Rabin Vincent Cc: Steven Rostedt , Ingo Molnar , linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] tracing: add support for tracing MMIO helpers Date: Tue, 26 Apr 2016 21:14:47 +0200 Message-ID: <6253918.VUpbMrMy7R@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <1461697482-32406-1-git-send-email-rabin@rab.in> References: <1461697482-32406-1-git-send-email-rabin@rab.in> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:uoiB0lsmTKceAkqKloMrRIJtIEuwjuuh/cUJAvN+fZt3QpEIeQ+ HELjt1zCN4xlWP3sEJrofu0t0PUIkM3NiZ750hNvQBU4K1VvqRrLQG0pEnH55SkVnMnLzMf Nufieo1xBjiD+sak0c+hKhGUeciEyS94vRe2GLu2mMLZijxDQkt3mvKlzseQS6Pz80FtRQO Kc1yqIeni+hyMSHJPNq9g== X-UI-Out-Filterresults: notjunk:1;V01:K0:Y7/aQm9mFao=:tzz+GUJZGDTJai/uC6ojKE 9nT39ZS2dX7cUouIfCZPPJaVfEq75RyV+7ivju+kSRUvinDvM52bdsKY+iL6UwwiufX1VaKkn ztJcZly5aUSfkj/ik7oXOAR2bQj39d+UJnfGZS/ielBCkLR3QX07ZifGQ2Ixv1+5sVyk1blQi PKKBRvPej4Dr06lTp9VQCV+rTn/klFLopQsM8436eSLoPQp/f2eqBbQ8J8cNhE5nvpN718UAJ Qhkz5kzWlmIwsyx4kSAN0jETGwcfIcNLHoPNg2o0HQEZY7eKEdrxpcKekCqd+tQAER0xG4tFl 0iruWnnsGOe86e7lkZOX2SnTmw6uEEO5n3pJ1rdROzRPOnwphhymzbOvQGYn1kEwedKCOBVKO j9TCP3kjkjHviILo1c5764Qm3UVCnAMHR560p/6HIKqBhejHJrwZK9vuBDyAX0uCVXdsvOvYU e7XlDD9T4wvuz9fBUh//jHTOWGVygukh0G3DN34/AM+0uEkOfvF3JwZilJeiWTc3bgqhDJdJU 5z2p6AP9jHlEhLjyTqL10WUa64m40H7v4JvuZOj4WpGWYcYsbKhgBMIEeE8eMYRtLmwQc1HO+ DNBYromMJwiiXQpfdzkKlTCd0sxlzVc30zmFdCdyzj/Bbfp19EykMeeivHc8bklf9DxjtFWEo zMFvTjeE4XGgID94uMVPBqvJIMeKZoDoQF8MeyqSzc2oDCiTnlGkyMgNdMgbc6xx35FGCplhq 5G4SZEc/eiAF+2Tf Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2681 Lines: 79 On Tuesday 26 April 2016 21:04:42 Rabin Vincent wrote: > Add support for tracing the MMIO helpers readl()/writel() (and their > variants), for use while developing and debugging device drivers. > > The address and the value are saved along with the C expressions used in > the driver when calling these MMIO access functions, leading to a trace > of the driver's interactions with the hardware's registers: This seems like a very useful feature > We do not globally replace the MMIO helpers. Instead, tracing must be > explicitly enabled in the required driver source files by #defining > TRACE_MMIO_HELPERS at the top of the file. > > The support is added via and as such is only > available on the archs which use that header. Why that limitation? I think only few architectures use it. Maybe at least enable it for x86 as well? > +/* This part must be outside protection */ > +#include > diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig > index e45db6b0d878..feca834436c5 100644 > --- a/kernel/trace/Kconfig > +++ b/kernel/trace/Kconfig > @@ -372,6 +372,22 @@ config STACK_TRACER > > Say N if unsure. > > +config TRACE_MMIO_HELPERS > + bool "Support for tracing MMIO helpers" > + select GENERIC_TRACER How about putting a whitelist of architectures here that are including the necessary definitions? Or better, a HAVE_TRACE_MMIO_HELPERS symbol that gets selected by architectures and that this depends on? > diff --git a/kernel/trace/trace_mmio_helpers.c b/kernel/trace/trace_mmio_helpers.c > new file mode 100644 > index 000000000000..dbd8f725e7b8 > --- /dev/null > +++ b/kernel/trace/trace_mmio_helpers.c > @@ -0,0 +1,45 @@ > +#define TRACE_MMIO_HELPERS > +#include > + > +#define CREATE_TRACE_POINTS > +#include > + > +#define DEFINE_MMIO_RW_TRACE(c, type) \ > +type read ## c ## _trace(const volatile void __iomem *addr, \ > + const char *addrexp, bool relaxed, \ > + unsigned long caller) \ > +{ \ > + type value; \ > + \ > + if (relaxed) \ > + value = read ## c ## _relaxed_notrace(addr); \ > + else \ > + value = read ## c ## _notrace(addr); \ > + \ > + trace_mmio_read(addr, addrexp, value, \ > + sizeof(value), relaxed, caller); \ > + \ > + return value; \ > +} \ > + \ We have a number of other accessors that are commonly used: {ioread,iowrite}{8,16,32,64}{,_be} {in,out}{b,w,l,q} {hi_lo_,lo_hi_}{read,write}q Other than having to write up the code for all of them, are the strong reasons for defining only the subset you currently have? Arnd