Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add softlockup scenario for kdump/Fadump testing #785

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions test_binaries/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
obj-m += softlockup.o

all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
35 changes: 35 additions & 0 deletions test_binaries/softlockup.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/spinlock.h>

MODULE_LICENSE("GPL");
MODULE_AUTHOR("LIKHITHA");
MODULE_DESCRIPTION("Kernel Module for softlockups");

static spinlock_t my_lock;

int a;

static int __init my_init(void)
{
spin_lock_init(&my_lock);
printk(KERN_INFO "softlockup module: Initialized spinlock\n");

/* Perform critical section operations */
spin_lock(&my_lock);
while (1) {
a+=1;
}
spin_unlock(&my_lock);

return 0;
}

static void __exit my_exit(void)
{
printk(KERN_INFO "Exiting module\n");
}

module_init(my_init);
module_exit(my_exit);
26 changes: 26 additions & 0 deletions testcases/PowerNVDump.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@ def kernel_crash(self, crash_type="echo_c"):
elif crash_type == "hmc":
self.cv_HMC.run_command("chsysstate -r lpar -m %s -n %s -o dumprestart" %
(self.system_name, self.lpar_name), timeout=300)
elif crash_type == "softlockup":
self.c.pty.sendline("insmod /tmp/softlockup.ko")
done = False
boot_type = BootType.NORMAL
rc = -1
Expand Down Expand Up @@ -1323,6 +1325,29 @@ def runTest(self):
if not obj.update_kernel_cmdline(self.distro, remove_args="fadump=nocma", reboot=True, reboot_cmd=True):
self.fail("KernelArgTest failed to update kernel args")

class KernelCrash_KdumpSoftlockup(PowerNVDump):

'''
This test verifies kdump/fadump after inserting softlockup kernel module.
'''

def runTest(self):
self.setup_test()
# Make sure softlockup related file does not exist
self.c.run_command("cd /tmp; ls -1; rm -rf soft* Makefile", timeout=60)

#copy the source files from test_binaries to /tmp
self.cv_HOST.copy_test_file_to_host("softlockup.c")
self.cv_HOST.copy_test_file_to_host("Makefile")

#compile source files to get kernel modules
self.c.run_command("cd /tmp; make", timeout=60)

SACHIN-BAPPALIGE marked this conversation as resolved.
Show resolved Hide resolved
#Enable softlockup
self.c.run_command("sysctl -w kernel.softlockup_panic=1")

boot_type = self.kernel_crash(crash_type="softlockup")
self.verify_dump_file(boot_type)

def crash_suite():
s = unittest.TestSuite()
Expand Down Expand Up @@ -1354,5 +1379,6 @@ def crash_suite():
s.addTest(KernelCrash_DisableAll())
s.addTest(SkirootKernelCrash())
s.addTest(OPALCrash_MPIPL())
s.addTest(KernelCrash_KdumpSoftlockup())

return s