linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tracing: Make the space reserved for the pid wider
@ 2020-09-04  8:23 Sebastian Andrzej Siewior
  2020-09-15 10:46 ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 4+ messages in thread
From: Sebastian Andrzej Siewior @ 2020-09-04  8:23 UTC (permalink / raw)
  To: linux-kernel; +Cc: Steven Rostedt, Ingo Molnar, Thomas Gleixner

For 64bit CONFIG_BASE_SMALL=0 systems PID_MAX_LIMIT is set by default to
4194304. During boot the kernel sets a new value based on number of CPUs
but no lower than 32768. It is 1024 per CPU so with 128 CPUs the default
becomes 131072 which needs six digits. 
This value can be increased during run time but must not exceed the
initial upper limit.

Systemd sometime after v241 sets it to the upper limit during boot. The
result is that when the pid exceeds five digits, the trace output is a
little hard to read because it is no longer properly padded (same like
on big iron with 98+ CPUs).

Increase the pid padding to seven digits.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 kernel/trace/trace.c        | 38 ++++++++++++++++++-------------------
 kernel/trace/trace_output.c | 12 ++++++------
 2 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index f40d850ebabcc..2a7c26345e835 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -3782,14 +3782,14 @@ unsigned long trace_total_entries(struct trace_array *tr)
 
 static void print_lat_help_header(struct seq_file *m)
 {
-	seq_puts(m, "#                  _------=> CPU#            \n"
-		    "#                 / _-----=> irqs-off        \n"
-		    "#                | / _----=> need-resched    \n"
-		    "#                || / _---=> hardirq/softirq \n"
-		    "#                ||| / _--=> preempt-depth   \n"
-		    "#                |||| /     delay            \n"
-		    "#  cmd     pid   ||||| time  |   caller      \n"
-		    "#     \\   /      |||||  \\    |   /         \n");
+	seq_puts(m, "#                    _------=> CPU#            \n"
+		    "#                   / _-----=> irqs-off        \n"
+		    "#                  | / _----=> need-resched    \n"
+		    "#                  || / _---=> hardirq/softirq \n"
+		    "#                  ||| / _--=> preempt-depth   \n"
+		    "#                  |||| /     delay            \n"
+		    "#  cmd     pid     ||||| time  |   caller      \n"
+		    "#     \\   /        |||||  \\    |   /         \n");
 }
 
 static void print_event_info(struct array_buffer *buf, struct seq_file *m)
@@ -3810,26 +3810,26 @@ static void print_func_help_header(struct array_buffer *buf, struct seq_file *m,
 
 	print_event_info(buf, m);
 
-	seq_printf(m, "#           TASK-PID   %s  CPU#   TIMESTAMP  FUNCTION\n", tgid ? "TGID     " : "");
-	seq_printf(m, "#              | |     %s    |       |         |\n",	 tgid ? "  |      " : "");
+	seq_printf(m, "#           TASK-PID    %s CPU#     TIMESTAMP  FUNCTION\n", tgid ? "   TGID   " : "");
+	seq_printf(m, "#              | |      %s   |         |         |\n",      tgid ? "     |    " : "");
 }
 
 static void print_func_help_header_irq(struct array_buffer *buf, struct seq_file *m,
 				       unsigned int flags)
 {
 	bool tgid = flags & TRACE_ITER_RECORD_TGID;
-	const char *space = "          ";
-	int prec = tgid ? 10 : 2;
+	const char *space = "            ";
+	int prec = tgid ? 12 : 2;
 
 	print_event_info(buf, m);
 
-	seq_printf(m, "#                          %.*s  _-----=> irqs-off\n", prec, space);
-	seq_printf(m, "#                          %.*s / _----=> need-resched\n", prec, space);
-	seq_printf(m, "#                          %.*s| / _---=> hardirq/softirq\n", prec, space);
-	seq_printf(m, "#                          %.*s|| / _--=> preempt-depth\n", prec, space);
-	seq_printf(m, "#                          %.*s||| /     delay\n", prec, space);
-	seq_printf(m, "#           TASK-PID %.*sCPU#  ||||    TIMESTAMP  FUNCTION\n", prec, "   TGID   ");
-	seq_printf(m, "#              | |   %.*s  |   ||||       |         |\n", prec, "     |    ");
+	seq_printf(m, "#                            %.*s  _-----=> irqs-off\n", prec, space);
+	seq_printf(m, "#                            %.*s / _----=> need-resched\n", prec, space);
+	seq_printf(m, "#                            %.*s| / _---=> hardirq/softirq\n", prec, space);
+	seq_printf(m, "#                            %.*s|| / _--=> preempt-depth\n", prec, space);
+	seq_printf(m, "#                            %.*s||| /     delay\n", prec, space);
+	seq_printf(m, "#           TASK-PID  %.*s CPU#  ||||   TIMESTAMP  FUNCTION\n", prec, "     TGID   ");
+	seq_printf(m, "#              | |    %.*s   |   ||||      |         |\n", prec, "       |    ");
 }
 
 void
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index 4d1893564912d..000e9dc224c61 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -497,7 +497,7 @@ lat_print_generic(struct trace_seq *s, struct trace_entry *entry, int cpu)
 
 	trace_find_cmdline(entry->pid, comm);
 
-	trace_seq_printf(s, "%8.8s-%-5d %3d",
+	trace_seq_printf(s, "%8.8s-%-7d %3d",
 			 comm, entry->pid, cpu);
 
 	return trace_print_lat_fmt(s, entry);
@@ -588,15 +588,15 @@ int trace_print_context(struct trace_iterator *iter)
 
 	trace_find_cmdline(entry->pid, comm);
 
-	trace_seq_printf(s, "%16s-%-5d ", comm, entry->pid);
+	trace_seq_printf(s, "%16s-%-7d ", comm, entry->pid);
 
 	if (tr->trace_flags & TRACE_ITER_RECORD_TGID) {
 		unsigned int tgid = trace_find_tgid(entry->pid);
 
 		if (!tgid)
-			trace_seq_printf(s, "(-----) ");
+			trace_seq_printf(s, "(-------) ");
 		else
-			trace_seq_printf(s, "(%5d) ", tgid);
+			trace_seq_printf(s, "(%7d) ", tgid);
 	}
 
 	trace_seq_printf(s, "[%03d] ", iter->cpu);
@@ -636,7 +636,7 @@ int trace_print_lat_context(struct trace_iterator *iter)
 		trace_find_cmdline(entry->pid, comm);
 
 		trace_seq_printf(
-			s, "%16s %5d %3d %d %08x %08lx ",
+			s, "%16s %7d %3d %d %08x %08lx ",
 			comm, entry->pid, iter->cpu, entry->flags,
 			entry->preempt_count, iter->idx);
 	} else {
@@ -917,7 +917,7 @@ static enum print_line_t trace_ctxwake_print(struct trace_iterator *iter,
 	S = task_index_to_char(field->prev_state);
 	trace_find_cmdline(field->next_pid, comm);
 	trace_seq_printf(&iter->seq,
-			 " %5d:%3d:%c %s [%03d] %5d:%3d:%c %s\n",
+			 " %7d:%3d:%c %s [%03d] %7d:%3d:%c %s\n",
 			 field->prev_pid,
 			 field->prev_prio,
 			 S, delim,
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] tracing: Make the space reserved for the pid wider
  2020-09-04  8:23 [PATCH] tracing: Make the space reserved for the pid wider Sebastian Andrzej Siewior
@ 2020-09-15 10:46 ` Sebastian Andrzej Siewior
  2020-09-15 13:05   ` Steven Rostedt
  0 siblings, 1 reply; 4+ messages in thread
From: Sebastian Andrzej Siewior @ 2020-09-15 10:46 UTC (permalink / raw)
  To: linux-kernel; +Cc: Steven Rostedt, Ingo Molnar, Thomas Gleixner

On 2020-09-04 10:23:31 [+0200], To linux-kernel@vger.kernel.org wrote:
> For 64bit CONFIG_BASE_SMALL=0 systems PID_MAX_LIMIT is set by default to
> 4194304. During boot the kernel sets a new value based on number of CPUs
> but no lower than 32768. It is 1024 per CPU so with 128 CPUs the default
> becomes 131072 which needs six digits. 
> This value can be increased during run time but must not exceed the
> initial upper limit.
> 
> Systemd sometime after v241 sets it to the upper limit during boot. The
> result is that when the pid exceeds five digits, the trace output is a
> little hard to read because it is no longer properly padded (same like
> on big iron with 98+ CPUs).
> 
> Increase the pid padding to seven digits.

ping

Sebastian

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] tracing: Make the space reserved for the pid wider
  2020-09-15 10:46 ` Sebastian Andrzej Siewior
@ 2020-09-15 13:05   ` Steven Rostedt
  2020-09-15 13:16     ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 4+ messages in thread
From: Steven Rostedt @ 2020-09-15 13:05 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior; +Cc: linux-kernel, Ingo Molnar, Thomas Gleixner

On Tue, 15 Sep 2020 12:46:48 +0200
Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:

> On 2020-09-04 10:23:31 [+0200], To linux-kernel@vger.kernel.org wrote:
> > For 64bit CONFIG_BASE_SMALL=0 systems PID_MAX_LIMIT is set by default to
> > 4194304. During boot the kernel sets a new value based on number of CPUs
> > but no lower than 32768. It is 1024 per CPU so with 128 CPUs the default
> > becomes 131072 which needs six digits. 
> > This value can be increased during run time but must not exceed the
> > initial upper limit.
> > 
> > Systemd sometime after v241 sets it to the upper limit during boot. The
> > result is that when the pid exceeds five digits, the trace output is a
> > little hard to read because it is no longer properly padded (same like
> > on big iron with 98+ CPUs).
> > 
> > Increase the pid padding to seven digits.  
> 
> ping
> 

Hi Sebastian,

I'm still buried in email from my PTO, with lots of patches I need to
review and apply (or comment on). And I'm also behind in internal work
affairs. I'm not ignoring this, just taking some time to get to it :-/

-- Steve

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] tracing: Make the space reserved for the pid wider
  2020-09-15 13:05   ` Steven Rostedt
@ 2020-09-15 13:16     ` Sebastian Andrzej Siewior
  0 siblings, 0 replies; 4+ messages in thread
From: Sebastian Andrzej Siewior @ 2020-09-15 13:16 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: linux-kernel, Ingo Molnar, Thomas Gleixner

On 2020-09-15 09:05:20 [-0400], Steven Rostedt wrote:
> Hi Sebastian,
Hi Steven,

> I'm still buried in email from my PTO, with lots of patches I need to
> review and apply (or comment on). And I'm also behind in internal work
> affairs. I'm not ignoring this, just taking some time to get to it :-/

Sorry, I forgot that PTO part…

> -- Steve

Sebastian

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-09-16  0:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-04  8:23 [PATCH] tracing: Make the space reserved for the pid wider Sebastian Andrzej Siewior
2020-09-15 10:46 ` Sebastian Andrzej Siewior
2020-09-15 13:05   ` Steven Rostedt
2020-09-15 13:16     ` Sebastian Andrzej Siewior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).