Linux Kernel Testing and Debugging
Linux PM Sub-system Testing in Simulation Mode
The Linux PM sub-system provides five PM test modes to test hibernation in a simulated mode. These modes allow exercising the hibernation code in various layers of the kernel without actually suspending the system. This is useful when there is a concern that suspend might not work on a specific platform and help detect errors in a simulation similar to simulating flying a plane, so to speak.
- freezer - test the freezing of processes
echo freezer > /sys/power/pm_test echo platform > /sys/power/disk echo disk > /sys/power/state
- devices - test the freezing of processes and suspending of devices
echo devices > /sys/power/pm_test echo platform > /sys/power/disk echo disk > /sys/power/state
- platform - test the freezing of processes, suspending of devices and platform global control methods(*)
echo platform > /sys/power/pm_test echo platform > /sys/power/disk echo disk > /sys/power/state
- processors - test the freezing of processes, suspending of devices, platform global control methods(*) and the disabling of non-boot CPUs
echo processors > /sys/power/pm_test echo platform > /sys/power/disk echo disk > /sys/power/state
- core - test the freezing of processes, suspending of devices, platform global control methods, the disabling of non-boot CPUs and suspending of platform/system devices. Note: this mode is tested on ACPI systems.
echo core > /sys/power/pm_test echo platform > /sys/power/disk echo disk > /sys/power/state
Linux PM Sub-system Trace Events
PM sub-system supports several tracepoints and trace events that can be enabled to trigger during run-time. I will give an overview on how to enable couple of these trace events and where to find the trace information they generate:
- Enabling PM events at run-time:
cd /sys/kernel/debug/tracing/events/power echo 1 > cpu_frequency/enable cat /sys/kernel/debug/tracing/set_event less /sys/kernel/debug/tracing/trace
- Enabling events at boot-time kernel trace parameter with a kernel boot option:
For more information on Linux PM testing, please consult the Documentation/power/basic-pm-debugging.txt and other documents in the same directory.
git bisect is an invaluable and powerful tool to isolate an offending commit. I will go over very basic git bisect steps.
- This is how the process works:
git bisect start git bisect bad # Current version is bad git bisect good v3.14-rc6 # last good version
Once, one bad and one good version are specified, git bisect will start bisecting by pulling in commits between the good version and the bad. Once a set of commits are pulled in, compile the kernel, install, test, and tag the version good or bad. This process repeats until the selected commits are tested and tagged as good or bad. There can be several kernel versions to test. When the last version is tested, git bisect will flag a commit that is bad. The following useful git-bisect command can aid in using git-bisect process:
- See step by step bisect progress
git bisect log
- Reset git bisect can be used in case of mistakes in tagging, save git log output and replay prior to reset
git bisect reset
- Replay a git-bisect log
git bisect replay git_log_output
git bisect can be run on a section of kernel source tree if the problem is clearly in that area. For example, when debugging a problem in radeon driver, running git bisect on drivers/drm/radeon will limit the scope of bisect to just the commits to drivers/drm/radeon driver.
- Start git bisect on a section of a kernel tree
git bisect start drivers/drm/radeon
Shuah Khan is a Senior Linux Kernel Developer at Samsung's Open Source Group.
Practical Task Scheduling Deployment
July 20, 2016 12:00 pm CDT
One of the best things about the UNIX environment (aside from being stable and efficient) is the vast array of software tools available to help you do your job. Traditionally, a UNIX tool does only one thing, but does that one thing very well. For example, grep is very easy to use and can search vast amounts of data quickly. The find tool can find a particular file or files based on all kinds of criteria. It's pretty easy to string these tools together to build even more powerful tools, such as a tool that finds all of the .log files in the /home directory and searches each one for a particular entry. This erector-set mentality allows UNIX system administrators to seem to always have the right tool for the job.
Cron traditionally has been considered another such a tool for job scheduling, but is it enough? This webinar considers that very question. The first part builds on a previous Geek Guide, Beyond Cron, and briefly describes how to know when it might be time to consider upgrading your job scheduling infrastructure. The second part presents an actual planning and implementation framework.
Join Linux Journal's Mike Diehl and Pat Cameron of Help Systems.
Free to Linux Journal readers.Register Now!
- SUSE LLC's SUSE Manager
- Murat Yener and Onur Dundar's Expert Android Studio (Wrox)
- My +1 Sword of Productivity
- Managing Linux Using Puppet
- Non-Linux FOSS: Caffeine!
- Doing for User Space What We Did for Kernel Space
- SuperTuxKart 0.9.2 Released
- Google's SwiftShader Released
- Parsing an RSS News Feed with a Bash Script
- Rogue Wave Software's Zend Server
With all the industry talk about the benefits of Linux on Power and all the performance advantages offered by its open architecture, you may be considering a move in that direction. If you are thinking about analytics, big data and cloud computing, you would be right to evaluate Power. The idea of using commodity x86 hardware and replacing it every three years is an outdated cost model. It doesn’t consider the total cost of ownership, and it doesn’t consider the advantage of real processing power, high-availability and multithreading like a demon.
This ebook takes a look at some of the practical applications of the Linux on Power platform and ways you might bring all the performance power of this open architecture to bear for your organization. There are no smoke and mirrors here—just hard, cold, empirical evidence provided by independent sources. I also consider some innovative ways Linux on Power will be used in the future.Get the Guide