Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp6710264yba; Wed, 1 May 2019 18:40:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqyS8uiWpDHXn372AVeigqE+V3Vt4N7HxpO81kED6FjN76vXnuEJS65XLKANHwGwYkbHpAXG X-Received: by 2002:a62:305:: with SMTP id 5mr1169483pfd.65.1556761208887; Wed, 01 May 2019 18:40:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556761208; cv=none; d=google.com; s=arc-20160816; b=T7Yuk6E6boWEvQ+h8fh9RfCYgH+AtSnY11DIrZ/c4IwuDknG5MlOnSr86/cNAjdD3r 4c4+NF+wwxiKUx0EdJiJM0GF7fK3QSzR5G8HVEYEcWvlo6kzQmn3/uEqrQSlbP5YYsKd IakQ0rAPGU/hafTen01/tiG3GwU5ENovVIdSFLjrZm0K5FCXlCUc4IieH8bv3BB1Ojs6 E0A61U9sX3xTlT04jiRM3zrCYjPk8JDX1XgdoFy6G+mRunKkx4l2/xxwQhSUIeNRMCV5 QRyU8s1bLpsMTyWw6IDc19e6qYJVRajD6VjujfOgGmay2Ys9HAoIaDF7D9CGGg7KyCbQ /CVQ== 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=i9nWeehEzC3wI4B+75RHraov97yb5KcUP/N6b0Mc3KY=; b=MrB06uuLpdUVPqHLkPZfwzRA//O8+Urj26u+Prq5alq/30IjQSvzhqvchEDsxTk/oz 5J+bf2vcGPF6ZSM2l2Du5vCeIcTxCsfN/y7qH6Dh+gjEoFikeb3RPCTN4XGttaAFXz8x yGhPnkK5NMat67W5YsS2sOW5l0hqUV7ac+/ifdUm6/lj8QYkQAKgMDD6afXTVTSYsaON QxQ2alQDrGVQ3Icak9daCQvqqvJYWuOqXv/wiGsEJDwYl2Vdb8X7Z33rcX0IPwcBmIX2 DpeoOE5Kpbhbzvmkqr3oQxjzZq8fws6j2l08hNoCARVY1MJZZevII49vN+pzldLpNV+W Wc3Q== 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 z6si41505540plo.372.2019.05.01.18.39.52; Wed, 01 May 2019 18:40:08 -0700 (PDT) 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 S1726191AbfEBBjC (ORCPT + 99 others); Wed, 1 May 2019 21:39:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:46654 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726139AbfEBBjC (ORCPT ); Wed, 1 May 2019 21:39:02 -0400 Received: from oasis.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 532BC2085A; Thu, 2 May 2019 01:39:00 +0000 (UTC) Date: Wed, 1 May 2019 21:38:57 -0400 From: Steven Rostedt To: Viktor Rosendahl Cc: Ingo Molnar , linux-kernel@vger.kernel.org, Joel Fernandes Subject: Re: [PATCH v2 4/4] ftrace: Add an option for tracing console latencies Message-ID: <20190501213857.157e3741@oasis.local.home> In-Reply-To: <20190501203650.29548-5-viktor.rosendahl@gmail.com> References: <20190501203650.29548-1-viktor.rosendahl@gmail.com> <20190501203650.29548-5-viktor.rosendahl@gmail.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 On Wed, 1 May 2019 22:36:50 +0200 Viktor Rosendahl wrote: > This new option CONFIG_TRACE_CONSOLE_LATENCY will enable the latency > tracers to trace the console latencies. Previously this has always been > implicitely disabled. I guess this is because they are considered > to be well known and unavoidable. > > However, for some organizations it may nevertheless be desirable to > trace them. Basically, we want to be able to tell that there are > latencies in the system under test because someone has incorrectly > enabled the serial console. > I'd rather have this be a tracing option than a config one. > Signed-off-by: Viktor Rosendahl > --- > include/linux/irqflags.h | 13 +++++++++++++ > kernel/printk/printk.c | 5 +++-- > kernel/trace/Kconfig | 11 +++++++++++ > 3 files changed, 27 insertions(+), 2 deletions(-) > > diff --git a/include/linux/irqflags.h b/include/linux/irqflags.h > index 21619c92c377..791bee718448 100644 > --- a/include/linux/irqflags.h > +++ b/include/linux/irqflags.h > @@ -73,6 +73,19 @@ do { \ > # define start_critical_timings() do { } while (0) > #endif > > +#ifdef CONFIG_TRACE_CONSOLE_LATENCY > + > +#define console_stop_critical_timings() do {} while (0) > +#define console_start_critical_timings() do {} while (0) > + > +#else /* !CONFIG_TRACE_CONSOLE_LATENCY */ > + > +/* don't trace print latency */ > +#define console_stop_critical_timings() stop_critical_timings() > +#define console_start_critical_timings() start_critical_timings() Instead of this being turned into a nop, don't have a kconfig option but instead have this call into the trace_irqsoff.c code, and depending on what the options are, it should stop it. Of course, this would need to be smart enough to pair it. Perhaps return the result of console_stop_critical_timings() and have that passed to console_start_critical_timings(), and only have start do something if stop did something. This way the option only needs to disable the stop part. -- Steve > + > +#endif /* !CONFIG_TRACE_CONSOLE_LATENCY */ > + > /* > * Wrap the arch provided IRQ routines to provide appropriate checks. > */ > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c > index 02ca827b8fac..710e87f61158 100644 > --- a/kernel/printk/printk.c > +++ b/kernel/printk/printk.c > @@ -2448,9 +2448,10 @@ void console_unlock(void) > */ > console_lock_spinning_enable(); > > - stop_critical_timings(); /* don't trace print > latency */ > + /* don't trace print latency if it's disabled */ > + console_stop_critical_timings(); > call_console_drivers(ext_text, ext_len, text, len); > - start_critical_timings(); > + console_start_critical_timings(); > > if (console_lock_spinning_disable_and_check()) { > printk_safe_exit_irqrestore(flags); > diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig > index e5e8f2a0199e..f168d100d4fb 100644 > --- a/kernel/trace/Kconfig > +++ b/kernel/trace/Kconfig > @@ -244,6 +244,17 @@ config PREEMPT_TRACER > modification of /sys/kernel/debug/tracing/trace through > the inotify interface. > > + config TRACE_CONSOLE_LATENCY > + bool "Do not turn off latency tracing for the console" > + default n > + depends on IRQSOFF_TRACER || PREEMPT_TRACER > + help > + Some of the console drivers will cause long unavoidable > + latencies because they are slow and need to print > immediately > + in a serialized manner. Because of this their latencies > are not > + traced by default. This option will change behavior so that > + they are traced. > + > config SCHED_TRACER > bool "Scheduling Latency Tracer" > select GENERIC_TRACER