Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions BM/tdx-host/tdx_dpamt_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,24 @@ get_dpamt_kb() {

# function to start function profiling for a testcase
dpamt_profile_start() {
local profile=/sys/kernel/tracing/function_profile_enabled

if [ ! -w "$profile" ]; then
die "Function profiler control $profile is not writable."
fi
local trace=/sys/kernel/tracing
local profile="$trace/function_profile_enabled"
local filter="$trace/set_ftrace_filter"
local available="$trace/available_filter_functions"
local function

for function in tdh_phymem_pamt_add tdh_phymem_pamt_remove; do
grep -qw "$function" "$available" || \
die "Function $function is unavailable for ftrace."
done

echo 0 > "$profile" || die "Failed to reset function profiling."
echo nop > "$trace/current_tracer" || die "Failed to select the nop tracer."
: > "$filter" || die "Failed to clear the ftrace function filter."
echo tdh_phymem_pamt_add > "$filter" || \
die "Failed to add tdh_phymem_pamt_add to the ftrace function filter."
echo tdh_phymem_pamt_remove >> "$filter" || \
die "Failed to add tdh_phymem_pamt_remove to the ftrace function filter."
echo 1 > "$profile" || die "Failed to enable function profiling."
trap dpamt_profile_stop EXIT
test_print_trc "Function profiling enabled for dynamic PAMT accounting"
Expand Down
Loading