From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steven Rostedt Subject: Re: [PATCH 12/18] tracing: Add accessing direct address from function based events Date: Thu, 8 Feb 2018 20:10:03 -0500 Message-ID: <20180208201003.62ad9526@gandalf.local.home> References: <20180202230458.840252014@goodmis.org> <20180202231018.828677654@goodmis.org> <20180209003436.GB28206@sejong> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: linux-kernel@vger.kernel.org, Linus Torvalds , Ingo Molnar , Andrew Morton , Thomas Gleixner , Peter Zijlstra , Masami Hiramatsu , Tom Zanussi , linux-rt-users@vger.kernel.org, linux-trace-users@vger.kernel.org, Arnaldo Carvalho de Melo , Clark Williams , Jiri Olsa , Daniel Bristot de Oliveira , Juri Lelli , Jonathan Corbet , Mathieu Desnoyers , Alexei Starovoitov , kernel-team@lge.com To: Namhyung Kim Return-path: In-Reply-To: <20180209003436.GB28206@sejong> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-rt-users.vger.kernel.org On Fri, 9 Feb 2018 09:34:36 +0900 Namhyung Kim wrote: > > +Direct memory access > > +==================== > > + > > +Function arguments are not the only thing that can be recorded from a function > > +based event. Memory addresses can also be examined. If there's a global variable > > +that you want to monitor via an interrupt, you can put in the address directly. > > + > > + # grep total_forks /proc/kallsyms > > +ffffffff82354c18 B total_forks > > + > > + # echo 'do_IRQ(int total_forks=0xffffffff82354c18)' > function_events > > Couldn't we use the symbol name directly? Maybe it needs a syntax to > indicate global variable. Like this? > > # echo 'do_IRQ(int $total_forks)' > function_events Or perhaps use "@"? But that's a good idea and not hard to implement. > > case FUNC_STATE_TYPE: > > - if (!isalpha(token[0]) || token[0] == '_') > > - break; > > if (WARN_ON(!fevent->last_arg)) > > break; > > - fevent->last_arg->name = kstrdup(token, GFP_KERNEL); > > - if (!fevent->last_arg->name) > > + if (update_arg_name(fevent, token) < 0) > > + break; > > + if (strncmp(token, "0x", 2) == 0) > > + goto equal; > > Not sure it's needed here. IIUC it should see '=' first and you used > the same token with arg->name. Hmm.. do you want support accessing to > an unnamed address directly like below? > > # echo 'do_IRQ(int 0xffffffff82354c18)' > function_events Yes this works, and was the original way. Someone at DevConf.cz (Arnaldo maybe, can't remember) recommended giving a name and then we came up with the "=" sign to use. > > > + if (!isalpha(token[0]) && token[0] != '_') > > break; > > Maybe you want to check it before the update_arg_name(). Hmm, perhaps, I guess I should see what the error messages shows. Thanks! -- Steve