Skip to content

Commit 1c9d831

Browse files
committed
Merge tag 'powerpc-6.6-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc fixes from Michael Ellerman: - Fix arch_stack_walk_reliable(), used by live patching - Fix powerpc selftests to work with run_kselftest.sh Thanks to Joe Lawrence and Petr Mladek. * tag 'powerpc-6.6-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: selftests/powerpc: Fix emit_tests to work with run_kselftest.sh powerpc/stacktrace: Fix arch_stack_walk_reliable()
2 parents ae21363 + 58b33e7 commit 1c9d831

File tree

3 files changed

+14
-31
lines changed

3 files changed

+14
-31
lines changed

arch/powerpc/kernel/stacktrace.c

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -73,29 +73,12 @@ int __no_sanitize_address arch_stack_walk_reliable(stack_trace_consume_fn consum
7373
bool firstframe;
7474

7575
stack_end = stack_page + THREAD_SIZE;
76-
if (!is_idle_task(task)) {
77-
/*
78-
* For user tasks, this is the SP value loaded on
79-
* kernel entry, see "PACAKSAVE(r13)" in _switch() and
80-
* system_call_common().
81-
*
82-
* Likewise for non-swapper kernel threads,
83-
* this also happens to be the top of the stack
84-
* as setup by copy_thread().
85-
*
86-
* Note that stack backlinks are not properly setup by
87-
* copy_thread() and thus, a forked task() will have
88-
* an unreliable stack trace until it's been
89-
* _switch()'ed to for the first time.
90-
*/
91-
stack_end -= STACK_USER_INT_FRAME_SIZE;
92-
} else {
93-
/*
94-
* idle tasks have a custom stack layout,
95-
* c.f. cpu_idle_thread_init().
96-
*/
76+
77+
// See copy_thread() for details.
78+
if (task->flags & PF_KTHREAD)
9779
stack_end -= STACK_FRAME_MIN_SIZE;
98-
}
80+
else
81+
stack_end -= STACK_USER_INT_FRAME_SIZE;
9982

10083
if (task == current)
10184
sp = current_stack_frame();

tools/testing/selftests/powerpc/Makefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,11 @@ override define INSTALL_RULE
5959
done;
6060
endef
6161

62-
override define EMIT_TESTS
62+
emit_tests:
6363
+@for TARGET in $(SUB_DIRS); do \
6464
BUILD_TARGET=$(OUTPUT)/$$TARGET; \
65-
$(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests;\
65+
$(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET $@;\
6666
done;
67-
endef
6867

6968
override define CLEAN
7069
+@for TARGET in $(SUB_DIRS); do \
@@ -77,4 +76,4 @@ endef
7776
tags:
7877
find . -name '*.c' -o -name '*.h' | xargs ctags
7978

80-
.PHONY: tags $(SUB_DIRS)
79+
.PHONY: tags $(SUB_DIRS) emit_tests

tools/testing/selftests/powerpc/pmu/Makefile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@ override define RUN_TESTS
3030
+TARGET=event_code_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests
3131
endef
3232

33-
DEFAULT_EMIT_TESTS := $(EMIT_TESTS)
34-
override define EMIT_TESTS
35-
$(DEFAULT_EMIT_TESTS)
33+
emit_tests:
34+
for TEST in $(TEST_GEN_PROGS); do \
35+
BASENAME_TEST=`basename $$TEST`; \
36+
echo "$(COLLECTION):$$BASENAME_TEST"; \
37+
done
3638
+TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests
3739
+TARGET=sampling_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests
3840
+TARGET=event_code_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests
39-
endef
4041

4142
DEFAULT_INSTALL_RULE := $(INSTALL_RULE)
4243
override define INSTALL_RULE
@@ -64,4 +65,4 @@ sampling_tests:
6465
event_code_tests:
6566
TARGET=$@; BUILD_TARGET=$$OUTPUT/$$TARGET; mkdir -p $$BUILD_TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -k -C $$TARGET all
6667

67-
.PHONY: all run_tests ebb sampling_tests event_code_tests
68+
.PHONY: all run_tests ebb sampling_tests event_code_tests emit_tests

0 commit comments

Comments
 (0)