Staging
v0.8.1
https://github.com/torvalds/linux
Revision cec353f6c2c9ff003332a41ed37b55df88dfa9a5 authored by Linus Torvalds on 21 November 2019, 20:01:30 UTC, committed by Linus Torvalds on 21 November 2019, 20:01:30 UTC
Pull GPIO fixes from Linus Walleij:
 "A last set of small fixes for GPIO, this cycle was quite busy.

   - Fix debounce delays on the MAX77620 GPIO expander

   - Use the correct unit for debounce times on the BD70528 GPIO expander

   - Get proper deps for parallel builds of the GPIO tools

   - Add a specific ACPI quirk for the Terra Pad 1061"

* tag 'gpio-v5.4-5' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio:
  gpiolib: acpi: Add Terra Pad 1061 to the run_edge_events_on_boot_blacklist
  tools: gpio: Correctly add make dependencies for gpio_utils
  gpio: bd70528: Use correct unit for debounce times
  gpio: max77620: Fixup debounce delays
2 parent s d324810 + cbdaa5e
Raw File
Tip revision: cec353f6c2c9ff003332a41ed37b55df88dfa9a5 authored by Linus Torvalds on 21 November 2019, 20:01:30 UTC
Merge tag 'gpio-v5.4-5' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio
Tip revision: cec353f
stacktrace.c
// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd. */

#include <linux/sched/debug.h>
#include <linux/sched/task_stack.h>
#include <linux/stacktrace.h>
#include <linux/ftrace.h>

void save_stack_trace(struct stack_trace *trace)
{
	save_stack_trace_tsk(current, trace);
}
EXPORT_SYMBOL_GPL(save_stack_trace);

void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
{
	unsigned long *fp, *stack_start, *stack_end;
	unsigned long addr;
	int skip = trace->skip;
	int savesched;
	int graph_idx = 0;

	if (tsk == current) {
		asm volatile("mov %0, r8\n":"=r"(fp));
		savesched = 1;
	} else {
		fp = (unsigned long *)thread_saved_fp(tsk);
		savesched = 0;
	}

	addr = (unsigned long) fp & THREAD_MASK;
	stack_start = (unsigned long *) addr;
	stack_end = (unsigned long *) (addr + THREAD_SIZE);

	while (fp > stack_start && fp < stack_end) {
		unsigned long lpp, fpp;

		fpp = fp[0];
		lpp = fp[1];
		if (!__kernel_text_address(lpp))
			break;
		else
			lpp = ftrace_graph_ret_addr(tsk, &graph_idx, lpp, NULL);

		if (savesched || !in_sched_functions(lpp)) {
			if (skip) {
				skip--;
			} else {
				trace->entries[trace->nr_entries++] = lpp;
				if (trace->nr_entries >= trace->max_entries)
					break;
			}
		}
		fp = (unsigned long *)fpp;
	}
}
EXPORT_SYMBOL_GPL(save_stack_trace_tsk);
back to top