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

Commit a65b91a0 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "soc: qcom: dump current task stack and task_struct for minidump"

parents acd46c78 af5a88a3
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@
#include <asm/ptrace.h>
#include <asm/virt.h>
#include <asm/edac.h>
#include <soc/qcom/minidump.h>

#define CREATE_TRACE_POINTS
#include <trace/events/ipi.h>
@@ -740,6 +741,7 @@ static void ipi_cpu_stop(unsigned int cpu, struct pt_regs *regs)
		pr_crit("CPU%u: stopping\n", cpu);
		show_regs(regs);
		dump_stack();
		dump_stack_minidump(regs->sp);
		arm64_check_cache_ecc(NULL);
		raw_spin_unlock(&stop_lock);
	}
+27 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#include <linux/slab.h>
#include <linux/kmemleak.h>
#include <linux/async.h>
#include <linux/thread_info.h>
#include <soc/qcom/memory_dump.h>
#include <soc/qcom/minidump.h>
#include <asm/sections.h>
@@ -256,6 +257,32 @@ static void __init register_kernel_sections(void)
	}
}

#ifdef CONFIG_QCOM_MINIDUMP
void dump_stack_minidump(u64 sp)
{
	struct md_region ksp_entry, ktsk_entry;
	u32 cpu = smp_processor_id();

	if (sp < KIMAGE_VADDR || sp > -256UL)
		sp = current_stack_pointer;

	sp &= ~(THREAD_SIZE - 1);
	scnprintf(ksp_entry.name, sizeof(ksp_entry.name), "KSTACK%d", cpu);
	ksp_entry.virt_addr = sp;
	ksp_entry.phys_addr = virt_to_phys((uintptr_t *)sp);
	ksp_entry.size = THREAD_SIZE;
	if (msm_minidump_add_region(&ksp_entry))
		pr_err("Failed to add stack of cpu %d in Minidump\n", cpu);

	scnprintf(ktsk_entry.name, sizeof(ktsk_entry.name), "KTASK%d", cpu);
	ktsk_entry.virt_addr = (u64)current;
	ktsk_entry.phys_addr = virt_to_phys((uintptr_t *)current);
	ktsk_entry.size = sizeof(struct task_struct);
	if (msm_minidump_add_region(&ktsk_entry))
		pr_err("Failed to add current task %d in Minidump\n", cpu);
}
#endif

static void __init async_common_log_init(void *data, async_cookie_t cookie)
{
	register_kernel_sections();
+5 −0
Original line number Diff line number Diff line
@@ -39,11 +39,16 @@ struct md_region {
extern int msm_minidump_add_region(const struct md_region *entry);
/* Sets to true, if minidump table is initialized */
extern bool minidump_enabled;
extern void dump_stack_minidump(u64 sp);
#else
static inline int msm_minidump_add_region(const struct md_region *entry)
{
	/* Return quietly, if minidump is not supported */
	return 0;
}

static inline void dump_stack_minidump(u64 sp) {}
#endif


#endif
+2 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@
#include <linux/init.h>
#include <linux/nmi.h>
#include <linux/console.h>
#include <soc/qcom/minidump.h>

#define CREATE_TRACE_POINTS
#include <trace/events/exception.h>
@@ -108,6 +109,7 @@ void panic(const char *fmt, ...)
	va_start(args, fmt);
	vsnprintf(buf, sizeof(buf), fmt, args);
	va_end(args);
	dump_stack_minidump(0);
	pr_emerg("Kernel panic - not syncing: %s\n", buf);
#ifdef CONFIG_DEBUG_BUGVERBOSE
	/*