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

Commit fdb94535 authored by Sarang Joshi's avatar Sarang Joshi
Browse files

coresight: add event to abort tracing late on kernel panic



We call coresight_abort() early in panic pathway to avoid trace buffer
getting cluttered with uninteresting messages; however sometimes it tends
to loose important info such as kernel sending notification to all
peripheral subsystems since it happens after aborting of CoreSight trace.
Add trace event to abort tracing late in kernel panic.
trace_event_kernel_panic and trace_event_kernel_panic_late are mutually
exclusive and can be control using module parameter. With this change user
will be able to choose whether to abort CoreSight trace early or late on
kernel panic.

Change-Id: I84cc299823d929fdf8129c9c728282b32391b7c1
Signed-off-by: default avatarSarang Joshi <spjoshi@codeaurora.org>
parent 360013b1
Loading
Loading
Loading
Loading
+17 −6
Original line number Diff line number Diff line
@@ -25,10 +25,10 @@ static int event_abort_set(const char *val, struct kernel_param *kp);
module_param_call(event_abort_enable, event_abort_set, param_get_int,
		  &event_abort_enable, 0644);

static int event_abort_on_panic = 1;
static int event_abort_early_panic = 1;
static int event_abort_on_panic_set(const char *val, struct kernel_param *kp);
module_param_call(event_abort_on_panic, event_abort_on_panic_set, param_get_int,
		  &event_abort_on_panic, 0644);
module_param_call(event_abort_early_panic, event_abort_on_panic_set,
		  param_get_int, &event_abort_early_panic, 0644);

static void event_abort_user_fault(void *ignore,
				   struct task_struct *task,
@@ -125,12 +125,23 @@ static int event_abort_on_panic_set(const char *val, struct kernel_param *kp)
		return ret;
	}

	if (event_abort_on_panic)
	if (event_abort_early_panic) {
		unregister_trace_kernel_panic_late(event_abort_kernel_panic,
						   NULL);
		ret = register_trace_kernel_panic(event_abort_kernel_panic,
						  NULL);
	else
		if (ret)
			goto err;
	} else {
		unregister_trace_kernel_panic(event_abort_kernel_panic, NULL);

		ret = register_trace_kernel_panic_late(event_abort_kernel_panic,
						       NULL);
		if (ret)
			goto err;
	}
	return 0;
err:
	pr_err("coresight_event: error registering panic event %d\n", ret);
	return ret;
}

+17 −0
Original line number Diff line number Diff line
@@ -101,6 +101,23 @@ TRACE_EVENT(kernel_panic,
	TP_printk("dummy:%ld", __entry->dummy)
);

TRACE_EVENT(kernel_panic_late,

	TP_PROTO(long dummy),

	TP_ARGS(dummy),

	TP_STRUCT__entry(
		__field(long, dummy)
	),

	TP_fast_assign(
		__entry->dummy	= dummy;
	),

	TP_printk("dummy:%ld", __entry->dummy)
);

#endif

#include <trace/define_trace.h>
+2 −0
Original line number Diff line number Diff line
@@ -136,6 +136,8 @@ void panic(const char *fmt, ...)

	atomic_notifier_call_chain(&panic_notifier_list, 0, buf);

	trace_kernel_panic_late(0);

	bust_spinlocks(0);

	if (!panic_blink)