• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#! /bin/sh
2
3###########################################################################
4##                                                                       ##
5## Copyright (c) 2015, Red Hat Inc.                                      ##
6##                                                                       ##
7## This program is free software: you can redistribute it and/or modify  ##
8## it under the terms of the GNU General Public License as published by  ##
9## the Free Software Foundation, either version 3 of the License, or     ##
10## (at your option) any later version.                                   ##
11##                                                                       ##
12## This program is distributed in the hope that it will be useful,       ##
13## but WITHOUT ANY WARRANTY; without even the implied warranty of        ##
14## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the          ##
15## GNU General Public License for more details.                          ##
16##                                                                       ##
17## You should have received a copy of the GNU General Public License     ##
18## along with this program. If not, see <http://www.gnu.org/licenses/>.  ##
19##                                                                       ##
20## Author: Li Wang <liwang@redhat.com>                                   ##
21##                                                                       ##
22###########################################################################
23##                                                                       ##
24## Summary:  panic while using userstacktrace                            ##
25##                                                                       ##
26## BUG: unable to handle kernel paging request at 00000000417683c0       ##
27##      IP: [<ffffffff8105c834>] update_curr+0x124/0x1e0                 ##
28##      PGD 41a796067 PUD 0                                              ##
29##      Thread overran stack, or stack corrupted                         ##
30##      Oops: 0000 [#1] SMP                                              ##
31##      last sysfs file: ../system/cpu/cpu15/cache/index2/shared_cpu_map ##
32##                                                                       ##
33## The bug was fixed by:                                                 ##
34##      1dbd195 (tracing: Fix preempt count leak)                        ##
35##                                                                       ##
36###########################################################################
37
38export TCID="ftrace_regression01"
39export TST_TOTAL=1
40
41. ftrace_lib.sh
42
43LOOP=10
44
45TSTACK_TRACE_PATH="/proc/sys/kernel/stack_tracer_enabled"
46EXC_PAGE_FAULT_ENABLE="$TRACING_PATH/events/exceptions/page_fault_kernel/enable"
47MM_PAGE_FAULT_ENABLE="$TRACING_PATH/events/kmem/mm_kernel_pagefault/enable"
48
49ftrace_userstacktrace_test()
50{
51	if [ ! -e "$TSTACK_TRACE_PATH" ]; then
52		tst_brkm TCONF "Stack Tracer is not cofigured in This kernel"
53	fi
54
55	for i in $(seq $LOOP); do
56		echo 1 >  $TSTACK_TRACE_PATH
57		echo userstacktrace > $TRACING_PATH/trace_options
58		grep -q "^userstacktrace"  $TRACING_PATH/trace_options
59		if [ $? -ne 0 ]; then
60			tst_brkm TBROK "Failed to set userstacktrace"
61		fi
62
63		if [ -f "$EXC_PAGE_FAULT_ENABLE" ]; then
64			exc_page_fault_enable=`cat $EXC_PAGE_FAULT_ENABLE`
65			echo 1 > $EXC_PAGE_FAULT_ENABLE
66		else
67			mm_page_fault_enable=`cat $MM_PAGE_FAULT_ENABLE`
68			echo 1 > $MM_PAGE_FAULT_ENABLE
69		fi
70	done
71
72	if [ -f "$EXC_PAGE_FAULT_ENABLE" ]; then
73		echo "$exc_page_fault_enable" > $EXC_PAGE_FAULT_ENABLE
74	else
75		echo "$mm_page_fault_enable" > $MM_PAGE_FAULT_ENABLE
76	fi
77
78	tst_resm TPASS "Finished running the test"
79}
80
81ftrace_userstacktrace_test
82
83tst_exit
84