Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2c6c2435 authored by Sai Harshini Nimmala's avatar Sai Harshini Nimmala
Browse files

trace: Add warning threshold for irqsoff time



Trigger a crash when hardirqs_off time period crosses the
warning threshold.

Change-Id: Ifa96a51cd27a154ee2c207c82f1a145a80558c76
Signed-off-by: default avatarSai Harshini Nimmala <snimmala@codeaurora.org>
parent dc28abd8
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -83,6 +83,8 @@ extern unsigned int sysctl_preemptoff_tracing_threshold_ns;
#if defined(CONFIG_PREEMPTIRQ_EVENTS) && defined(CONFIG_IRQSOFF_TRACER)
extern unsigned int sysctl_irqsoff_tracing_threshold_ns;
extern unsigned int sysctl_irqsoff_dmesg_output_enabled;
extern unsigned int sysctl_irqsoff_crash_sentinel_value;
extern unsigned int sysctl_irqsoff_crash_threshold_ns;
#endif

enum sched_tunable_scaling {
+17 −0
Original line number Diff line number Diff line
@@ -143,6 +143,7 @@ static int six_hundred_forty_kb = 640 * 1024;
#endif
static unsigned int __maybe_unused half_million = 500000;
static unsigned int __maybe_unused one_hundred_million = 100000000;
static unsigned int __maybe_unused one_million = 1000000;
#ifdef CONFIG_SCHED_WALT
static int neg_three = -3;
static int three = 3;
@@ -368,6 +369,22 @@ static struct ctl_table kern_table[] = {
		.mode		= 0644,
		.proc_handler	= proc_dointvec,
	},
	{
		.procname	= "irqsoff_crash_sentinel_value",
		.data		= &sysctl_irqsoff_crash_sentinel_value,
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
		.proc_handler	= proc_dointvec,
	},
	{
		.procname	= "irqsoff_crash_threshold_ns",
		.data		= &sysctl_irqsoff_crash_threshold_ns,
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
		.proc_handler	= proc_douintvec_minmax,
		.extra1		= &one_million,
		.extra2		= &one_hundred_million,
	},
#endif
#ifdef CONFIG_SCHED_WALT
	{
+16 −0
Original line number Diff line number Diff line
@@ -618,6 +618,14 @@ unsigned int sysctl_irqsoff_tracing_threshold_ns = 5000000UL;
 * Enable irqsoff tracing to dmesg
 */
unsigned int sysctl_irqsoff_dmesg_output_enabled;
/*
 * Sentinel value to prevent unnecessary irqsoff crash
 */
unsigned int sysctl_irqsoff_crash_sentinel_value;
/*
 * Irqsoff warning threshold to trigger crash
 */
unsigned int sysctl_irqsoff_crash_threshold_ns = 10000000UL;

struct irqsoff_store {
	u64 ts;
@@ -649,6 +657,14 @@ void tracer_hardirqs_on(unsigned long a0, unsigned long a1)
			printk_deferred(KERN_ERR "D=%llu C:(%ps<-%ps<-%ps<-%ps)\n",
				delta, is->caddr[0], is->caddr[1],
					is->caddr[2], is->caddr[3]);
		if (sysctl_irqsoff_crash_sentinel_value == IRQSOFF_SENTINEL &&
			delta > sysctl_irqsoff_crash_threshold_ns) {
			printk_deferred(KERN_ERR
			"delta=%llu(ns) > crash_threshold=%llu(ns) Task=%s\n",
				delta, sysctl_irqsoff_crash_threshold_ns,
					current->comm);
			BUG_ON(1);
		}
	}
	is->ts = 0;
	lockdep_on();