Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752150AbdGAAcQ (ORCPT ); Fri, 30 Jun 2017 20:32:16 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:44183 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751680AbdGAAcP (ORCPT ); Fri, 30 Jun 2017 20:32:15 -0400 X-ME-Sender: X-Sasl-enc: dh1CkMluq64TE3b0+oZzg+KHMd9e/daKKkK7/nabYcWX 1498869134 Date: Fri, 30 Jun 2017 18:32:12 -0600 From: Michael Sartain To: Steven Rostedt Cc: linux-kernel@vger.kernel.org, Joel Fernandes , Ingo Molnar Subject: Re: [PATCH] tracing: Add saved_tgids file to show cached pid to tgid mappings Message-ID: <20170701003211.gqtwmwophx6p6jhq@mikesart-cos> References: <20170630171748.sf5rnjb7pyws6ewu@mikesart-cos> <20170630175057.71de9d39@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170630175057.71de9d39@gandalf.local.home> User-Agent: NeoMutt/20170306 (1.8.0) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2107 Lines: 59 On Fri, Jun 30, 2017 at 05:50:57PM -0400, Steven Rostedt wrote: > On Fri, 30 Jun 2017 11:17:50 -0600 > Michael Sartain wrote: > > > Export the cached pid / tgid mappings to userspace. This allows user > > apps to translate the pids from a trace to their respective thread > > group. > > > > Example saved_tgids file with pid / tgid values separated by ' ': > > > > # cat saved_tgids > > 1048 1048 > > 1047 1047 > > 7 7 > > 1049 1047 > > 1054 1047 > > 1053 1047 > > > > [ Impact: let userspace apps reading binary buffer know tgid's ] > > Impact line? Linus put a kibosh on this a while ago... > > https://lkml.org/lkml/2009/4/15/296 > > Although, I will admit that this line is actually useful. Just remove > the brackets. Ah, thank you. I saw it used in the previous cmdline patch and used it as a reference. > > Signed-off-by: Michael Sartain > > --- > > kernel/trace/trace.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++- > > 1 file changed, 59 insertions(+), 1 deletion(-) > > > > diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c > > index 68c214b..ca84c97 100644 > > --- a/kernel/trace/trace.c > > +++ b/kernel/trace/trace.c > > @@ -4692,6 +4692,7 @@ static const struct file_operations tracing_readme_fops = { > > static void *saved_cmdlines_next(struct seq_file *m, void *v, loff_t *pos) > > { > > unsigned int *ptr = v; > > + long tgid_check = (long) m->private; > > I really don't like the subtle use of having m->private != NULL mean > this is for tgid listing. > > In fact, I don't see the purpose of reusing the seq code. The cmdlines > and tgid map are quite different. Just create its own functions. I > don't see the benefit of trying to reuse this except for making the > code more complex. Will do. Joel was also kind enough to send me feedback about RFCs and merge windows, etc. so I apologize - wasn't trying to get anything by anyone, just that this is my first real patch and I've obviously got a lot to learn here. Thank you for the comments. I'll fix and resubmit next week. -Mike