1

Guys.

I am trying to study virtual memory management on Nexus 6P(An Old Android Smartphone)

Because the default kernel in AOSP didn't turn CONFIG_FUNCITON_TRACER on, and I can't use function tracer to study memory management related functions.

So I downloaded android kernel source code, turn on config_function_tracer and the other configs its depends, rebuilt kernel. Then I put the rebuilt kernel image file into aosp, rebuilt boot image , and flash the building output images into the phone.

the phone can boot normally, everything is ok but I can't 'cat /sys/kernel/debug/tracing/available_filter_functions' normally, it prompts "no such device".

I checked the selinux label, and I turn off the selinux by command 'setenforce permissive', it can't help.

can anyone help me to fix this problem?

C:\Users\dvdface>adb shell
angler:/ # cd /sys/kernel/debug/tracing/
angler:/sys/kernel/debug/tracing # ls
README                     dyn_ftrace_total_info per_cpu            set_ftrace_pid     tracing_cpumask
available_events           enabled_functions     printk_formats     set_graph_function tracing_on
available_filter_functions events                saved_cmdlines     trace              tracing_thresh
available_tracers          free_buffer           saved_tgids        trace_clock
buffer_size_kb             instances             set_event          trace_marker
buffer_total_size_kb       max_graph_depth       set_ftrace_filter  trace_options
current_tracer             options               set_ftrace_notrace trace_pipe
angler:/sys/kernel/debug/tracing # cat available_filter_functions
cat: available_filter_functions: No such device
Kevin Ding
  • 568
  • 5
  • 9

1 Answers1

0

I know why I got that error.

When building kernel with CONFIG_FUNCTION_TRACER, that need turn CONFIG_STRICT_MEMORY_RWX off

in this document (https://source.android.google.cn/devices/tech/debug/ftrace)

in the chapter Using dynamic ftrace, it says to turn it off.

after I turn it off, everything is okay.

config STRICT_MEMORY_RWX
    bool "restrict kernel memory permissions as much as possible"
    help
      If this is set, kernel text will be made RX, kernel data and stack
      RW, rodata R (otherwise all of the kernel 1-to-1 mapping is
      made RWX).
      The tradeoff is that several sections are padded to
      2M boundaries (because their permissions are different and
      splitting the 2M pages into 4K ones causes TLB performance
      problems), wasting memory.
Kevin Ding
  • 568
  • 5
  • 9